Re: [PATCH 08/23] gpio: remove gpiod_sysfs_set_active_low

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 22, 2015 at 12:42 AM, Johan Hovold <johan@xxxxxxxxxx> wrote:
> Remove gpiod_sysfs_set_active_low (and gpio_sysfs_set_active_low) which
> allowed code to change the polarity of a gpio line even after it had
> been exported through sysfs.
>
> Drivers should not care, and generally does not know, about gpio-line
> polarity which is a hardware feature that needs to be described by
> firmware.
>
> It is currently possible to define gpio-line polarity in device-tree and
> acpi firmware or using platform data. Userspace can also change the
> polarity through sysfs.
>
> Note that drivers using the legacy gpio interface could still use
> GPIOF_ACTIVE_LOW to change the polarity before exporting the gpio.
>
> There are no in-kernel users of this interface.
>
> Cc: Jonathan Corbet <corbet@xxxxxxx>
> Cc: Harry Wei <harryxiyou@xxxxxxxxx>
> Cc: Arnd Bergmann <arnd@xxxxxxxx>
> Cc: linux-doc@xxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxx
> Cc: linux-arch@xxxxxxxxxxxxxxx
> Signed-off-by: Johan Hovold <johan@xxxxxxxxxx>
> ---
>  Documentation/gpio/gpio-legacy.txt |  9 -------
>  Documentation/gpio/sysfs.txt       |  8 -------
>  Documentation/zh_CN/gpio.txt       |  8 -------
>  drivers/gpio/gpiolib-sysfs.c       | 48 ++------------------------------------
>  include/asm-generic/gpio.h         |  5 ----
>  include/linux/gpio.h               |  7 ------
>  include/linux/gpio/consumer.h      |  6 -----
>  7 files changed, 2 insertions(+), 89 deletions(-)
>
> diff --git a/Documentation/gpio/gpio-legacy.txt b/Documentation/gpio/gpio-legacy.txt
> index 6f83fa965b4b..79ab5648d69b 100644
> --- a/Documentation/gpio/gpio-legacy.txt
> +++ b/Documentation/gpio/gpio-legacy.txt
> @@ -751,9 +751,6 @@ requested using gpio_request():
>         int gpio_export_link(struct device *dev, const char *name,
>                 unsigned gpio)
>
> -       /* change the polarity of a GPIO node in sysfs */
> -       int gpio_sysfs_set_active_low(unsigned gpio, int value);
> -
>  After a kernel driver requests a GPIO, it may only be made available in
>  the sysfs interface by gpio_export().  The driver can control whether the
>  signal direction may change.  This helps drivers prevent userspace code
> @@ -767,9 +764,3 @@ After the GPIO has been exported, gpio_export_link() allows creating
>  symlinks from elsewhere in sysfs to the GPIO sysfs node.  Drivers can
>  use this to provide the interface under their own device in sysfs with
>  a descriptive name.
> -
> -Drivers can use gpio_sysfs_set_active_low() to hide GPIO line polarity
> -differences between boards from user space.  This only affects the
> -sysfs interface.  Polarity change can be done both before and after
> -gpio_export(), and previously enabled poll(2) support for either
> -rising or falling edge will be reconfigured to follow this setting.
> diff --git a/Documentation/gpio/sysfs.txt b/Documentation/gpio/sysfs.txt
> index c2c3a97f8ff7..535b6a8a7a7c 100644
> --- a/Documentation/gpio/sysfs.txt
> +++ b/Documentation/gpio/sysfs.txt
> @@ -132,9 +132,6 @@ requested using gpio_request():
>         int gpiod_export_link(struct device *dev, const char *name,
>                       struct gpio_desc *desc);
>
> -       /* change the polarity of a GPIO node in sysfs */
> -       int gpiod_sysfs_set_active_low(struct gpio_desc *desc, int value);
> -
>  After a kernel driver requests a GPIO, it may only be made available in
>  the sysfs interface by gpiod_export(). The driver can control whether the
>  signal direction may change. This helps drivers prevent userspace code
> @@ -148,8 +145,3 @@ After the GPIO has been exported, gpiod_export_link() allows creating
>  symlinks from elsewhere in sysfs to the GPIO sysfs node. Drivers can
>  use this to provide the interface under their own device in sysfs with
>  a descriptive name.
> -
> -Drivers can use gpiod_sysfs_set_active_low() to hide GPIO line polarity
> -differences between boards from user space. Polarity change can be done both
> -before and after gpiod_export(), and previously enabled poll(2) support for
> -either rising or falling edge will be reconfigured to follow this setting.
> diff --git a/Documentation/zh_CN/gpio.txt b/Documentation/zh_CN/gpio.txt
> index d5b8f01833f4..bce972521065 100644
> --- a/Documentation/zh_CN/gpio.txt
> +++ b/Documentation/zh_CN/gpio.txt
> @@ -638,9 +638,6 @@ GPIO 控制器的路径类似 /sys/class/gpio/gpiochip42/ (对于从#42 GPIO
>         int gpio_export_link(struct device *dev, const char *name,
>                 unsigned gpio)
>
> -       /* 改变 sysfs 中的一个 GPIO 节点的极性 */
> -       int gpio_sysfs_set_active_low(unsigned gpio, int value);
> -
>  在一个内核驱动申请一个 GPIO 之后,它可以通过 gpio_export()使其在 sysfs
>  接口中可见。该驱动可以控制信号方向是否可修改。这有助于防止用户空间代码无意间
>  破坏重要的系统状态。
> @@ -651,8 +648,3 @@ GPIO 控制器的路径类似 /sys/class/gpio/gpiochip42/ (对于从#42 GPIO
>  在 GPIO 被导出之后,gpio_export_link()允许在 sysfs 文件系统的任何地方
>  创建一个到这个 GPIO sysfs 节点的符号链接。这样驱动就可以通过一个描述性的
>  名字,在 sysfs 中他们所拥有的设备下提供一个(到这个 GPIO sysfs 节点的)接口。
> -
> -驱动可以使用 gpio_sysfs_set_active_low() 来在用户空间隐藏电路板之间
> -GPIO 线的极性差异。这个仅对 sysfs 接口起作用。极性的改变可以在 gpio_export()
> -前后进行,且之前使能的轮询操作(poll(2))支持(上升或下降沿)将会被重新配置来遵循
> -这个设置。
> diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
> index 31434c5a90ef..8a95a954f514 100644
> --- a/drivers/gpio/gpiolib-sysfs.c
> +++ b/drivers/gpio/gpiolib-sysfs.c
> @@ -293,8 +293,8 @@ static int sysfs_set_active_low(struct gpio_desc *desc, struct device *dev,
>                 clear_bit(FLAG_ACTIVE_LOW, &desc->flags);
>
>         /* reconfigure poll(2) support if enabled on one edge only */
> -       if (dev != NULL && (!!test_bit(FLAG_TRIG_RISE, &desc->flags) ^
> -                               !!test_bit(FLAG_TRIG_FALL, &desc->flags))) {
> +       if (!!test_bit(FLAG_TRIG_RISE, &desc->flags) ^
> +                               !!test_bit(FLAG_TRIG_FALL, &desc->flags)) {

This change seems to be unrelated to this patch...

Otherwise, I agree and good riddance!
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux