aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2009-04-02 19:57:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-02 22:04:51 -0400
commit8a0cecffeb52363a57257bbbbd58f4c4537a75bb (patch)
treeee7f754d49a2f2ad75b72ec59e90e6fa2c0753eb /drivers/gpio
parent926b663ce8215ba448960e1ff6e58b67a2c3b99b (diff)
gpio: gpio_{request,free}() now required (feature removal)
We want to phase out the GPIO "autorequest" mechanism in gpiolib and require all callers to use gpio_request(). - Update feature-removal-schedule - Update the documentation now - Convert the relevant pr_warning() in gpiolib to a WARN() so folk using this mechanism get a noisy stack dump Some drivers and board init code will probably need to change. Implementations not using gpiolib will still be fine; they are already required to implement gpio_{request,free}() stubs. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpiolib.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 83c3fe3a136b..51a8d4103be5 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -69,20 +69,24 @@ static inline void desc_set_label(struct gpio_desc *d, const char *label)
69 * those calls have no teeth) we can't avoid autorequesting. This nag 69 * those calls have no teeth) we can't avoid autorequesting. This nag
70 * message should motivate switching to explicit requests... so should 70 * message should motivate switching to explicit requests... so should
71 * the weaker cleanup after faults, compared to gpio_request(). 71 * the weaker cleanup after faults, compared to gpio_request().
72 *
73 * NOTE: the autorequest mechanism is going away; at this point it's
74 * only "legal" in the sense that (old) code using it won't break yet,
75 * but instead only triggers a WARN() stack dump.
72 */ 76 */
73static int gpio_ensure_requested(struct gpio_desc *desc, unsigned offset) 77static int gpio_ensure_requested(struct gpio_desc *desc, unsigned offset)
74{ 78{
75 if (test_and_set_bit(FLAG_REQUESTED, &desc->flags) == 0) { 79 const struct gpio_chip *chip = desc->chip;
76 struct gpio_chip *chip = desc->chip; 80 const int gpio = chip->base + offset;
77 int gpio = chip->base + offset;
78 81
82 if (WARN(test_and_set_bit(FLAG_REQUESTED, &desc->flags) == 0,
83 "autorequest GPIO-%d\n", gpio)) {
79 if (!try_module_get(chip->owner)) { 84 if (!try_module_get(chip->owner)) {
80 pr_err("GPIO-%d: module can't be gotten \n", gpio); 85 pr_err("GPIO-%d: module can't be gotten \n", gpio);
81 clear_bit(FLAG_REQUESTED, &desc->flags); 86 clear_bit(FLAG_REQUESTED, &desc->flags);
82 /* lose */ 87 /* lose */
83 return -EIO; 88 return -EIO;
84 } 89 }
85 pr_warning("GPIO-%d autorequested\n", gpio);
86 desc_set_label(desc, "[auto]"); 90 desc_set_label(desc, "[auto]");
87 /* caller must chip->request() w/o spinlock */ 91 /* caller must chip->request() w/o spinlock */
88 if (chip->request) 92 if (chip->request)