Re: [PATCH v1 3/3] gpiolib: Move gpiodevice_*() to gpiodev namespace
From: Bartosz Golaszewski
Date: Fri Mar 10 2023 - 11:52:22 EST
On Thu, Mar 9, 2023 at 7:52 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> On Wed, Mar 08, 2023 at 11:49:53AM +0100, Bartosz Golaszewski wrote:
> > On Tue, Mar 7, 2023 at 7:25 PM Andy Shevchenko
> > <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> > >
> > > The functions that operates on the same device object would
> > > have the same namespace for better code understanding and
> > > maintenance.
>
> ...
>
> > > -static void gpiodevice_release(struct device *dev)
> > > +static void gpiodev_release(struct device *dev)
> > > {
> > > struct gpio_device *gdev = to_gpio_device(dev);
> > > unsigned long flags;
> > > @@ -617,7 +617,7 @@ static int gpiochip_setup_dev(struct gpio_device *gdev)
> > > return ret;
> > >
> > > /* From this point, the .release() function cleans up gpio_device */
> > > - gdev->dev.release = gpiodevice_release;
> > > + gdev->dev.release = gpiodev_release;
> > >
> > > ret = gpiochip_sysfs_register(gdev);
> > > if (ret)
>
> > But the only other function that's in the gpiodev_ namespace operates
> > on struct gpio_device so that change doesn't make much sense to me.
>
> I'm not sure I understood the comment.
> After this change we will have
>
> static int gpiodev_add_to_list(struct gpio_device *gdev)
> static void gpiodev_release(struct device *dev)
>
Do you want to use the same prefix for both because struct device in
the latter is embedded in struct gpio_device in the former?
Bart
> There are also gpio_device_*() I have noticed, so may be these should be
> actually in that namespace?
>
> And we have
>
> static int gpiochip_setup_dev(struct gpio_device *gdev)
> static void gpiolib_dbg_show(struct seq_file *s, struct gpio_device *gdev)
>
> That said, what do you think is the best to make this more consistent?
>
> --
> With Best Regards,
> Andy Shevchenko
>
>