linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH 3/8] iio:adxrs450: Use spi_sync_transfer()
Date: Sat, 05 Oct 2013 11:59:55 +0100	[thread overview]
Message-ID: <524FF12B.3030604@kernel.org> (raw)
In-Reply-To: <1380959108-21775-3-git-send-email-lars@metafoo.de>

On 10/05/13 08:45, Lars-Peter Clausen wrote:
> Use the spi_sync_transfer() helper function instead of open-coding it. Makes
> the code a bit shorter.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Applied to the togreg branch of iio.git

Thanks,
> ---
>  drivers/iio/gyro/adxrs450.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/iio/gyro/adxrs450.c b/drivers/iio/gyro/adxrs450.c
> index c1f40ef..1e546ba 100644
> --- a/drivers/iio/gyro/adxrs450.c
> +++ b/drivers/iio/gyro/adxrs450.c
> @@ -90,7 +90,6 @@ static int adxrs450_spi_read_reg_16(struct iio_dev *indio_dev,
>  				    u8 reg_address,
>  				    u16 *val)
>  {
> -	struct spi_message msg;
>  	struct adxrs450_state *st = iio_priv(indio_dev);
>  	u32 tx;
>  	int ret;
> @@ -114,10 +113,7 @@ static int adxrs450_spi_read_reg_16(struct iio_dev *indio_dev,
>  		tx |= ADXRS450_P;
>  
>  	st->tx = cpu_to_be32(tx);
> -	spi_message_init(&msg);
> -	spi_message_add_tail(&xfers[0], &msg);
> -	spi_message_add_tail(&xfers[1], &msg);
> -	ret = spi_sync(st->us, &msg);
> +	ret = spi_sync_transfer(st->us, xfers, ARRAY_SIZE(xfers));
>  	if (ret) {
>  		dev_err(&st->us->dev, "problem while reading 16 bit register 0x%02x\n",
>  				reg_address);
> @@ -169,7 +165,6 @@ static int adxrs450_spi_write_reg_16(struct iio_dev *indio_dev,
>   **/
>  static int adxrs450_spi_sensor_data(struct iio_dev *indio_dev, s16 *val)
>  {
> -	struct spi_message msg;
>  	struct adxrs450_state *st = iio_priv(indio_dev);
>  	int ret;
>  	struct spi_transfer xfers[] = {
> @@ -188,10 +183,7 @@ static int adxrs450_spi_sensor_data(struct iio_dev *indio_dev, s16 *val)
>  	mutex_lock(&st->buf_lock);
>  	st->tx = cpu_to_be32(ADXRS450_SENSOR_DATA);
>  
> -	spi_message_init(&msg);
> -	spi_message_add_tail(&xfers[0], &msg);
> -	spi_message_add_tail(&xfers[1], &msg);
> -	ret = spi_sync(st->us, &msg);
> +	ret = spi_sync_transfer(st->us, xfers, ARRAY_SIZE(xfers));
>  	if (ret) {
>  		dev_err(&st->us->dev, "Problem while reading sensor data\n");
>  		goto error_ret;
> 

  reply	other threads:[~2013-10-05  9:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-05  7:45 [PATCH 1/8] iio:ad5449: Use spi_sync_transfer() Lars-Peter Clausen
2013-10-05  7:45 ` [PATCH 2/8] iio:adis16080: " Lars-Peter Clausen
2013-10-05 10:59   ` Jonathan Cameron
2013-10-05  7:45 ` [PATCH 3/8] iio:adxrs450: " Lars-Peter Clausen
2013-10-05 10:59   ` Jonathan Cameron [this message]
2013-10-05  7:45 ` [PATCH 4/8] iio:adis16130: " Lars-Peter Clausen
2013-10-05 11:00   ` Jonathan Cameron
2013-10-05 11:00   ` Jonathan Cameron
2013-10-05  7:45 ` [PATCH 5/8] staging:iio:adis16220: " Lars-Peter Clausen
2013-10-05 11:01   ` Jonathan Cameron
2013-10-05  7:45 ` [PATCH 6/8] staging:iio:ad9852: " Lars-Peter Clausen
2013-10-05 11:01   ` Jonathan Cameron
2013-10-05  7:45 ` [PATCH 7/8] staging:iio:ad9910: " Lars-Peter Clausen
2013-10-05 11:01   ` Jonathan Cameron
2013-10-05  7:45 ` [PATCH 8/8] staging:iio:ad9951: " Lars-Peter Clausen
2013-10-05 11:02   ` Jonathan Cameron
2013-10-05 10:58 ` [PATCH 1/8] iio:ad5449: " Jonathan Cameron

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=524FF12B.3030604@kernel.org \
    --to=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).