[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=McgNoz-umhkJKZ-juWukgToEhPh3iex7G-QikmSTgDdnw@mail.gmail.com>
Date: Mon, 2 Oct 2023 09:36:16 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Duje Mihanović <duje.mihanovic@...le.hr>,
Daniel Mack <daniel@...que.org>,
Haojian Zhuang <haojian.zhuang@...il.com>,
Robert Jarzmik <robert.jarzmik@...e.fr>,
Russell King <linux@...linux.org.uk>,
Alan Stern <stern@...land.harvard.edu>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Linus Walleij <linus.walleij@...aro.org>,
Andy Shevchenko <andy@...nel.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Mark Brown <broonie@...nel.org>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-usb@...r.kernel.org, linux-gpio@...r.kernel.org,
linux-input@...r.kernel.org, linux-spi@...r.kernel.org
Subject: Re: [PATCH RFC v4 2/6] ARM: pxa: Convert Spitz LEDs to GPIO descriptors
On Sun, Oct 1, 2023 at 4:35 PM Andy Shevchenko
<andy.shevchenko@...il.com> wrote:
>
> On Sun, Oct 1, 2023 at 5:13 PM Duje Mihanović <duje.mihanovic@...le.hr> wrote:
> >
> > Sharp's Spitz board still uses the legacy GPIO interface for configuring
> > its two onboard LEDs.
> >
> > Convert them to use the GPIO descriptor interface.
>
> ...
>
> > static void __init spitz_leds_init(void)
> > {
> > + gpiod_add_lookup_table(&spitz_led_gpio_table);
> > platform_device_register(&spitz_led_device);
> > + spitz_gpio_leds[0].gpiod = gpiod_get_index(&spitz_led_device.dev,
> > + NULL, 0, GPIOD_ASIS);
> > + spitz_gpio_leds[1].gpiod = gpiod_get_index(&spitz_led_device.dev,
> > + NULL, 1, GPIOD_ASIS);
> > }
>
> What's the point of keeping a lookup table after we got descriptors out of it?
>
Normally the descriptors would be retrieved in drivers and so lookup
tables should stay in memory forever as static resources (just like
device-tree). We have recently added some "temporary" lookup tables to
address even worse hacks. The tables would be removed immediately
after the descriptor is retrieved simply because we used that hack in
drivers which may be unbound and re-bound resulting in adding
repeating lookup entries.
Here we're dealing with a board-file so a more classic approach of
having static lookup tables added once and never removed is in order.
So I'd leave it like this.
Bart
Powered by blists - more mailing lists