Re: [RFT PATCH 15/21] arm: omap1: ams-delta: stop using gpiochip_find()
Bartosz Golaszewski <[email protected]> Wed, 4 Oct 2023 13:59:31 +0200
| Newsgroups | dev.linux.lists.timestamp,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-acpi,org.kernel.vger.linux-gpio,org.kernel.vger.linux-kernel,org.kernel.vger.linux-omap,org.kernel.vger.linux-tegra,org.kernel.vger.platform-driver-x86 |
|---|---|
| Message-ID | <CAMRc=MeBKovkC-VbvWNJWk_UjU4FGguEW7gy=L-2saA7kiPijQ@mail.gmail.com> |
On Tue, Sep 5, 2023 at 8:53=E2=80=AFPM Bartosz Golaszewski <[email protected]> = wrote: > > From: Bartosz Golaszewski <[email protected]> > > gpiochip_find() is going away as it's not hot-unplug safe. This platform > is not affected by any of the related problems as this GPIO controller > cannot really go away but in order to finally remove this function, we > need to convert it to using gpio_device_find() as well. > > Signed-off-by: Bartosz Golaszewski <[email protected]> > --- > arch/arm/mach-omap1/board-ams-delta.c | 36 +++++++++++++-------------- > 1 file changed, 17 insertions(+), 19 deletions(-) > > diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/= board-ams-delta.c > index 9808cd27e2cf..a28ea6ac1eba 100644 > --- a/arch/arm/mach-omap1/board-ams-delta.c > +++ b/arch/arm/mach-omap1/board-ams-delta.c > @@ -560,22 +560,6 @@ static struct gpiod_lookup_table *ams_delta_gpio_tab= les[] __initdata =3D { > &ams_delta_nand_gpio_table, > }; > > -/* > - * Some drivers may not use GPIO lookup tables but need to be provided > - * with GPIO numbers. The same applies to GPIO based IRQ lines - some > - * drivers may even not use GPIO layer but expect just IRQ numbers. > - * We could either define GPIO lookup tables then use them on behalf > - * of those devices, or we can use GPIO driver level methods for > - * identification of GPIO and IRQ numbers. For the purpose of the latter= , > - * defina a helper function which identifies GPIO chips by their labels. > - */ > -static int gpiochip_match_by_label(struct gpio_chip *chip, void *data) > -{ > - char *label =3D data; > - > - return !strcmp(label, chip->label); > -} > - > static struct gpiod_hog ams_delta_gpio_hogs[] =3D { > GPIO_HOG(LATCH2_LABEL, LATCH2_PIN_KEYBRD_DATAOUT, "keybrd_dataout= ", > GPIO_ACTIVE_HIGH, GPIOD_OUT_LOW), > @@ -615,14 +599,28 @@ static void __init modem_assign_irq(struct gpio_chi= p *chip) > */ > static void __init omap_gpio_deps_init(void) > { > + struct gpio_device *gdev; > struct gpio_chip *chip; > > - chip =3D gpiochip_find(OMAP_GPIO_LABEL, gpiochip_match_by_label); > - if (!chip) { > - pr_err("%s: OMAP GPIO chip not found\n", __func__); > + /* > + * Some drivers may not use GPIO lookup tables but need to be pro= vided > + * with GPIO numbers. The same applies to GPIO based IRQ lines - = some > + * drivers may even not use GPIO layer but expect just IRQ number= s. > + * We could either define GPIO lookup tables then use them on beh= alf > + * of those devices, or we can use GPIO driver level methods for > + * identification of GPIO and IRQ numbers. > + * > + * This reference will be leaked but that's alright as this devic= e > + * never goes down. > + */ > + gdev =3D gpio_device_find_by_label(OMAP_GPIO_LABEL); > + if (!gdev) { > + pr_err("%s: OMAP GPIO device not found\n", __func__); > return; > } > > + chip =3D gpio_device_get_chip(gdev); > + > /* > * Start with FIQ initialization as it may have to request > * and release successfully each OMAP GPIO pin in turn. > -- > 2.39.2 > Patch applied, thanks! Bart