[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZeYB-LjF743UDJku@smile.fi.intel.com>
Date: Mon, 4 Mar 2024 19:16:40 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Bartosz Golaszewski <brgl@...ev.pl>
Cc: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
Linus Walleij <linus.walleij@...aro.org>,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/1] gpiolib: Deduplicate cleanup for-loop in
gpiochip_add_data_with_key()
On Mon, Mar 04, 2024 at 04:15:19PM +0100, Bartosz Golaszewski wrote:
> On Thu, Feb 22, 2024 at 2:41 PM Andy Shevchenko
> <andriy.shevchenko@...ux.intel.com> wrote:
> > On Thu, Feb 22, 2024 at 02:40:05PM +0100, Bartosz Golaszewski wrote:
> > > On Thu, Feb 22, 2024 at 2:39 PM Andy Shevchenko
> > > <andriy.shevchenko@...ux.intel.com> wrote:
> > > > On Thu, Feb 22, 2024 at 02:30:03PM +0100, Bartosz Golaszewski wrote:
> > > > > On Thu, Feb 22, 2024 at 2:28 PM Andy Shevchenko
> > > > > <andriy.shevchenko@...ux.intel.com> wrote:
> > > > > > On Thu, Feb 22, 2024 at 10:48:00AM +0100, Bartosz Golaszewski wrote:
> > > > > > > On Wed, Feb 21, 2024 at 8:36 PM Andy Shevchenko
> > > > > > > <andriy.shevchenko@...ux.intel.com> wrote:
..
> > > > > > > > + while (desc_index--)
> > > > > > >
> > > > > > > What about gdev->descs[0]?
> > > > > >
> > > > > > What about it? :-)
> > > > > >
> > > > > > for (i = i - 1; i >= 0; i--)
> > > > > > while (--i >= 0)
> > > > > > while (i--)
> > > > > >
> > > > > > are all equivalents.
> > > > > >
> > > > > > The difference is what the value will i get _after_ the loop.
> > > > >
> > > > > Ugh of course. But the first one is more readable given I got tricked
> > > > > by variant #3 at a quick glance but the for loop says out loud what it
> > > > > does.
> > > >
> > > > I disagree. `while (i--)` is very well known cleanup pattern.
> > > > Less letters to parse, easier to understand.
> > >
> > > Whatever, I don't have a strong opinion, just rebase it and resend.
> >
> > Sure (just will wait to the fix to be settled down first), thanks for review!
>
> I realized you haven't resent it after all, do you still want to change this?
Yes. U can prepare a new version later today.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists