projects
/
openwrt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add gpio_is_valid(); ifxmips, mmc_gpio was not building correctly
[openwrt.git]
/
target
/
linux
/
generic-2.6
/
patches-2.6.26
/
980-backport_gpio_sysfs_support.patch
diff --git
a/target/linux/generic-2.6/patches-2.6.26/980-backport_gpio_sysfs_support.patch
b/target/linux/generic-2.6/patches-2.6.26/980-backport_gpio_sysfs_support.patch
index
44d126c
..
b62724a
100644
(file)
--- a/
target/linux/generic-2.6/patches-2.6.26/980-backport_gpio_sysfs_support.patch
+++ b/
target/linux/generic-2.6/patches-2.6.26/980-backport_gpio_sysfs_support.patch
@@
-281,7
+281,7
@@
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
#ifdef CONFIG_DEBUG_FS
const char *label;
#ifdef CONFIG_DEBUG_FS
const char *label;
-@@ -151,6 +156,48
2
@@
+@@ -151,6 +156,48
6
@@
return ret;
}
return ret;
}
@@
-558,7
+558,7
@@
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+ int status = -EINVAL;
+
+ /* can't export until sysfs is available ... */
+ int status = -EINVAL;
+
+ /* can't export until sysfs is available ... */
-+ if (!gpio_class.
p
) {
++ if (!gpio_class.
subsys.kobj.ktype
) {
+ pr_debug("%s: called too early!\n", __func__);
+ return -ENOENT;
+ }
+ pr_debug("%s: called too early!\n", __func__);
+ return -ENOENT;
+ }
@@
-583,8
+583,9
@@
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+ struct device *dev;
+
+ dev = device_create(&gpio_class, desc->chip->dev, MKDEV(0, 0),
+ struct device *dev;
+
+ dev = device_create(&gpio_class, desc->chip->dev, MKDEV(0, 0),
-+
desc,
"gpio%d", gpio);
++ "gpio%d", gpio);
+ if (dev) {
+ if (dev) {
++ dev_set_drvdata(dev, desc);
+ if (direction_may_change)
+ status = sysfs_create_group(&dev->kobj,
+ &gpio_attr_group);
+ if (direction_may_change)
+ status = sysfs_create_group(&dev->kobj,
+ &gpio_attr_group);
@@
-634,8
+635,9
@@
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+ if (test_bit(FLAG_EXPORT, &desc->flags)) {
+ struct device *dev = NULL;
+
+ if (test_bit(FLAG_EXPORT, &desc->flags)) {
+ struct device *dev = NULL;
+
-+ dev = class_find_device(&gpio_class,
NULL,
desc, match_export);
++ dev = class_find_device(&gpio_class, desc, match_export);
+ if (dev) {
+ if (dev) {
++ dev_set_drvdata(dev, NULL);
+ clear_bit(FLAG_EXPORT, &desc->flags);
+ put_device(dev);
+ device_unregister(dev);
+ clear_bit(FLAG_EXPORT, &desc->flags);
+ put_device(dev);
+ device_unregister(dev);
@@
-661,14
+663,15
@@
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+ * export this later, in gpiolib_sysfs_init() ... here we just
+ * verify that _some_ field of gpio_class got initialized.
+ */
+ * export this later, in gpiolib_sysfs_init() ... here we just
+ * verify that _some_ field of gpio_class got initialized.
+ */
-+ if (!gpio_class.
p
)
++ if (!gpio_class.
subsys.kobj.ktype
)
+ return 0;
+
+ /* use chip->base for the ID; it's already known to be unique */
+ mutex_lock(&sysfs_lock);
+ return 0;
+
+ /* use chip->base for the ID; it's already known to be unique */
+ mutex_lock(&sysfs_lock);
-+ dev = device_create(&gpio_class, chip->dev, MKDEV(0, 0),
chip,
++ dev = device_create(&gpio_class, chip->dev, MKDEV(0, 0),
+ "gpiochip%d", chip->base);
+ if (dev) {
+ "gpiochip%d", chip->base);
+ if (dev) {
++ dev_set_drvdata(dev, chip);
+ status = sysfs_create_group(&dev->kobj,
+ &gpiochip_attr_group);
+ } else
+ status = sysfs_create_group(&dev->kobj,
+ &gpiochip_attr_group);
+ } else
@@
-699,8
+702,9
@@
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+ struct device *dev;
+
+ mutex_lock(&sysfs_lock);
+ struct device *dev;
+
+ mutex_lock(&sysfs_lock);
-+ dev = class_find_device(&gpio_class,
NULL,
chip, match_export);
++ dev = class_find_device(&gpio_class, chip, match_export);
+ if (dev) {
+ if (dev) {
++ dev_set_drvdata(dev, NULL);
+ put_device(dev);
+ device_unregister(dev);
+ chip->exported = 0;
+ put_device(dev);
+ device_unregister(dev);
+ chip->exported = 0;
@@
-764,7
+768,7
@@
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/**
* gpiochip_add() - register a gpio_chip
* @chip: the chip to register, with chip->base initialized
/**
* gpiochip_add() - register a gpio_chip
* @chip: the chip to register, with chip->base initialized
-@@ -160,6 +64
1
,11 @@
+@@ -160,6 +64
5
,11 @@
* because the chip->base is invalid or already associated with a
* different chip. Otherwise it returns zero as a success code.
*
* because the chip->base is invalid or already associated with a
* different chip. Otherwise it returns zero as a success code.
*
@@
-776,7
+780,7
@@
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* If chip->base is negative, this requests dynamic assignment of
* a range of valid GPIOs.
*/
* If chip->base is negative, this requests dynamic assignment of
* a range of valid GPIOs.
*/
-@@ -182,7 +6
68
,7 @@
+@@ -182,7 +6
72
,7 @@
base = gpiochip_find_base(chip->ngpio);
if (base < 0) {
status = base;
base = gpiochip_find_base(chip->ngpio);
if (base < 0) {
status = base;
@@
-785,7
+789,7
@@
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
}
chip->base = base;
}
}
chip->base = base;
}
-@@ -197,12 +68
3
,23 @@
+@@ -197,12 +68
7
,23 @@
if (status == 0) {
for (id = base; id < base + chip->ngpio; id++) {
gpio_desc[id].chip = chip;
if (status == 0) {
for (id = base; id < base + chip->ngpio; id++) {
gpio_desc[id].chip = chip;
@@
-811,7
+815,7
@@
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fail:
/* failures here can mean systems won't boot... */
if (status)
fail:
/* failures here can mean systems won't boot... */
if (status)
-@@ -239,6 +7
36
,10 @@
+@@ -239,6 +7
40
,10 @@
}
spin_unlock_irqrestore(&gpio_lock, flags);
}
spin_unlock_irqrestore(&gpio_lock, flags);
@@
-822,7
+826,7
@@
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
return status;
}
EXPORT_SYMBOL_GPL(gpiochip_remove);
return status;
}
EXPORT_SYMBOL_GPL(gpiochip_remove);
-@@ -296,6 +
797
,8 @@
+@@ -296,6 +
801
,8 @@
return;
}
return;
}
@@
-831,7
+835,7
@@
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
spin_lock_irqsave(&gpio_lock, flags);
desc = &gpio_desc[gpio];
spin_lock_irqsave(&gpio_lock, flags);
desc = &gpio_desc[gpio];
-@@ -534,10 +10
37
,6 @@
+@@ -534,10 +10
41
,6 @@
#ifdef CONFIG_DEBUG_FS
#ifdef CONFIG_DEBUG_FS
@@
-842,7
+846,7
@@
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip)
{
unsigned i;
static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip)
{
unsigned i;
-@@ -614,17 +111
3
,28 @@
+@@ -614,17 +111
7
,28 @@
/* REVISIT this isn't locked against gpio_chip removal ... */
for (gpio = 0; gpio_is_valid(gpio); gpio++) {
/* REVISIT this isn't locked against gpio_chip removal ... */
for (gpio = 0; gpio_is_valid(gpio); gpio++) {
@@
-974,7
+978,7
@@
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
static inline int gpio_is_valid(int number)
{
static inline int gpio_is_valid(int number)
{
-@@ -137,6 +152,2
0
@@
+@@ -137,6 +152,2
2
@@
gpio_set_value(gpio, value);
}
gpio_set_value(gpio, value);
}
@@
-983,6
+987,8
@@
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+
+#ifndef CONFIG_GPIO_SYSFS
+
+
+#ifndef CONFIG_GPIO_SYSFS
+
++#include <asm/errno.h>
++
+/* sysfs support is only available with gpiolib, where it's optional */
+
+static inline int gpio_export(unsigned gpio, bool direction_may_change)
+/* sysfs support is only available with gpiolib, where it's optional */
+
+static inline int gpio_export(unsigned gpio, bool direction_may_change)
This page took
0.035901 seconds
and
4
git commands to generate.