Re: [PATCH v1 3/3] gpiolib: Move gpiodevice_*() to gpiodev namespace

From: Andy Shevchenko
Date: Thu Mar 09 2023 - 13:53:11 EST


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)

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