All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Denis Ciocca <denis.ciocca@gmail.com>
Cc: lars@metafoo.de, linux-iio@vger.kernel.org,
	Denis Ciocca <denis.ciocca@st.com>
Subject: Re: [PATCH] iio:common: Use spi_sync_transfer() in STMicroelectronics common library
Date: Sun, 03 Mar 2013 12:13:38 +0000	[thread overview]
Message-ID: <51333E72.40308@kernel.org> (raw)
In-Reply-To: <1360426103-3333-1-git-send-email-denis.ciocca@st.com>

On 02/09/2013 04:08 PM, Denis Ciocca wrote:
> Use the new spi_sync_transfer() helper function instead of open-coding it.
> 
> Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Applied to togreg branch of iio.git
> ---
>  drivers/iio/common/st_sensors/st_sensors_spi.c |   11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/iio/common/st_sensors/st_sensors_spi.c b/drivers/iio/common/st_sensors/st_sensors_spi.c
> index f0aa2f1..251baf6 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_spi.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_spi.c
> @@ -29,7 +29,6 @@ static unsigned int st_sensors_spi_get_irq(struct iio_dev *indio_dev)
>  static int st_sensors_spi_read(struct st_sensor_transfer_buffer *tb,
>  	struct device *dev, u8 reg_addr, int len, u8 *data, bool multiread_bit)
>  {
> -	struct spi_message msg;
>  	int err;
>  
>  	struct spi_transfer xfers[] = {
> @@ -51,10 +50,7 @@ static int st_sensors_spi_read(struct st_sensor_transfer_buffer *tb,
>  	else
>  		tb->tx_buf[0] = reg_addr | ST_SENSORS_SPI_READ;
>  
> -	spi_message_init(&msg);
> -	spi_message_add_tail(&xfers[0], &msg);
> -	spi_message_add_tail(&xfers[1], &msg);
> -	err = spi_sync(to_spi_device(dev), &msg);
> +	err = spi_sync_transfer(to_spi_device(dev), xfers, ARRAY_SIZE(xfers));
>  	if (err)
>  		goto acc_spi_read_error;
>  
> @@ -83,7 +79,6 @@ static int st_sensors_spi_read_multiple_byte(
>  static int st_sensors_spi_write_byte(struct st_sensor_transfer_buffer *tb,
>  				struct device *dev, u8 reg_addr, u8 data)
>  {
> -	struct spi_message msg;
>  	int err;
>  
>  	struct spi_transfer xfers = {
> @@ -96,9 +91,7 @@ static int st_sensors_spi_write_byte(struct st_sensor_transfer_buffer *tb,
>  	tb->tx_buf[0] = reg_addr;
>  	tb->tx_buf[1] = data;
>  
> -	spi_message_init(&msg);
> -	spi_message_add_tail(&xfers, &msg);
> -	err = spi_sync(to_spi_device(dev), &msg);
> +	err = spi_sync_transfer(to_spi_device(dev), &xfers, 1);
>  	mutex_unlock(&tb->buf_lock);
>  
>  	return err;
> 

      reply	other threads:[~2013-03-03 12:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-09 16:08 [PATCH] iio:common: Use spi_sync_transfer() in STMicroelectronics common library Denis Ciocca
2013-03-03 12:13 ` Jonathan Cameron [this message]

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=51333E72.40308@kernel.org \
    --to=jic23@kernel.org \
    --cc=denis.ciocca@gmail.com \
    --cc=denis.ciocca@st.com \
    --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 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.