aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpiolib.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-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)