public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Michael Hennerich <michael.hennerich@analog.com>
Cc: Stefan Popa <stefan.popa@analog.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	<linux-iio@vger.kernel.org>, <devel@driverdev.osuosl.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] staging: iio: ad7192: Use the dedicated reset function
Date: Sat, 16 Sep 2017 15:22:23 -0700	[thread overview]
Message-ID: <20170916152223.03b1d347@archlinux> (raw)
In-Reply-To: <1c2f62f5-3a64-29a0-7bbf-8545173530f9@analog.com>

On Thu, 14 Sep 2017 16:31:06 +0200
Michael Hennerich <michael.hennerich@analog.com> wrote:

> On 14.09.2017 15:50, Stefan Popa wrote:
> > SPI host drivers can use DMA to transfer data, so the buffer should be properly allocated.
> > Keeping it on the stack could cause an undefined behavior.
> > 
> > The dedicated reset function solves this issue.
> > 
> > Signed-off-by: Stefan Popa <stefan.popa@analog.com>  
> 
> Acked-by: Michael Hennerich <michael.hennerich@analog.com>

Applied to the togreg branch of iio.git rather than staging
branch as the reset functionality is reasonably recent and
not going to be available in stable kernels etc..

Good work. I was reading this on a plane the other day and
noticed the same issue - always nice when someone else
fixes something on your todo list ;)

Jonathan

> 
> Well done!
> 
> 
> > ---
> >   drivers/staging/iio/adc/ad7192.c | 4 +---
> >   1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
> > index d11c6de..6150d27 100644
> > --- a/drivers/staging/iio/adc/ad7192.c
> > +++ b/drivers/staging/iio/adc/ad7192.c
> > @@ -223,11 +223,9 @@ static int ad7192_setup(struct ad7192_state *st,
> >   	struct iio_dev *indio_dev = spi_get_drvdata(st->sd.spi);
> >   	unsigned long long scale_uv;
> >   	int i, ret, id;
> > -	u8 ones[6];
> >   
> >   	/* reset the serial interface */
> > -	memset(&ones, 0xFF, 6);
> > -	ret = spi_write(st->sd.spi, &ones, 6);
> > +	ret = ad_sd_reset(&st->sd, 48);
> >   	if (ret < 0)
> >   		goto out;
> >   	usleep_range(500, 1000); /* Wait for at least 500us */
> >   
> 
> 

  reply	other threads:[~2017-09-16 22:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14 13:50 [PATCH] staging: iio: ad7192: Use the dedicated reset function Stefan Popa
2017-09-14 13:57 ` Lars-Peter Clausen
2017-09-14 14:31 ` Michael Hennerich
2017-09-16 22:22   ` Jonathan Cameron [this message]
2017-09-16 22:33     ` 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=20170916152223.03b1d347@archlinux \
    --to=jic23@kernel.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.hennerich@analog.com \
    --cc=stefan.popa@analog.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox