diff options
Diffstat (limited to 'drivers/gpio/gpiolib-sysfs.c')
-rw-r--r-- | drivers/gpio/gpiolib-sysfs.c | 48 |
1 files changed, 2 insertions, 46 deletions
diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c index aeb73ef2955e..9dcd346a20fb 100644 --- a/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c | |||
@@ -308,8 +308,8 @@ static int sysfs_set_active_low(struct gpio_desc *desc, struct device *dev, | |||
308 | clear_bit(FLAG_ACTIVE_LOW, &desc->flags); | 308 | clear_bit(FLAG_ACTIVE_LOW, &desc->flags); |
309 | 309 | ||
310 | /* reconfigure poll(2) support if enabled on one edge only */ | 310 | /* reconfigure poll(2) support if enabled on one edge only */ |
311 | if (dev != NULL && (!!test_bit(FLAG_TRIG_RISE, &desc->flags) ^ | 311 | if (!!test_bit(FLAG_TRIG_RISE, &desc->flags) ^ |
312 | !!test_bit(FLAG_TRIG_FALL, &desc->flags))) { | 312 | !!test_bit(FLAG_TRIG_FALL, &desc->flags)) { |
313 | unsigned long trigger_flags = desc->flags & GPIO_TRIGGER_MASK; | 313 | unsigned long trigger_flags = desc->flags & GPIO_TRIGGER_MASK; |
314 | 314 | ||
315 | gpio_setup_irq(desc, dev, 0); | 315 | gpio_setup_irq(desc, dev, 0); |
@@ -681,50 +681,6 @@ int gpiod_export_link(struct device *dev, const char *name, | |||
681 | EXPORT_SYMBOL_GPL(gpiod_export_link); | 681 | EXPORT_SYMBOL_GPL(gpiod_export_link); |
682 | 682 | ||
683 | /** | 683 | /** |
684 | * gpiod_sysfs_set_active_low - set the polarity of gpio sysfs value | ||
685 | * @gpio: gpio to change | ||
686 | * @value: non-zero to use active low, i.e. inverted values | ||
687 | * | ||
688 | * Set the polarity of /sys/class/gpio/gpioN/value sysfs attribute. | ||
689 | * The GPIO does not have to be exported yet. If poll(2) support has | ||
690 | * been enabled for either rising or falling edge, it will be | ||
691 | * reconfigured to follow the new polarity. | ||
692 | * | ||
693 | * Returns zero on success, else an error. | ||
694 | */ | ||
695 | int gpiod_sysfs_set_active_low(struct gpio_desc *desc, int value) | ||
696 | { | ||
697 | struct device *dev = NULL; | ||
698 | int status = -EINVAL; | ||
699 | |||
700 | if (!desc) { | ||
701 | pr_warn("%s: invalid GPIO\n", __func__); | ||
702 | return -EINVAL; | ||
703 | } | ||
704 | |||
705 | mutex_lock(&sysfs_lock); | ||
706 | |||
707 | if (test_bit(FLAG_EXPORT, &desc->flags)) { | ||
708 | dev = class_find_device(&gpio_class, NULL, desc, match_export); | ||
709 | if (dev == NULL) { | ||
710 | status = -ENODEV; | ||
711 | goto unlock; | ||
712 | } | ||
713 | } | ||
714 | |||
715 | status = sysfs_set_active_low(desc, dev, value); | ||
716 | put_device(dev); | ||
717 | unlock: | ||
718 | mutex_unlock(&sysfs_lock); | ||
719 | |||
720 | if (status) | ||
721 | gpiod_dbg(desc, "%s: status %d\n", __func__, status); | ||
722 | |||
723 | return status; | ||
724 | } | ||
725 | EXPORT_SYMBOL_GPL(gpiod_sysfs_set_active_low); | ||
726 | |||
727 | /** | ||
728 | * gpiod_unexport - reverse effect of gpio_export() | 684 | * gpiod_unexport - reverse effect of gpio_export() |
729 | * @gpio: gpio to make unavailable | 685 | * @gpio: gpio to make unavailable |
730 | * | 686 | * |