aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ipq806x/patches-4.14/0066-GPIO-add-named-gpio-exports.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/ipq806x/patches-4.14/0066-GPIO-add-named-gpio-exports.patch')
-rw-r--r--target/linux/ipq806x/patches-4.14/0066-GPIO-add-named-gpio-exports.patch50
1 files changed, 25 insertions, 25 deletions
diff --git a/target/linux/ipq806x/patches-4.14/0066-GPIO-add-named-gpio-exports.patch b/target/linux/ipq806x/patches-4.14/0066-GPIO-add-named-gpio-exports.patch
index 992c240d62..026816d2e8 100644
--- a/target/linux/ipq806x/patches-4.14/0066-GPIO-add-named-gpio-exports.patch
+++ b/target/linux/ipq806x/patches-4.14/0066-GPIO-add-named-gpio-exports.patch
@@ -19,12 +19,12 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
#include <linux/gpio/machine.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
-
+
#include "gpiolib.h"
-
+
@@ -506,3 +508,69 @@ void of_gpiochip_remove(struct gpio_chip
- gpiochip_remove_pin_ranges(chip);
- of_node_put(chip->of_node);
+ gpiochip_remove_pin_ranges(chip);
+ of_node_put(chip->of_node);
}
+
+static struct of_device_id gpio_export_ids[] = {
@@ -101,20 +101,20 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
-int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
+int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name)
{
- struct gpio_chip *chip;
- struct gpio_device *gdev;
+ struct gpio_chip *chip;
+ struct gpio_device *gdev;
@@ -615,6 +615,8 @@ int gpiod_export(struct gpio_desc *desc,
- offset = gpio_chip_hwgpio(desc);
- if (chip->names && chip->names[offset])
- ioname = chip->names[offset];
+ offset = gpio_chip_hwgpio(desc);
+ if (chip->names && chip->names[offset])
+ ioname = chip->names[offset];
+ if (name)
+ ioname = name;
-
- dev = device_create_with_groups(&gpio_class, &gdev->dev,
- MKDEV(0, 0), data, gpio_groups,
+
+ dev = device_create_with_groups(&gpio_class, &gdev->dev,
+ MKDEV(0, 0), data, gpio_groups,
@@ -636,6 +638,12 @@ err_unlock:
- gpiod_dbg(desc, "%s: status %d\n", __func__, status);
- return status;
+ gpiod_dbg(desc, "%s: status %d\n", __func__, status);
+ return status;
}
+EXPORT_SYMBOL_GPL(__gpiod_export);
+
@@ -123,14 +123,14 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ return __gpiod_export(desc, direction_may_change, NULL);
+}
EXPORT_SYMBOL_GPL(gpiod_export);
-
+
static int match_export(struct device *dev, const void *desc)
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -127,6 +127,12 @@ static inline int gpio_export(unsigned g
- return gpiod_export(gpio_to_desc(gpio), direction_may_change);
+ return gpiod_export(gpio_to_desc(gpio), direction_may_change);
}
-
+
+int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name);
+static inline int gpio_export_with_name(unsigned gpio, bool direction_may_change, const char *name)
+{
@@ -138,22 +138,22 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+}
+
static inline int gpio_export_link(struct device *dev, const char *name,
- unsigned gpio)
+ unsigned gpio)
{
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
-@@ -451,6 +451,7 @@ static inline struct gpio_desc *devm_get
-
+@@ -451,6 +451,7 @@ struct gpio_desc *devm_fwnode_get_gpiod_
+
#if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS)
-
+
+int _gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name);
int gpiod_export(struct gpio_desc *desc, bool direction_may_change);
int gpiod_export_link(struct device *dev, const char *name,
- struct gpio_desc *desc);
+ struct gpio_desc *desc);
@@ -458,6 +459,13 @@ void gpiod_unexport(struct gpio_desc *de
-
+
#else /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */
-
+
+static inline int _gpiod_export(struct gpio_desc *desc,
+ bool direction_may_change,
+ const char *name)
@@ -162,5 +162,5 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+}
+
static inline int gpiod_export(struct gpio_desc *desc,
- bool direction_may_change)
+ bool direction_may_change)
{