All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: Kaaira Gupta <kgupta@es.iitr.ac.in>
Cc: Julia Lawall <julia.lawall@inria.fr>,
	Ian Abbott <abbotti@mev.co.uk>,
	H Hartley Sweeten <hsweeten@visionengravers.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [PATCH 5/5] staging: comedi: drivers: use unsigned int
Date: Sun, 15 Mar 2020 21:23:45 +0100	[thread overview]
Message-ID: <20200315212345.611a20cd@elisabeth> (raw)
In-Reply-To: <20200311221122.GA29568@kaaira-HP-Pavilion-Notebook>

On Thu, 12 Mar 2020 03:41:22 +0530
Kaaira Gupta <kgupta@es.iitr.ac.in> wrote:

> On Wed, Mar 11, 2020 at 09:51:10PM +0100, Julia Lawall wrote:
> > 
> > 
> > On Thu, 12 Mar 2020, Kaaira Gupta wrote:
> >   
> > > Change i's type to unsigned instead of signed. It's always positive.
> > > Reported by coccinelle.
> > >
> > > Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
> > > ---
> > >  drivers/staging/comedi/drivers/ni_mio_common.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
> > > index 06ed4b1dd875..034cf8dafaf0 100644
> > > --- a/drivers/staging/comedi/drivers/ni_mio_common.c
> > > +++ b/drivers/staging/comedi/drivers/ni_mio_common.c
> > > @@ -888,7 +888,7 @@ static void ni_sync_ai_dma(struct comedi_device *dev)
> > >  static int ni_ai_drain_dma(struct comedi_device *dev)
> > >  {
> > >  	struct ni_private *devpriv = dev->private;
> > > -	int i;
> > > +	unsigned int i;  
> > 
> > I'm not sure this is useful.  The value is not going to b lare enough to
> > require an unsigned.  And loop indices often have type int.  
> 
> Sorry, I didn't know that. I'll take care to see the largest value as
> well before making such changes. Thanks!
> 
> Should I resend the patchset by removing this patch or leave it as it
> is?

I think you should remove this patch, in the three cases where you have
that 'const int timeout = 10000' it's never needed to switch to an
unsigned value.

If you were to write that code from scratch, I would recommend that the
"10000" should be a #define, and all that register polling should be
consistent, I don't see any reason behind those differences, and the
udelay(5) feels like an abuse: Documentation/timers/timers-howto.rst is
a quick, nice read.

However, I'm quite sure you don't have that specific hardware to test
any change like that, so it's probably better to leave it alone :)

-- 
Stefano



  reply	other threads:[~2020-03-15 20:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11 18:43 [PATCH 0/5] patchset for clean-ups in comedi Kaaira Gupta
2020-03-11 18:43 ` [PATCH 1/5] staging: comedi: ni_mio_common.c: reformat code Kaaira Gupta
2020-03-11 23:20   ` [Outreachy kernel] " Stefano Brivio
2020-03-12  8:16   ` Greg Kroah-Hartman
2020-03-12 14:56     ` Kaaira Gupta
2020-03-12 15:25       ` Greg Kroah-Hartman
2020-03-11 18:43 ` [PATCH 2/5] staging: comedi: check condition in one statement Kaaira Gupta
2020-03-11 23:17   ` [Outreachy kernel] " Stefano Brivio
2020-03-12  8:17   ` Greg Kroah-Hartman
2020-03-12 14:54     ` Kaaira Gupta
2020-03-11 18:43 ` [PATCH 3/5] staging: comedi: drivers: add line after struct Kaaira Gupta
2020-03-12  8:18   ` Greg Kroah-Hartman
2020-03-12 14:53     ` Kaaira Gupta
2020-03-11 18:43 ` [PATCH 4/5] staging: comedi: add braces to prevent precedence Kaaira Gupta
2020-03-12  8:18   ` Greg Kroah-Hartman
2020-03-12 14:53     ` Kaaira Gupta
2020-03-11 18:43 ` [PATCH 5/5] staging: comedi: drivers: use unsigned int Kaaira Gupta
2020-03-11 20:51   ` [Outreachy kernel] " Julia Lawall
2020-03-11 22:11     ` Kaaira Gupta
2020-03-15 20:23       ` Stefano Brivio [this message]
2020-03-12  8:17   ` Greg Kroah-Hartman
2020-03-12 14:52     ` Kaaira Gupta
2020-03-12 15:21       ` Greg Kroah-Hartman

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=20200315212345.611a20cd@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=abbotti@mev.co.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=hsweeten@visionengravers.com \
    --cc=julia.lawall@inria.fr \
    --cc=kgupta@es.iitr.ac.in \
    --cc=outreachy-kernel@googlegroups.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 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.