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>, Alex Elder <elder@linaro.org>,
Geert Uytterhoeven <geert+renesas@glider.be>,
"Paul E . McKenney" <paulmck@kernel.org>,
Wolfram Sang <wsa@the-dreams.de>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH v2 08/23] gpio: sysfs: use gpio_device_find() to iterate over existing devices
Date: Mon, 5 Feb 2024 15:58:59 +0200 [thread overview]
Message-ID: <ZcDpo__BIF2Bf8CC@smile.fi.intel.com> (raw)
In-Reply-To: <CAMRc=Me+ETGfgjgQV+SSZenLW5MeNLVSrFKBhs707FDEqEHFJw@mail.gmail.com>
On Mon, Feb 05, 2024 at 02:50:18PM +0100, Bartosz Golaszewski wrote:
> On Mon, Feb 5, 2024 at 2:47 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Mon, Feb 05, 2024 at 02:39:40PM +0100, Bartosz Golaszewski wrote:
> > > On Mon, Feb 5, 2024 at 2:38 PM Andy Shevchenko
> > > <andriy.shevchenko@linux.intel.com> wrote:
> > > > On Mon, Feb 05, 2024 at 02:19:10PM +0100, Bartosz Golaszewski wrote:
> > > > > On Mon, Feb 5, 2024 at 1:36 PM Andy Shevchenko
> > > > > <andriy.shevchenko@linux.intel.com> wrote:
> > > > > > On Mon, Feb 05, 2024 at 10:34:03AM +0100, Bartosz Golaszewski wrote:
...
> > > > > > > +static int gpiofind_sysfs_register(struct gpio_chip *gc, void *data)
> > > > > > > +{
> > > > > > > + struct gpio_device *gdev = gc->gpiodev;
> > > > > > > + int ret;
> > > > > > > +
> > > > > > > + if (gdev->mockdev)
> > > > > > > + return 0;
> > > > > > > +
> > > > > > > + ret = gpiochip_sysfs_register(gdev);
> > > > > > > + if (ret)
> > > > > > > + chip_err(gc, "failed to register the sysfs entry: %d\n", ret);
> > > > > >
> > > > > > > + return 0;
> > > > > >
> > > > > > ???
> > > >
> > > > What the point of function to be int if you effectively ignore this by always
> > > > returning 0?
> > >
> > > Because the signature of the callback expects an int to be returned?
> >
> > But why do you return 0 instead of ret?
> >
>
> Because we don't want to *find* a device really. We just want to
> iterate over all of them and call a callback. Any value other than 0
> will be interpreted as a match. Besides: failure to register one GPIO
> sysfs entry shouldn't maybe cause a failure for all subsequent
> devices?
To me it's not obvious, hence I would like to see a comment before return 0.
> > > > > Not sure what the ... and ??? mean? The commit message should have
> > > > > read "... traverse it from gpiofind_sysfs_register()" I agree but the
> > > > > latter?
> > > >
> > > > I didn't realize this may not be obvious :-(.
> > > >
> > > > > > > +}
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-02-05 13:59 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-05 9:33 [PATCH v2 00/23] gpio: rework locking and object life-time control Bartosz Golaszewski
2024-02-05 9:33 ` [PATCH v2 01/23] gpio: protect the list of GPIO devices with SRCU Bartosz Golaszewski
2024-02-05 9:33 ` [PATCH v2 02/23] gpio: of: assign and read the hog pointer atomically Bartosz Golaszewski
2024-02-05 9:33 ` [PATCH v2 03/23] gpio: remove unused logging helpers Bartosz Golaszewski
2024-02-05 9:33 ` [PATCH v2 04/23] gpio: provide and use gpiod_get_label() Bartosz Golaszewski
2024-02-05 9:34 ` [PATCH v2 05/23] gpio: don't set label from irq helpers Bartosz Golaszewski
2024-02-05 9:34 ` [PATCH v2 06/23] gpio: add SRCU infrastructure to struct gpio_desc Bartosz Golaszewski
2024-02-05 12:16 ` Andy Shevchenko
2024-02-05 13:54 ` Bartosz Golaszewski
2024-02-05 13:57 ` Andy Shevchenko
2024-02-05 14:04 ` Bartosz Golaszewski
2024-02-05 14:06 ` Andy Shevchenko
2024-02-05 14:07 ` Bartosz Golaszewski
2024-02-05 9:34 ` [PATCH v2 07/23] gpio: protect the descriptor label with SRCU Bartosz Golaszewski
2024-02-05 9:34 ` [PATCH v2 08/23] gpio: sysfs: use gpio_device_find() to iterate over existing devices Bartosz Golaszewski
2024-02-05 12:18 ` Andy Shevchenko
2024-02-05 13:19 ` Bartosz Golaszewski
2024-02-05 13:38 ` Andy Shevchenko
2024-02-05 13:39 ` Bartosz Golaszewski
2024-02-05 13:47 ` Andy Shevchenko
2024-02-05 13:50 ` Bartosz Golaszewski
2024-02-05 13:58 ` Andy Shevchenko [this message]
2024-02-05 14:04 ` Bartosz Golaszewski
2024-02-05 9:34 ` [PATCH v2 09/23] gpio: remove gpio_lock Bartosz Golaszewski
2024-02-05 9:34 ` [PATCH v2 10/23] gpio: reinforce desc->flags handling Bartosz Golaszewski
2024-02-05 9:34 ` [PATCH v2 11/23] gpio: remove unneeded code from gpio_device_get_desc() Bartosz Golaszewski
2024-02-05 9:34 ` [PATCH v2 12/23] gpio: sysfs: extend the critical section for unregistering sysfs devices Bartosz Golaszewski
2024-02-05 9:34 ` [PATCH v2 13/23] gpio: sysfs: pass the GPIO device - not chip - to sysfs callbacks Bartosz Golaszewski
2024-02-05 9:34 ` [PATCH v2 14/23] gpio: cdev: replace gpiochip_get_desc() with gpio_device_get_desc() Bartosz Golaszewski
2024-02-05 9:34 ` [PATCH v2 15/23] gpio: cdev: don't access gdev->chip if it's not needed Bartosz Golaszewski
2024-02-05 9:34 ` [PATCH v2 16/23] gpio: don't dereference gdev->chip in gpiochip_setup_dev() Bartosz Golaszewski
2024-02-05 9:34 ` [PATCH v2 17/23] gpio: reduce the functionality of validate_desc() Bartosz Golaszewski
2024-02-05 12:22 ` Andy Shevchenko
2024-02-05 19:22 ` Bartosz Golaszewski
2024-02-06 12:30 ` Andy Shevchenko
2024-02-05 9:34 ` [PATCH v2 18/23] gpio: remove unnecessary checks from gpiod_to_chip() Bartosz Golaszewski
2024-02-05 9:34 ` [PATCH v2 19/23] gpio: add the can_sleep flag to struct gpio_device Bartosz Golaszewski
2024-02-05 9:34 ` [PATCH v2 20/23] gpio: add SRCU infrastructure " Bartosz Golaszewski
2024-02-05 9:34 ` [PATCH v2 21/23] gpio: protect the pointer to gpio_chip in gpio_device with SRCU Bartosz Golaszewski
2024-02-05 12:31 ` Andy Shevchenko
2024-02-05 13:30 ` Bartosz Golaszewski
2024-02-05 19:32 ` Bartosz Golaszewski
2024-02-05 19:36 ` Bartosz Golaszewski
2024-02-06 12:24 ` Andy Shevchenko
2024-02-06 12:57 ` Bartosz Golaszewski
2024-02-06 13:13 ` Andy Shevchenko
2024-02-06 13:23 ` Bartosz Golaszewski
2024-02-06 13:43 ` Andy Shevchenko
2024-02-05 9:34 ` [PATCH v2 22/23] gpio: remove the RW semaphore from the GPIO device Bartosz Golaszewski
2024-02-05 9:34 ` [PATCH v2 23/23] gpio: mark unsafe gpio_chip manipulators as deprecated 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=ZcDpo__BIF2Bf8CC@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=brgl@bgdev.pl \
--cc=elder@linaro.org \
--cc=geert+renesas@glider.be \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=warthog618@gmail.com \
--cc=wsa@the-dreams.de \
/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.