gpiolib: Get rid of not used of_node member
Subsystems (3)
Andy Shevchenko
maintainerPATCH v2 1/1 gpiolib: Get rid of not used of_node member
All new drivers should use fwnode and / or parent to provide the necessary information to the GPIO library.
---
v2: resent against latest Linux Next: expected not to fail now
(Linux Next has no more users of of_node member of gpio_chip)
v1: to test for now (using CIs and build bots) what is left uncoverted
(Expected to fail in some configurations!)
drivers/gpio/gpiolib-acpi.c | 10 ------- drivers/gpio/gpiolib-acpi.h | 4 --- drivers/gpio/gpiolib-of.c | 60 ++++++++++++++----------------------- drivers/gpio/gpiolib-of.h | 5 ---- drivers/gpio/gpiolib.c | 15 +--------- include/linux/gpio/driver.h | 7 ----- 6 files changed, 24 insertions(+), 77 deletions(-)
drivers/gpio/gpiolib-acpi.c +0 -10
@@ -1363,16 +1363,6 @@ void acpi_gpiochip_remove(struct gpio_chip *chip)kfree (acpi_gpio); } -void acpi_gpio_dev_init (struct gpio_chip *gc,struct gpio_device *gdev) -{ -/* Set default fwnode to parent's one if present */ -if (gc->parent) -ACPI_COMPANION_SET (&gdev->dev,ACPI_COMPANION (gc->parent)); - -if (gc->fwnode) -device_set_node (&gdev->dev, gc->fwnode); -} -static int acpi_gpio_package_count (const union acpi_object *obj) {const union acpi_object *element = obj->package.elements;
drivers/gpio/gpiolib-acpi.h +0 -4
@@ -50,8 +50,6 @@ struct acpi_gpio_info {void acpi_gpiochip_add (struct gpio_chip *chip);void acpi_gpiochip_remove (struct gpio_chip *chip); -void acpi_gpio_dev_init (struct gpio_chip *gc,struct gpio_device *gdev); -void acpi_gpiochip_request_interrupts (struct gpio_chip *chip);void acpi_gpiochip_free_interrupts (struct gpio_chip *chip);
@@ -74,8 +72,6 @@ int acpi_gpio_count(struct device *dev, const char *con_id);static inline void acpi_gpiochip_add (struct gpio_chip *chip) { }static inline void acpi_gpiochip_remove (struct gpio_chip *chip) { } -static inline void acpi_gpio_dev_init (struct gpio_chip *gc,struct gpio_device *gdev) { } -static inline void acpi_gpiochip_request_interrupts (struct gpio_chip *chip) { }
drivers/gpio/gpiolib-of.c +23 -37
160 lines not on this page · raw message
drivers/gpio/gpiolib-of.h +0 -5
@@ -24,7 +24,6 @@ int of_gpiochip_add(struct gpio_chip *gc);void of_gpiochip_remove (struct gpio_chip *gc);int of_gpio_get_count (struct device *dev,const char *con_id);bool of_gpio_need_valid_mask (const struct gpio_chip *gc); -void of_gpio_dev_init (struct gpio_chip *gc,struct gpio_device *gdev);#else static inline struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id,
@@ -43,10 +42,6 @@ static inline bool of_gpio_need_valid_mask(const struct gpio_chip *gc) {return false; } -static inline void of_gpio_dev_init (struct gpio_chip *gc, -struct gpio_device *gdev) -{ -}#endif /* CONFIG_OF_GPIO */ extern struct notifier_block gpio_of_notifier;
drivers/gpio/gpiolib.c +1 -14
@@ -594,7 +594,6 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,struct lock_class_key *lock_key, struct lock_class_key *request_key) { - struct fwnode_handle *fwnode = NULL; struct gpio_device *gdev;unsigned long flags;int base = gc->base;
@@ -602,11 +601,6 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,int ret =0 ;u32 ngpios; -if (gc->fwnode) - fwnode = gc->fwnode; -else if (gc->parent) - fwnode =dev_fwnode (gc->parent); -/* * First: allocate and populate the internal stat container, and * set up the struct device.
@@ -619,14 +613,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, gdev->chip = gc; gc->gpiodev = gdev; -of_gpio_dev_init (gc, gdev); -acpi_gpio_dev_init (gc, gdev); - -/* -* Assign fwnode depending on the result of the previous calls, -* if none of them succeed, assign it to the parent's one. -*/ - gdev->dev.fwnode =dev_fwnode (&gdev->dev) ?: fwnode; +device_set_node (&gdev->dev, gc->fwnode ?:dev_fwnode (gc->parent)); gdev->id =ida_alloc (&gpio_ida,GFP_KERNEL );if (gdev->id <0 ) {
include/linux/gpio/driver.h +0 -7
@@ -503,13 +503,6 @@ struct gpio_chip {* the device tree automatically may have an OF translation */ -/** -* @of_node: -* -* Pointer to a device tree node representing this GPIO controller. -*/ -struct device_node *of_node; -/** * @of_gpio_n_cells: *
base-commit: 81214a573d19ae2fa5b528286ba23cd1cb17feec
Signature · 1 line
2.35.1
Quoted 6 lines · Andy Shevchenko
All new drivers should use fwnode and / or parent to provide the necessary information to the GPIO library.
Signed-off-by Andy Shevchenko <[email protected]>---
This looks good to me. I'm thinking about just applying it and giving it a spin in next right away.
Linus: any objections?
Bartosz
Andy Shevchenko
maintainerQuoted 5 lines · Bartosz Golaszewski
Quoted 3 lines · Andy Shevchenko
All new drivers should use fwnode and / or parent to provide the necessary information to the GPIO library.
...
Quoted 1 line
This looks good to me.
Thank you!
Quoted 2 lines
I'm thinking about just applying it and giving
it a spin in next right away.
I would like to split it, one patch, btw, had been already sent separately.
So, if you are going for the Linux Next, I would like to ask for rebasing later on.
Also note, it requires patches that are in Linus' W. and mine trees. It will fail if you apply without those to be proceeded first.
Quoted 1 line
Linus: any objections?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 6 lines · Bartosz Golaszewski
Quoted 4 lines · Andy Shevchenko
All new drivers should use fwnode and / or parent to provide the necessary information to the GPIO library.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Andy Shevchenko <[email protected]>---
This looks good to me. I'm thinking about just applying it and giving it a spin in next right away.
Linus: any objections?
No objections, sorry for taking some days to respond.
Separation of concerns is always good :)
Yours,
Linus Walleij