Skip to content

Commit 0c42fc9

Browse files
author
Bartosz Golaszewski
committed
arm: omap1: ams-delta: stop using gpiochip_find()
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]> Reviewed-by: Linus Walleij <[email protected]> Acked-by: Janusz Krzysztofik <[email protected]> Acked-by: Tony Lindgren <[email protected]>
1 parent 7691ba0 commit 0c42fc9

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

arch/arm/mach-omap1/board-ams-delta.c

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -560,22 +560,6 @@ static struct gpiod_lookup_table *ams_delta_gpio_tables[] __initdata = {
560560
&ams_delta_nand_gpio_table,
561561
};
562562

563-
/*
564-
* Some drivers may not use GPIO lookup tables but need to be provided
565-
* with GPIO numbers. The same applies to GPIO based IRQ lines - some
566-
* drivers may even not use GPIO layer but expect just IRQ numbers.
567-
* We could either define GPIO lookup tables then use them on behalf
568-
* of those devices, or we can use GPIO driver level methods for
569-
* identification of GPIO and IRQ numbers. For the purpose of the latter,
570-
* defina a helper function which identifies GPIO chips by their labels.
571-
*/
572-
static int gpiochip_match_by_label(struct gpio_chip *chip, void *data)
573-
{
574-
char *label = data;
575-
576-
return !strcmp(label, chip->label);
577-
}
578-
579563
static struct gpiod_hog ams_delta_gpio_hogs[] = {
580564
GPIO_HOG(LATCH2_LABEL, LATCH2_PIN_KEYBRD_DATAOUT, "keybrd_dataout",
581565
GPIO_ACTIVE_HIGH, GPIOD_OUT_LOW),
@@ -615,14 +599,28 @@ static void __init modem_assign_irq(struct gpio_chip *chip)
615599
*/
616600
static void __init omap_gpio_deps_init(void)
617601
{
602+
struct gpio_device *gdev;
618603
struct gpio_chip *chip;
619604

620-
chip = gpiochip_find(OMAP_GPIO_LABEL, gpiochip_match_by_label);
621-
if (!chip) {
622-
pr_err("%s: OMAP GPIO chip not found\n", __func__);
605+
/*
606+
* Some drivers may not use GPIO lookup tables but need to be provided
607+
* with GPIO numbers. The same applies to GPIO based IRQ lines - some
608+
* drivers may even not use GPIO layer but expect just IRQ numbers.
609+
* We could either define GPIO lookup tables then use them on behalf
610+
* of those devices, or we can use GPIO driver level methods for
611+
* identification of GPIO and IRQ numbers.
612+
*
613+
* This reference will be leaked but that's alright as this device
614+
* never goes down.
615+
*/
616+
gdev = gpio_device_find_by_label(OMAP_GPIO_LABEL);
617+
if (!gdev) {
618+
pr_err("%s: OMAP GPIO device not found\n", __func__);
623619
return;
624620
}
625621

622+
chip = gpio_device_get_chip(gdev);
623+
626624
/*
627625
* Start with FIQ initialization as it may have to request
628626
* and release successfully each OMAP GPIO pin in turn.

0 commit comments

Comments
 (0)