All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Hartmut Knaack <knaack.h@gmx.de>, linux-iio@vger.kernel.org
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	Tiberiu Breana <tiberiu.a.breana@intel.com>
Subject: Re: [PATCH v2 2/5] iio:light:stk3310: make endianness independent of host
Date: Sun, 19 Jul 2015 14:55:41 +0100	[thread overview]
Message-ID: <55ABAC5D.30206@kernel.org> (raw)
In-Reply-To: <942ccba3622543a862cb399c6f57e8b8ddcdbe6e.1436398691.git.knaack.h@gmx.de>

On 09/07/15 22:51, Hartmut Knaack wrote:
> Data is stored in the device in be16 format. Make use of be16_to_cpu and
> cpu_to_be16 to have correct endianness on any host architecture.
> 
> Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
> Reviewed-by: Tiberiu Breana <tiberiu.a.breana@intel.com>
Applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan
> ---
>  drivers/iio/light/stk3310.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c
> index e7e6e5a2b1f8..11a027adc204 100644
> --- a/drivers/iio/light/stk3310.c
> +++ b/drivers/iio/light/stk3310.c
> @@ -200,7 +200,7 @@ static int stk3310_read_event(struct iio_dev *indio_dev,
>  			      int *val, int *val2)
>  {
>  	u8 reg;
> -	u16 buf;
> +	__be16 buf;
>  	int ret;
>  	struct stk3310_data *data = iio_priv(indio_dev);
>  
> @@ -222,7 +222,7 @@ static int stk3310_read_event(struct iio_dev *indio_dev,
>  		dev_err(&data->client->dev, "register read failed\n");
>  		return ret;
>  	}
> -	*val = swab16(buf);
> +	*val = be16_to_cpu(buf);
>  
>  	return IIO_VAL_INT;
>  }
> @@ -235,7 +235,7 @@ static int stk3310_write_event(struct iio_dev *indio_dev,
>  			       int val, int val2)
>  {
>  	u8 reg;
> -	u16 buf;
> +	__be16 buf;
>  	int ret;
>  	unsigned int index;
>  	struct stk3310_data *data = iio_priv(indio_dev);
> @@ -252,7 +252,7 @@ static int stk3310_write_event(struct iio_dev *indio_dev,
>  	else
>  		return -EINVAL;
>  
> -	buf = swab16(val);
> +	buf = cpu_to_be16(val);
>  	ret = regmap_bulk_write(data->regmap, reg, &buf, 2);
>  	if (ret < 0)
>  		dev_err(&client->dev, "failed to set PS threshold!\n");
> @@ -301,7 +301,7 @@ static int stk3310_read_raw(struct iio_dev *indio_dev,
>  			    int *val, int *val2, long mask)
>  {
>  	u8 reg;
> -	u16 buf;
> +	__be16 buf;
>  	int ret;
>  	unsigned int index;
>  	struct stk3310_data *data = iio_priv(indio_dev);
> @@ -322,7 +322,7 @@ static int stk3310_read_raw(struct iio_dev *indio_dev,
>  			mutex_unlock(&data->lock);
>  			return ret;
>  		}
> -		*val = swab16(buf);
> +		*val = be16_to_cpu(buf);
>  		mutex_unlock(&data->lock);
>  		return IIO_VAL_INT;
>  	case IIO_CHAN_INFO_INT_TIME:
> 


  reply	other threads:[~2015-07-19 13:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-09 21:51 [PATCH v2 0/5] stk3310 fixes and cleanup Hartmut Knaack
2015-07-09 21:51 ` [PATCH v2 1/5] iio:light:stk3310: move device register to end of probe Hartmut Knaack
2015-07-19 13:53   ` Jonathan Cameron
2015-07-09 21:51 ` [PATCH v2 2/5] iio:light:stk3310: make endianness independent of host Hartmut Knaack
2015-07-19 13:55   ` Jonathan Cameron [this message]
2015-07-09 21:51 ` [PATCH v2 3/5] iio:light:stk3310: add more error handling Hartmut Knaack
2015-07-19 13:57   ` Jonathan Cameron
2015-08-12 21:16     ` Jonathan Cameron
2015-07-09 21:51 ` [PATCH v2 4/5] iio:light:stk3310: use correct names and type for state Hartmut Knaack
2015-07-19 13:58   ` Jonathan Cameron
2015-08-12 21:16     ` Jonathan Cameron
2015-07-09 21:51 ` [PATCH v2 5/5] iio:light:stk3310: adjust indentation Hartmut Knaack
2015-08-12 21:17   ` Jonathan Cameron
2015-07-10  8:02 ` [PATCH v2 0/5] stk3310 fixes and cleanup Breana, Tiberiu A

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55ABAC5D.30206@kernel.org \
    --to=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=tiberiu.a.breana@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.