mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ardelean, Alexandru" <alexandru.Ardelean@analog.com>
To: "hofrat@osadl.org" <hofrat@osadl.org>,
	"lars@metafoo.de" <lars@metafoo.de>
Cc: "knaack.h@gmx.de" <knaack.h@gmx.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"pmeerw@pmeerw.net" <pmeerw@pmeerw.net>,
	"Hennerich, Michael" <Michael.Hennerich@analog.com>,
	"jic23@kernel.org" <jic23@kernel.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: [PATCH] iio: ad_sigma_delta: use unsigned long for timeout
Date: Fri, 27 Jul 2018 06:39:25 +0000	[thread overview]
Message-ID: <1284099be1e67ef443e7b7f0370db0a6b70cb48e.camel@analog.com> (raw)
In-Reply-To: <c07f288a40a3626d79a1b57173fa1a340afd3180.camel@analog.com>

On Thu, 2018-07-26 at 11:44 +0000, Ardelean, Alexandru wrote:
> On Mon, 2018-07-23 at 11:18 +0200, Nicholas Mc Guire wrote:
> > wait_for_completion_timeout returns unsigned long not int so an
> > appropriate
> > variable is declared and the assignment and check fixed up.
> > 
> 
> Patch looks good.
> 
> Thanks for this

[ I forgot to add this ]

Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>


> 
> Alex
> 
> > Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> > ---
> > 
> > found by experimental coccinelle script
> > 
> > As the timeout returned is always << INT_MAX there is no side-effect
> > with
> > the
> > type conversion here, never the less proper types should be used.
> > 
> > Patch was compile tested with: x86_64_defconfig + CONFIG_SPI=y,
> > CONFIG_IIO=y,
> > CONFIG_AD7793=y (implies CONFIG_AD_SIGMA_DELTA=y)
> > 
> > Patch is against 4.18-rc5 (localversion-next is next-20180720)
> > 
> >  drivers/iio/adc/ad_sigma_delta.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/adc/ad_sigma_delta.c
> > b/drivers/iio/adc/ad_sigma_delta.c
> > index cf1b048..fc95107 100644
> > --- a/drivers/iio/adc/ad_sigma_delta.c
> > +++ b/drivers/iio/adc/ad_sigma_delta.c
> > @@ -209,6 +209,7 @@ static int ad_sd_calibrate(struct ad_sigma_delta
> > *sigma_delta,
> >  	unsigned int mode, unsigned int channel)
> >  {
> >  	int ret;
> > +	unsigned long timeout;
> >  
> >  	ret = ad_sigma_delta_set_channel(sigma_delta, channel);
> >  	if (ret)
> > @@ -224,8 +225,8 @@ static int ad_sd_calibrate(struct ad_sigma_delta
> > *sigma_delta,
> >  
> >  	sigma_delta->irq_dis = false;
> >  	enable_irq(sigma_delta->spi->irq);
> > -	ret = wait_for_completion_timeout(&sigma_delta->completion,
> > 2*HZ);
> > -	if (ret == 0) {
> > +	timeout = wait_for_completion_timeout(&sigma_delta-
> > >completion,
> > 2 * HZ);
> > +	if (timeout == 0) {
> >  		sigma_delta->irq_dis = true;
> >  		disable_irq_nosync(sigma_delta->spi->irq);
> >  		ret =
> > -EIO;N�����r��y���b�X��ǧv�^�)޺{.n�+����{��*"��^n�r���z�\x1a��h����&��\x1e�G��
> > �h�\x03(�階�ݢj"��\x1a�^[m�����z�ޖ���f���h���~�m�

      reply	other threads:[~2018-07-27  6:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23  9:18 Nicholas Mc Guire
2018-07-26 11:44 ` Ardelean, Alexandru
2018-07-27  6:39   ` Ardelean, Alexandru [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=1284099be1e67ef443e7b7f0370db0a6b70cb48e.camel@analog.com \
    --to=alexandru.ardelean@analog.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=hofrat@osadl.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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

all inboxes | Powered by JetHome®