Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpiolib: Introduce acpi_gpio_dev_init() and call it from core

In the ACPI case we may use the firmware node in the similar way
as it's done for OF case. We may use that fwnode for other purposes
in the future.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

authored by

Andy Shevchenko and committed by
Bartosz Golaszewski
515321ac 1df62542

+12
+7
drivers/gpio/gpiolib-acpi.c
··· 1291 1291 kfree(acpi_gpio); 1292 1292 } 1293 1293 1294 + void acpi_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev) 1295 + { 1296 + /* Set default fwnode to parent's one if present */ 1297 + if (gc->parent) 1298 + ACPI_COMPANION_SET(&gdev->dev, ACPI_COMPANION(gc->parent)); 1299 + } 1300 + 1294 1301 static int acpi_gpio_package_count(const union acpi_object *obj) 1295 1302 { 1296 1303 const union acpi_object *element = obj->package.elements;
+4
drivers/gpio/gpiolib-acpi.h
··· 36 36 void acpi_gpiochip_add(struct gpio_chip *chip); 37 37 void acpi_gpiochip_remove(struct gpio_chip *chip); 38 38 39 + void acpi_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev); 40 + 39 41 void acpi_gpiochip_request_interrupts(struct gpio_chip *chip); 40 42 void acpi_gpiochip_free_interrupts(struct gpio_chip *chip); 41 43 ··· 59 57 #else 60 58 static inline void acpi_gpiochip_add(struct gpio_chip *chip) { } 61 59 static inline void acpi_gpiochip_remove(struct gpio_chip *chip) { } 60 + 61 + static inline void acpi_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev) { } 62 62 63 63 static inline void 64 64 acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { }
+1
drivers/gpio/gpiolib.c
··· 591 591 gc->gpiodev = gdev; 592 592 593 593 of_gpio_dev_init(gc, gdev); 594 + acpi_gpio_dev_init(gc, gdev); 594 595 595 596 /* 596 597 * Assign fwnode depending on the result of the previous calls,