On Tue, Mar 12, 2019 at 01:14:39PM +0000, Carlos Menin wrote:
> Cells in DT are 32-bits in size. of_property_read_u8() does not work
> properly as it returns incorrect values in little-endian architectures.
> Fix it by using of_property_read_u32() instead.
> 
Are you saying that pretty much all callers of of_property_read_u8()
have this problem ? I would not rule that out, but it seems hard to
believe.

Guenter

> Signed-off-by: Carlos Menin <[email protected]>
> ---
>  drivers/hwmon/adc128d818.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwmon/adc128d818.c b/drivers/hwmon/adc128d818.c
> index ca794bf..b5eb3c0 100644
> --- a/drivers/hwmon/adc128d818.c
> +++ b/drivers/hwmon/adc128d818.c
> @@ -70,7 +70,7 @@ struct adc128_data {
>       struct regulator *regulator;
>       int vref;               /* Reference voltage in mV */
>       struct mutex update_lock;
> -     u8 mode;                /* Operation mode */
> +     u32 mode;               /* Operation mode */
>       bool valid;             /* true if following fields are valid */
>       unsigned long last_updated;     /* In jiffies */
>  
> @@ -467,7 +467,7 @@ static int adc128_probe(struct i2c_client *client,
>       }
>  
>       /* Operation mode is optional. If unspecified, keep current mode */
> -     if (of_property_read_u8(dev->of_node, "ti,mode", &data->mode) == 0) {
> +     if (of_property_read_u32(dev->of_node, "ti,mode", &data->mode) == 0) {
>               if (data->mode > 3) {
>                       dev_err(dev, "invalid operation mode %d\n",
>                               data->mode);
> -- 
> 2.7.4
> 

Reply via email to