Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: rename gpio_lock_as_irq to gpiochip_lock_as_irq

This function actually operates on a gpio_chip, so its prefix should
reflect that fact for consistency with other functions defined in
gpio/driver.h.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Alexandre Courbot and committed by
Linus Walleij
e3a2e878 ee2a9f7f

+41 -40
+2 -2
Documentation/gpio/driver.txt
··· 158 158 Input GPIOs can be used as IRQ signals. When this happens, a driver is requested 159 159 to mark the GPIO as being used as an IRQ: 160 160 161 - int gpio_lock_as_irq(struct gpio_chip *chip, unsigned int offset) 161 + int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset) 162 162 163 163 This will prevent the use of non-irq related GPIO APIs until the GPIO IRQ lock 164 164 is released: 165 165 166 - void gpio_unlock_as_irq(struct gpio_chip *chip, unsigned int offset) 166 + void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset) 167 167 168 168 When implementing an irqchip inside a GPIO driver, these two functions should 169 169 typically be called in the .startup() and .shutdown() callbacks from the
+2 -2
drivers/gpio/gpio-bcm-kona.c
··· 470 470 { 471 471 struct bcm_kona_gpio *kona_gpio = irq_data_get_irq_chip_data(d); 472 472 473 - if (gpio_lock_as_irq(&kona_gpio->gpio_chip, d->hwirq)) { 473 + if (gpiochip_lock_as_irq(&kona_gpio->gpio_chip, d->hwirq)) { 474 474 dev_err(kona_gpio->gpio_chip.dev, 475 475 "unable to lock HW IRQ %lu for IRQ\n", 476 476 d->hwirq); ··· 483 483 { 484 484 struct bcm_kona_gpio *kona_gpio = irq_data_get_irq_chip_data(d); 485 485 486 - gpio_unlock_as_irq(&kona_gpio->gpio_chip, d->hwirq); 486 + gpiochip_unlock_as_irq(&kona_gpio->gpio_chip, d->hwirq); 487 487 } 488 488 489 489 static struct irq_chip bcm_gpio_irq_chip = {
+2 -2
drivers/gpio/gpio-dwapb.c
··· 194 194 struct dwapb_gpio *gpio = igc->private; 195 195 struct bgpio_chip *bgc = &gpio->ports[0].bgc; 196 196 197 - if (gpio_lock_as_irq(&bgc->gc, irqd_to_hwirq(d))) { 197 + if (gpiochip_lock_as_irq(&bgc->gc, irqd_to_hwirq(d))) { 198 198 dev_err(gpio->dev, "unable to lock HW IRQ %lu for IRQ\n", 199 199 irqd_to_hwirq(d)); 200 200 return -EINVAL; ··· 208 208 struct dwapb_gpio *gpio = igc->private; 209 209 struct bgpio_chip *bgc = &gpio->ports[0].bgc; 210 210 211 - gpio_unlock_as_irq(&bgc->gc, irqd_to_hwirq(d)); 211 + gpiochip_unlock_as_irq(&bgc->gc, irqd_to_hwirq(d)); 212 212 } 213 213 214 214 static int dwapb_irq_set_type(struct irq_data *d, u32 type)
+2 -2
drivers/gpio/gpio-em.c
··· 103 103 { 104 104 struct em_gio_priv *p = irq_data_get_irq_chip_data(d); 105 105 106 - if (gpio_lock_as_irq(&p->gpio_chip, irqd_to_hwirq(d))) { 106 + if (gpiochip_lock_as_irq(&p->gpio_chip, irqd_to_hwirq(d))) { 107 107 dev_err(p->gpio_chip.dev, 108 108 "unable to lock HW IRQ %lu for IRQ\n", 109 109 irqd_to_hwirq(d)); ··· 116 116 { 117 117 struct em_gio_priv *p = irq_data_get_irq_chip_data(d); 118 118 119 - gpio_unlock_as_irq(&p->gpio_chip, irqd_to_hwirq(d)); 119 + gpiochip_unlock_as_irq(&p->gpio_chip, irqd_to_hwirq(d)); 120 120 } 121 121 122 122
+2 -2
drivers/gpio/gpio-mcp23s08.c
··· 444 444 { 445 445 struct mcp23s08 *mcp = irq_data_get_irq_chip_data(data); 446 446 447 - if (gpio_lock_as_irq(&mcp->chip, data->hwirq)) { 447 + if (gpiochip_lock_as_irq(&mcp->chip, data->hwirq)) { 448 448 dev_err(mcp->chip.dev, 449 449 "unable to lock HW IRQ %lu for IRQ usage\n", 450 450 data->hwirq); ··· 458 458 { 459 459 struct mcp23s08 *mcp = irq_data_get_irq_chip_data(data); 460 460 461 - gpio_unlock_as_irq(&mcp->chip, data->hwirq); 461 + gpiochip_unlock_as_irq(&mcp->chip, data->hwirq); 462 462 } 463 463 464 464 static struct irq_chip mcp23s08_irq_chip = {
+1 -1
drivers/gpio/gpio-omap.c
··· 800 800 unsigned offset = GPIO_INDEX(bank, gpio); 801 801 802 802 spin_lock_irqsave(&bank->lock, flags); 803 - gpio_unlock_as_irq(&bank->chip, offset); 803 + gpiochip_unlock_as_irq(&bank->chip, offset); 804 804 bank->irq_usage &= ~(BIT(offset)); 805 805 omap_disable_gpio_module(bank, offset); 806 806 omap_reset_gpio(bank, gpio);
+2 -2
drivers/gpio/gpio-tegra.c
··· 233 233 return -EINVAL; 234 234 } 235 235 236 - ret = gpio_lock_as_irq(&tegra_gpio_chip, gpio); 236 + ret = gpiochip_lock_as_irq(&tegra_gpio_chip, gpio); 237 237 if (ret) { 238 238 dev_err(dev, "unable to lock Tegra GPIO %d as IRQ\n", gpio); 239 239 return ret; ··· 263 263 { 264 264 int gpio = d->hwirq; 265 265 266 - gpio_unlock_as_irq(&tegra_gpio_chip, gpio); 266 + gpiochip_unlock_as_irq(&tegra_gpio_chip, gpio); 267 267 } 268 268 269 269 static void tegra_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
+2 -2
drivers/gpio/gpio-vr41xx.c
··· 138 138 139 139 static unsigned int startup_giuint(struct irq_data *data) 140 140 { 141 - if (gpio_lock_as_irq(&vr41xx_gpio_chip, data->hwirq)) 141 + if (gpiochip_lock_as_irq(&vr41xx_gpio_chip, data->hwirq)) 142 142 dev_err(vr41xx_gpio_chip.dev, 143 143 "unable to lock HW IRQ %lu for IRQ\n", 144 144 data->hwirq); ··· 150 150 static void shutdown_giuint(struct irq_data *data) 151 151 { 152 152 mask_giuint_low(data); 153 - gpio_unlock_as_irq(&vr41xx_gpio_chip, data->hwirq); 153 + gpiochip_unlock_as_irq(&vr41xx_gpio_chip, data->hwirq); 154 154 } 155 155 156 156 static struct irq_chip giuint_low_irq_chip = {
+3 -3
drivers/gpio/gpiolib-acpi.c
··· 153 153 154 154 gpiod_direction_input(desc); 155 155 156 - ret = gpio_lock_as_irq(chip, pin); 156 + ret = gpiochip_lock_as_irq(chip, pin); 157 157 if (ret) { 158 158 dev_err(chip->dev, "Failed to lock GPIO as interrupt\n"); 159 159 goto fail_free_desc; ··· 209 209 fail_free_event: 210 210 kfree(event); 211 211 fail_unlock_irq: 212 - gpio_unlock_as_irq(chip, pin); 212 + gpiochip_unlock_as_irq(chip, pin); 213 213 fail_free_desc: 214 214 gpiochip_free_own_desc(desc); 215 215 ··· 280 280 desc = event->desc; 281 281 if (WARN_ON(IS_ERR(desc))) 282 282 continue; 283 - gpio_unlock_as_irq(chip, event->pin); 283 + gpiochip_unlock_as_irq(chip, event->pin); 284 284 gpiochip_free_own_desc(desc); 285 285 list_del(&event->node); 286 286 kfree(event);
+2 -2
drivers/gpio/gpiolib-sysfs.c
··· 161 161 desc->flags &= ~GPIO_TRIGGER_MASK; 162 162 163 163 if (!gpio_flags) { 164 - gpio_unlock_as_irq(desc->chip, gpio_chip_hwgpio(desc)); 164 + gpiochip_unlock_as_irq(desc->chip, gpio_chip_hwgpio(desc)); 165 165 ret = 0; 166 166 goto free_id; 167 167 } ··· 200 200 if (ret < 0) 201 201 goto free_id; 202 202 203 - ret = gpio_lock_as_irq(desc->chip, gpio_chip_hwgpio(desc)); 203 + ret = gpiochip_lock_as_irq(desc->chip, gpio_chip_hwgpio(desc)); 204 204 if (ret < 0) { 205 205 gpiod_warn(desc, "failed to flag the GPIO for IRQ\n"); 206 206 goto free_id;
+8 -8
drivers/gpio/gpiolib.c
··· 495 495 { 496 496 struct gpio_chip *chip = irq_data_get_irq_chip_data(d); 497 497 498 - if (gpio_lock_as_irq(chip, d->hwirq)) { 498 + if (gpiochip_lock_as_irq(chip, d->hwirq)) { 499 499 chip_err(chip, 500 500 "unable to lock HW IRQ %lu for IRQ\n", 501 501 d->hwirq); ··· 508 508 { 509 509 struct gpio_chip *chip = irq_data_get_irq_chip_data(d); 510 510 511 - gpio_unlock_as_irq(chip, d->hwirq); 511 + gpiochip_unlock_as_irq(chip, d->hwirq); 512 512 } 513 513 514 514 static int gpiochip_to_irq(struct gpio_chip *chip, unsigned offset) ··· 1332 1332 EXPORT_SYMBOL_GPL(gpiod_to_irq); 1333 1333 1334 1334 /** 1335 - * gpio_lock_as_irq() - lock a GPIO to be used as IRQ 1335 + * gpiochip_lock_as_irq() - lock a GPIO to be used as IRQ 1336 1336 * @chip: the chip the GPIO to lock belongs to 1337 1337 * @offset: the offset of the GPIO to lock as IRQ 1338 1338 * 1339 1339 * This is used directly by GPIO drivers that want to lock down 1340 1340 * a certain GPIO line to be used for IRQs. 1341 1341 */ 1342 - int gpio_lock_as_irq(struct gpio_chip *chip, unsigned int offset) 1342 + int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset) 1343 1343 { 1344 1344 if (offset >= chip->ngpio) 1345 1345 return -EINVAL; ··· 1354 1354 set_bit(FLAG_USED_AS_IRQ, &chip->desc[offset].flags); 1355 1355 return 0; 1356 1356 } 1357 - EXPORT_SYMBOL_GPL(gpio_lock_as_irq); 1357 + EXPORT_SYMBOL_GPL(gpiochip_lock_as_irq); 1358 1358 1359 1359 /** 1360 - * gpio_unlock_as_irq() - unlock a GPIO used as IRQ 1360 + * gpiochip_unlock_as_irq() - unlock a GPIO used as IRQ 1361 1361 * @chip: the chip the GPIO to lock belongs to 1362 1362 * @offset: the offset of the GPIO to lock as IRQ 1363 1363 * 1364 1364 * This is used directly by GPIO drivers that want to indicate 1365 1365 * that a certain GPIO is no longer used exclusively for IRQ. 1366 1366 */ 1367 - void gpio_unlock_as_irq(struct gpio_chip *chip, unsigned int offset) 1367 + void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset) 1368 1368 { 1369 1369 if (offset >= chip->ngpio) 1370 1370 return; 1371 1371 1372 1372 clear_bit(FLAG_USED_AS_IRQ, &chip->desc[offset].flags); 1373 1373 } 1374 - EXPORT_SYMBOL_GPL(gpio_unlock_as_irq); 1374 + EXPORT_SYMBOL_GPL(gpiochip_unlock_as_irq); 1375 1375 1376 1376 /** 1377 1377 * gpiod_get_raw_value_cansleep() - return a gpio's raw value
+2 -2
drivers/pinctrl/pinctrl-at91.c
··· 1472 1472 unsigned pin = d->hwirq; 1473 1473 int ret; 1474 1474 1475 - ret = gpio_lock_as_irq(&at91_gpio->chip, pin); 1475 + ret = gpiochip_lock_as_irq(&at91_gpio->chip, pin); 1476 1476 if (ret) { 1477 1477 dev_err(at91_gpio->chip.dev, "unable to lock pind %lu IRQ\n", 1478 1478 d->hwirq); ··· 1488 1488 unsigned pin = d->hwirq; 1489 1489 1490 1490 gpio_irq_mask(d); 1491 - gpio_unlock_as_irq(&at91_gpio->chip, pin); 1491 + gpiochip_unlock_as_irq(&at91_gpio->chip, pin); 1492 1492 } 1493 1493 1494 1494 #ifdef CONFIG_PM
+2 -2
drivers/pinctrl/samsung/pinctrl-exynos.c
··· 180 180 unsigned int con; 181 181 int ret; 182 182 183 - ret = gpio_lock_as_irq(&bank->gpio_chip, irqd->hwirq); 183 + ret = gpiochip_lock_as_irq(&bank->gpio_chip, irqd->hwirq); 184 184 if (ret) { 185 185 dev_err(bank->gpio_chip.dev, "unable to lock pin %s-%lu IRQ\n", 186 186 bank->name, irqd->hwirq); ··· 233 233 234 234 spin_unlock_irqrestore(&bank->slock, flags); 235 235 236 - gpio_unlock_as_irq(&bank->gpio_chip, irqd->hwirq); 236 + gpiochip_unlock_as_irq(&bank->gpio_chip, irqd->hwirq); 237 237 } 238 238 239 239 /*
+3 -3
drivers/pinctrl/sunxi/pinctrl-sunxi.c
··· 553 553 if (!func) 554 554 return -EINVAL; 555 555 556 - ret = gpio_lock_as_irq(pctl->chip, 556 + ret = gpiochip_lock_as_irq(pctl->chip, 557 557 pctl->irq_array[d->hwirq] - pctl->desc->pin_base); 558 558 if (ret) { 559 559 dev_err(pctl->dev, "unable to lock HW IRQ %lu for IRQ\n", ··· 571 571 { 572 572 struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d); 573 573 574 - gpio_unlock_as_irq(pctl->chip, 575 - pctl->irq_array[d->hwirq] - pctl->desc->pin_base); 574 + gpiochip_unlock_as_irq(pctl->chip, 575 + pctl->irq_array[d->hwirq] - pctl->desc->pin_base); 576 576 } 577 577 578 578 static int sunxi_pinctrl_irq_set_type(struct irq_data *d, unsigned int type)
+4 -3
include/linux/gpio.h
··· 216 216 return -EINVAL; 217 217 } 218 218 219 - static inline int gpio_lock_as_irq(struct gpio_chip *chip, unsigned int offset) 219 + static inline int gpiochip_lock_as_irq(struct gpio_chip *chip, 220 + unsigned int offset) 220 221 { 221 222 WARN_ON(1); 222 223 return -EINVAL; 223 224 } 224 225 225 - static inline void gpio_unlock_as_irq(struct gpio_chip *chip, 226 - unsigned int offset) 226 + static inline void gpiochip_unlock_as_irq(struct gpio_chip *chip, 227 + unsigned int offset) 227 228 { 228 229 WARN_ON(1); 229 230 }
+2 -2
include/linux/gpio/driver.h
··· 149 149 int (*match)(struct gpio_chip *chip, void *data)); 150 150 151 151 /* lock/unlock as IRQ */ 152 - int gpio_lock_as_irq(struct gpio_chip *chip, unsigned int offset); 153 - void gpio_unlock_as_irq(struct gpio_chip *chip, unsigned int offset); 152 + int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset); 153 + void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset); 154 154 155 155 struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc); 156 156