Re: [PATCH v2] drivers: iio: light: Fix sparse warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24/09/16 17:14, Sandhya Bankar wrote:
> Fixing below warnings:
> 
> drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
> drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
> drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
> drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
> 
> Signed-off-by: Sandhya Bankar <bankarsandhya512@xxxxxxxxx>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Plenty of time for any other comments though as I won't be pushing out
togreg publicly for at least a few days.

Thanks,

Jonathan
> ---
> Changes in v2:
> * Introducing local variable to do the initial read,
> then put it in regval via be16_to_cpu call
> 
>  drivers/iio/light/max44000.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/light/max44000.c b/drivers/iio/light/max44000.c
> index 6511b20..a144ca3 100644
> --- a/drivers/iio/light/max44000.c
> +++ b/drivers/iio/light/max44000.c
> @@ -204,17 +204,18 @@ static int max44000_write_alspga(struct max44000_data *data, int val)
>  static int max44000_read_alsval(struct max44000_data *data)
>  {
>  	u16 regval;
> +	__be16 val;
>  	int alstim, ret;
>  
>  	ret = regmap_bulk_read(data->regmap, MAX44000_REG_ALS_DATA_HI,
> -			       &regval, sizeof(regval));
> +			       &val, sizeof(val));
>  	if (ret < 0)
>  		return ret;
>  	alstim = ret = max44000_read_alstim(data);
>  	if (ret < 0)
>  		return ret;
>  
> -	regval = be16_to_cpu(regval);
> +	regval = be16_to_cpu(val);
>  
>  	/*
>  	 * Overflow is explained on datasheet page 17.
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux