From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com ([74.125.82.65]:55886 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751894AbeCXM04 (ORCPT ); Sat, 24 Mar 2018 08:26:56 -0400 Received: by mail-wm0-f65.google.com with SMTP id t7so7903001wmh.5 for ; Sat, 24 Mar 2018 05:26:56 -0700 (PDT) References: <0bf705c8d642bdd9d3a3b7e4653028a88df76ff9.1521379685.git.davidjulianveenstra@gmail.com> <20180323142024.00005edb@huawei.com> From: David Julian Veenstra To: Jonathan Cameron Cc: lars@metafoo.de, jic23@kernel.org, Michael.Hennerich@analog.com, knaack.h@gmx.de, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org Subject: Re: [PATCH 07/11] staging: iio: ad2s1200: Ensure udelay(1) in all necessary code paths In-reply-to: <20180323142024.00005edb@huawei.com> Date: Sat, 24 Mar 2018 13:26:54 +0100 Message-ID: <87d0ztmzg1.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-iio-owner@vger.kernel.org List-Id: linux-iio@vger.kernel.org On 23, March 2018 14:20, Jonathan Cameron wrote: > On Sun, 18 Mar 2018 14:36:15 +0100 > David Veenstra wrote: > >> After a successful spi transaction, a udelay(1) is needed. >> This doesn't happen for the default case of the switch statement >> in ad2s1200_read_raw. This patch makes sure that it does. >> >> Signed-off-by: David Veenstra > Given this one can't actually happen as the chan->type > is always one of the two options, I can't see the point > in making sure we sleep. > > The default is really just there to catch bugs and to suppress > the build warning we would otherwise get. > > So I am unconvinced on this patch. I wasn't sure about this patch, but tried to be as critical as possible. I'll leave it out for V2. Best regards, David Veenstra > > Jonathan >> --- >> drivers/staging/iio/resolver/ad2s1200.c | 8 +++++--- >> 1 file changed, 5 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/staging/iio/resolver/ad2s1200.c b/drivers/staging/iio/resolver/ad2s1200.c >> index e0e7c88368ed..6ce9ca13094a 100644 >> --- a/drivers/staging/iio/resolver/ad2s1200.c >> +++ b/drivers/staging/iio/resolver/ad2s1200.c >> @@ -78,20 +78,22 @@ static int ad2s1200_read_raw(struct iio_dev *indio_dev, >> switch (chan->type) { >> case IIO_ANGL: >> *val = vel >> 4; >> + ret = IIO_VAL_INT; >> break; >> case IIO_ANGL_VEL: >> *val = sign_extend32((s16)vel >> 4, 11); >> + ret = IIO_VAL_INT; >> break; >> default: >> - mutex_unlock(&st->lock); >> - return -EINVAL; >> + ret = -EINVAL; >> + break; >> } >> >> /* delay (2 * AD2S1200_TSCLK + 20) ns for sample pulse */ >> udelay(1); >> mutex_unlock(&st->lock); >> >> - return IIO_VAL_INT; >> + return ret; >> } >> >> static const struct iio_chan_spec ad2s1200_channels[] = {