From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Kent Gibson <warthog618@gmail.com>,
Viresh Kumar <viresh.kumar@linaro.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [RFC PATCH] gpio: consumer: new virtual driver
Date: Fri, 4 Aug 2023 22:58:19 +0300 [thread overview]
Message-ID: <ZM1YW025tD6S/y+Q@smile.fi.intel.com> (raw)
In-Reply-To: <CAMRc=McEAG7Ezgb=OwMPoRhQzu_A66JMnB=aBSgmdZUvS-ZPhw@mail.gmail.com>
On Fri, Aug 04, 2023 at 06:03:47PM +0200, Bartosz Golaszewski wrote:
> On Thu, Aug 3, 2023 at 1:39 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
...
> > > + if (list_empty(&dev->lookup_list))
> > > + return -ENODATA;
> >
> > Instead you may count nodes here and if 0, return an error, otherwise pass it
> > to the callee.
>
> I'm not following, please rephrase.
The below call calls list_count_nodes(), you may simply join these two checks
by calling list_count_nodes() and return -ENODATA in case it's 0.
> > > + swnode = gpio_consumer_make_device_swnode(dev);
> > > + if (IS_ERR(swnode))
> > > + return PTR_ERR(swnode);
...
> > > + if ((!live && !gpio_consumer_device_is_live_unlocked(dev)) ||
> > > + (live && gpio_consumer_device_is_live_unlocked(dev)))
> >
> > if (live ^ gpio_consumer_device_is_live_unlocked(dev))
> >
> > ?
>
> Nah, let's not use bitwise operators for boolean logic.
Then it's even simpler:
if (live == gpio_consumer_device_is_live_unlocked(dev))
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-08-04 19:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-02 15:28 Bartosz Golaszewski
2023-08-02 22:51 ` Linus Walleij
2023-08-03 11:38 ` Andy Shevchenko
2023-08-04 16:03 ` Bartosz Golaszewski
2023-08-04 19:58 ` Andy Shevchenko [this message]
2023-08-07 19:46 ` Bartosz Golaszewski
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=ZM1YW025tD6S/y+Q@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=brgl@bgdev.pl \
--cc=geert@linux-m68k.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viresh.kumar@linaro.org \
--cc=warthog618@gmail.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
all inboxes | Powered by JetHome®