All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: magnetometer: ak8974: small endianness fixes
@ 2016-10-01 17:30 Ico Doornekamp
  2016-10-03 20:30 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Ico Doornekamp @ 2016-10-01 17:30 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio, Ico Doornekamp

Fixes two cases of 'cast to restricted __le16' as reported by sparse.

Signed-off-by: Ico Doornekamp <ico@pruts.nl>
---
 drivers/iio/magnetometer/ak8974.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c
index 2173531..ce09d77 100644
--- a/drivers/iio/magnetometer/ak8974.c
+++ b/drivers/iio/magnetometer/ak8974.c
@@ -287,7 +287,7 @@ static int ak8974_await_drdy(struct ak8974 *ak8974)
 	return 0;
 }
 
-static int ak8974_getresult(struct ak8974 *ak8974, s16 *result)
+static int ak8974_getresult(struct ak8974 *ak8974, __le16 *result)
 {
 	unsigned int src;
 	int ret;
@@ -395,7 +395,7 @@ static int ak8974_selftest(struct ak8974 *ak8974)
 static int ak8974_get_u16_val(struct ak8974 *ak8974, u8 reg, u16 *val)
 {
 	int ret;
-	u16 bulk;
+	__le16 bulk;
 
 	ret = regmap_bulk_read(ak8974->map, reg, &bulk, 2);
 	if (ret)
@@ -453,7 +453,7 @@ static int ak8974_read_raw(struct iio_dev *indio_dev,
 			   long mask)
 {
 	struct ak8974 *ak8974 = iio_priv(indio_dev);
-	s16 hw_values[3];
+	__le16 hw_values[3];
 	int ret = -EINVAL;
 
 	pm_runtime_get_sync(&ak8974->i2c->dev);
@@ -494,7 +494,7 @@ static void ak8974_fill_buffer(struct iio_dev *indio_dev)
 {
 	struct ak8974 *ak8974 = iio_priv(indio_dev);
 	int ret;
-	s16 hw_values[8]; /* Three axes + 64bit padding */
+	__le16 hw_values[8]; /* Three axes + 64bit padding */
 
 	pm_runtime_get_sync(&ak8974->i2c->dev);
 	mutex_lock(&ak8974->lock);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iio: magnetometer: ak8974: small endianness fixes
  2016-10-01 17:30 [PATCH] iio: magnetometer: ak8974: small endianness fixes Ico Doornekamp
@ 2016-10-03 20:30 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2016-10-03 20:30 UTC (permalink / raw)
  To: Ico Doornekamp; +Cc: linux-iio

On 01/10/16 18:30, Ico Doornekamp wrote:
> Fixes two cases of 'cast to restricted __le16' as reported by sparse.
> 
> Signed-off-by: Ico Doornekamp <ico@pruts.nl>
Applied to the togreg branch of iio.git and pushed out as testing.

Thanks,

Jonathan
> ---
>  drivers/iio/magnetometer/ak8974.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c
> index 2173531..ce09d77 100644
> --- a/drivers/iio/magnetometer/ak8974.c
> +++ b/drivers/iio/magnetometer/ak8974.c
> @@ -287,7 +287,7 @@ static int ak8974_await_drdy(struct ak8974 *ak8974)
>  	return 0;
>  }
>  
> -static int ak8974_getresult(struct ak8974 *ak8974, s16 *result)
> +static int ak8974_getresult(struct ak8974 *ak8974, __le16 *result)
>  {
>  	unsigned int src;
>  	int ret;
> @@ -395,7 +395,7 @@ static int ak8974_selftest(struct ak8974 *ak8974)
>  static int ak8974_get_u16_val(struct ak8974 *ak8974, u8 reg, u16 *val)
>  {
>  	int ret;
> -	u16 bulk;
> +	__le16 bulk;
>  
>  	ret = regmap_bulk_read(ak8974->map, reg, &bulk, 2);
>  	if (ret)
> @@ -453,7 +453,7 @@ static int ak8974_read_raw(struct iio_dev *indio_dev,
>  			   long mask)
>  {
>  	struct ak8974 *ak8974 = iio_priv(indio_dev);
> -	s16 hw_values[3];
> +	__le16 hw_values[3];
>  	int ret = -EINVAL;
>  
>  	pm_runtime_get_sync(&ak8974->i2c->dev);
> @@ -494,7 +494,7 @@ static void ak8974_fill_buffer(struct iio_dev *indio_dev)
>  {
>  	struct ak8974 *ak8974 = iio_priv(indio_dev);
>  	int ret;
> -	s16 hw_values[8]; /* Three axes + 64bit padding */
> +	__le16 hw_values[8]; /* Three axes + 64bit padding */
>  
>  	pm_runtime_get_sync(&ak8974->i2c->dev);
>  	mutex_lock(&ak8974->lock);
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-03 20:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-01 17:30 [PATCH] iio: magnetometer: ak8974: small endianness fixes Ico Doornekamp
2016-10-03 20:30 ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.