aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpiolib.c
diff options
context:
space:
mode:
authorAlexandre Courbot <acourbot@nvidia.com>2014-07-22 03:17:42 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-07-23 11:43:24 -0400
commitd74be6dfea1b96cfb4bd79d9254fa9d21ed5f131 (patch)
tree376ed1e1d51a70262f825af17eee4eb56e363666 /drivers/gpio/gpiolib.c
parent1bd6b601fe196b6fbce2c93536ce0f3f53577cec (diff)
gpio: remove gpiod_lock/unlock_as_irq()
gpio_lock/unlock_as_irq() are working with (chip, offset) arguments and are thus not using the old integer namespace. Therefore, there is no reason to have gpiod variants of these functions working with descriptors, especially since the (chip, offset) tuple is more suitable to the users of these functions (GPIO drivers, whereas GPIO descriptors are targeted at GPIO consumers). Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r--drivers/gpio/gpiolib.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 38d176e31379..7582207c92e7 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1428,44 +1428,46 @@ int gpiod_to_irq(const struct gpio_desc *desc)
1428EXPORT_SYMBOL_GPL(gpiod_to_irq); 1428EXPORT_SYMBOL_GPL(gpiod_to_irq);
1429 1429
1430/** 1430/**
1431 * gpiod_lock_as_irq() - lock a GPIO to be used as IRQ 1431 * gpio_lock_as_irq() - lock a GPIO to be used as IRQ
1432 * @gpio: the GPIO line to lock as used for IRQ 1432 * @chip: the chip the GPIO to lock belongs to
1433 * @offset: the offset of the GPIO to lock as IRQ
1433 * 1434 *
1434 * This is used directly by GPIO drivers that want to lock down 1435 * This is used directly by GPIO drivers that want to lock down
1435 * a certain GPIO line to be used for IRQs. 1436 * a certain GPIO line to be used for IRQs.
1436 */ 1437 */
1437int gpiod_lock_as_irq(struct gpio_desc *desc) 1438int gpio_lock_as_irq(struct gpio_chip *chip, unsigned int offset)
1438{ 1439{
1439 if (!desc) 1440 if (offset >= chip->ngpio)
1440 return -EINVAL; 1441 return -EINVAL;
1441 1442
1442 if (test_bit(FLAG_IS_OUT, &desc->flags)) { 1443 if (test_bit(FLAG_IS_OUT, &chip->desc[offset].flags)) {
1443 gpiod_err(desc, 1444 chip_err(chip,
1444 "%s: tried to flag a GPIO set as output for IRQ\n", 1445 "%s: tried to flag a GPIO set as output for IRQ\n",
1445 __func__); 1446 __func__);
1446 return -EIO; 1447 return -EIO;
1447 } 1448 }
1448 1449
1449 set_bit(FLAG_USED_AS_IRQ, &desc->flags); 1450 set_bit(FLAG_USED_AS_IRQ, &chip->desc[offset].flags);
1450 return 0; 1451 return 0;
1451} 1452}
1452EXPORT_SYMBOL_GPL(gpiod_lock_as_irq); 1453EXPORT_SYMBOL_GPL(gpio_lock_as_irq);
1453 1454
1454/** 1455/**
1455 * gpiod_unlock_as_irq() - unlock a GPIO used as IRQ 1456 * gpio_unlock_as_irq() - unlock a GPIO used as IRQ
1456 * @gpio: the GPIO line to unlock from IRQ usage 1457 * @chip: the chip the GPIO to lock belongs to
1458 * @offset: the offset of the GPIO to lock as IRQ
1457 * 1459 *
1458 * This is used directly by GPIO drivers that want to indicate 1460 * This is used directly by GPIO drivers that want to indicate
1459 * that a certain GPIO is no longer used exclusively for IRQ. 1461 * that a certain GPIO is no longer used exclusively for IRQ.
1460 */ 1462 */
1461void gpiod_unlock_as_irq(struct gpio_desc *desc) 1463void gpio_unlock_as_irq(struct gpio_chip *chip, unsigned int offset)
1462{ 1464{
1463 if (!desc) 1465 if (offset >= chip->ngpio)
1464 return; 1466 return;
1465 1467
1466 clear_bit(FLAG_USED_AS_IRQ, &desc->flags); 1468 clear_bit(FLAG_USED_AS_IRQ, &chip->desc[offset].flags);
1467} 1469}
1468EXPORT_SYMBOL_GPL(gpiod_unlock_as_irq); 1470EXPORT_SYMBOL_GPL(gpio_unlock_as_irq);
1469 1471
1470/** 1472/**
1471 * gpiod_get_raw_value_cansleep() - return a gpio's raw value 1473 * gpiod_get_raw_value_cansleep() - return a gpio's raw value