From: Gabor Juhos Date: Thu, 4 Sep 2008 15:24:57 +0000 (+0000) Subject: 2.6.26: fix gpio sysfs patch, forgot to refresh it X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=98af79bc2b668c9ff71db5b339e42ff9f76c5500;p=librecmc%2Flibrecmc.git 2.6.26: fix gpio sysfs patch, forgot to refresh it SVN-Revision: 12529 --- 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 44d126c4c3..7c69104d91 100644 --- 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 #ifdef CONFIG_DEBUG_FS const char *label; -@@ -151,6 +156,482 @@ +@@ -151,6 +156,486 @@ return ret; } @@ -558,7 +558,7 @@ Signed-off-by: Linus Torvalds + 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; + } @@ -583,8 +583,9 @@ Signed-off-by: Linus Torvalds + struct device *dev; + + dev = device_create(&gpio_class, desc->chip->dev, MKDEV(0, 0), -+ desc, "gpio%d", gpio); ++ "gpio%d", gpio); + if (dev) { ++ dev_set_drvdata(dev, desc); + if (direction_may_change) + status = sysfs_create_group(&dev->kobj, + &gpio_attr_group); @@ -634,8 +635,9 @@ Signed-off-by: Linus Torvalds + 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) { ++ dev_set_drvdata(dev, NULL); + clear_bit(FLAG_EXPORT, &desc->flags); + put_device(dev); + device_unregister(dev); @@ -661,14 +663,15 @@ Signed-off-by: Linus Torvalds + * 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); -+ 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) { ++ dev_set_drvdata(dev, chip); + status = sysfs_create_group(&dev->kobj, + &gpiochip_attr_group); + } else @@ -699,8 +702,9 @@ Signed-off-by: Linus Torvalds + 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) { ++ dev_set_drvdata(dev, NULL); + put_device(dev); + device_unregister(dev); + chip->exported = 0; @@ -764,7 +768,7 @@ Signed-off-by: Linus Torvalds /** * gpiochip_add() - register a gpio_chip * @chip: the chip to register, with chip->base initialized -@@ -160,6 +641,11 @@ +@@ -160,6 +645,11 @@ * 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 * If chip->base is negative, this requests dynamic assignment of * a range of valid GPIOs. */ -@@ -182,7 +668,7 @@ +@@ -182,7 +672,7 @@ base = gpiochip_find_base(chip->ngpio); if (base < 0) { status = base; @@ -785,7 +789,7 @@ Signed-off-by: Linus Torvalds } chip->base = base; } -@@ -197,12 +683,23 @@ +@@ -197,12 +687,23 @@ 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 fail: /* failures here can mean systems won't boot... */ if (status) -@@ -239,6 +736,10 @@ +@@ -239,6 +740,10 @@ } spin_unlock_irqrestore(&gpio_lock, flags); @@ -822,7 +826,7 @@ Signed-off-by: Linus Torvalds return status; } EXPORT_SYMBOL_GPL(gpiochip_remove); -@@ -296,6 +797,8 @@ +@@ -296,6 +801,8 @@ return; } @@ -831,7 +835,7 @@ Signed-off-by: Linus Torvalds spin_lock_irqsave(&gpio_lock, flags); desc = &gpio_desc[gpio]; -@@ -534,10 +1037,6 @@ +@@ -534,10 +1041,6 @@ #ifdef CONFIG_DEBUG_FS @@ -842,7 +846,7 @@ Signed-off-by: Linus Torvalds static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip) { unsigned i; -@@ -614,17 +1113,28 @@ +@@ -614,17 +1117,28 @@ /* REVISIT this isn't locked against gpio_chip removal ... */ for (gpio = 0; gpio_is_valid(gpio); gpio++) {