treewide: convert gpio-export to platform driver

Without this patch you will get an error "gpio-export probe deferral
not supported" when you try to export i2c expander gpio pins.

gpio-export is probed long before i2c-bus and i2c expander are created
and it doesn't retry it so none pins are exported.

Signed-off-by: René van Dorst <opensource@vdorst.com>
apply the change to all instances of the gpio exports patch
Signed-off-by: Mathias Kresin <dev@kresin.me>
This commit is contained in:
René van Dorst 2018-07-19 12:55:55 +02:00 committed by Mathias Kresin
parent 1d18a14a90
commit 0ae9396556
3 changed files with 12 additions and 21 deletions

View file

@ -22,7 +22,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
#include "gpiolib.h" #include "gpiolib.h"
@@ -506,3 +508,71 @@ void of_gpiochip_remove(struct gpio_chip @@ -506,3 +508,68 @@ void of_gpiochip_remove(struct gpio_chip
gpiochip_remove_pin_ranges(chip); gpiochip_remove_pin_ranges(chip);
of_node_put(chip->of_node); of_node_put(chip->of_node);
} }
@ -32,7 +32,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ { /* sentinel */ } + { /* sentinel */ }
+}; +};
+ +
+static int __init of_gpio_export_probe(struct platform_device *pdev) +static int of_gpio_export_probe(struct platform_device *pdev)
+{ +{
+ struct device_node *np = pdev->dev.of_node; + struct device_node *np = pdev->dev.of_node;
+ struct device_node *cnp; + struct device_node *cnp;
@ -87,13 +87,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ .owner = THIS_MODULE, + .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(gpio_export_ids), + .of_match_table = of_match_ptr(gpio_export_ids),
+ }, + },
+ .probe = of_gpio_export_probe,
+}; +};
+ +
+static int __init of_gpio_export_init(void) +module_platform_driver(gpio_export_driver);
+{
+ return platform_driver_probe(&gpio_export_driver, of_gpio_export_probe);
+}
+device_initcall(of_gpio_export_init);
--- a/drivers/gpio/gpiolib-sysfs.c --- a/drivers/gpio/gpiolib-sysfs.c
+++ b/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c
@@ -553,7 +553,7 @@ static struct class gpio_class = { @@ -553,7 +553,7 @@ static struct class gpio_class = {

View file

@ -22,7 +22,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
#include "gpiolib.h" #include "gpiolib.h"
@@ -506,3 +508,75 @@ void of_gpiochip_remove(struct gpio_chip @@ -506,3 +508,72 @@ void of_gpiochip_remove(struct gpio_chip
gpiochip_remove_pin_ranges(chip); gpiochip_remove_pin_ranges(chip);
of_node_put(chip->of_node); of_node_put(chip->of_node);
} }
@ -34,7 +34,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ { /* sentinel */ } + { /* sentinel */ }
+}; +};
+ +
+static int __init of_gpio_export_probe(struct platform_device *pdev) +static int of_gpio_export_probe(struct platform_device *pdev)
+{ +{
+ struct device_node *np = pdev->dev.of_node; + struct device_node *np = pdev->dev.of_node;
+ struct device_node *cnp; + struct device_node *cnp;
@ -89,13 +89,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ .owner = THIS_MODULE, + .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(gpio_export_ids), + .of_match_table = of_match_ptr(gpio_export_ids),
+ }, + },
+ .probe = of_gpio_export_probe,
+}; +};
+ +
+static int __init of_gpio_export_init(void) +module_platform_driver(gpio_export_driver);
+{
+ return platform_driver_probe(&gpio_export_driver, of_gpio_export_probe);
+}
+device_initcall(of_gpio_export_init);
+ +
+#endif +#endif
--- a/include/asm-generic/gpio.h --- a/include/asm-generic/gpio.h

View file

@ -22,7 +22,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
#include "gpiolib.h" #include "gpiolib.h"
@@ -506,3 +508,71 @@ void of_gpiochip_remove(struct gpio_chip @@ -506,3 +508,68 @@ void of_gpiochip_remove(struct gpio_chip
gpiochip_remove_pin_ranges(chip); gpiochip_remove_pin_ranges(chip);
of_node_put(chip->of_node); of_node_put(chip->of_node);
} }
@ -32,7 +32,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ { /* sentinel */ } + { /* sentinel */ }
+}; +};
+ +
+static int __init of_gpio_export_probe(struct platform_device *pdev) +static int of_gpio_export_probe(struct platform_device *pdev)
+{ +{
+ struct device_node *np = pdev->dev.of_node; + struct device_node *np = pdev->dev.of_node;
+ struct device_node *cnp; + struct device_node *cnp;
@ -87,13 +87,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ .owner = THIS_MODULE, + .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(gpio_export_ids), + .of_match_table = of_match_ptr(gpio_export_ids),
+ }, + },
+ .probe = of_gpio_export_probe,
+}; +};
+ +
+static int __init of_gpio_export_init(void) +module_platform_driver(gpio_export_driver);
+{
+ return platform_driver_probe(&gpio_export_driver, of_gpio_export_probe);
+}
+device_initcall(of_gpio_export_init);
--- a/drivers/gpio/gpiolib-sysfs.c --- a/drivers/gpio/gpiolib-sysfs.c
+++ b/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c
@@ -553,7 +553,7 @@ static struct class gpio_class = { @@ -553,7 +553,7 @@ static struct class gpio_class = {