[PATCH v3 7/9] gpiolib-sysfs: Add gpio name parsing for sysfs export

Markus Pargmann mpa at pengutronix.de
Thu Sep 24 00:23:40 PDT 2015


On Mon, Sep 21, 2015 at 06:09:15PM -0700, Linus Walleij wrote:
> On Fri, Aug 14, 2015 at 7:11 AM, Markus Pargmann <mpa at pengutronix.de> wrote:
> 
> > Signed-off-by: Markus Pargmann <mpa at pengutronix.de>
> 
> This has too terse commit description. I don't understand the patch or
> what it is supposed to do.

Sorry, indeed, this requires a commit description. I would add something
like this:

In '/sys/class/gpio/' GPIOs can be exported by using their GPIO number.
If the exported GPIO has a name, it will show up as a new directory in
'/sys/class/gpio/<GPIO_NAME>'. It is somehow inconsistent to use a
number for exporting and the name for accessing the GPIO.

This patch adds the possibility to use the GPIO name to export it. This
introduces a consistent behaviour for exporting and accessing a GPIO
from userspace.

The mechanism of parsing the GPIO name is a fallback mechanism. This
ensures backwards compatibility of the gpio interface. If the string
passed to '/sys/class/gpio/export' can not be parsed as number, it tries
to match a GPIO name. The same behaviour is implemented for the
'unexport' file.

The implementation uses the previously defined gpio_name_to_desc().



Thanks,

Markus

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150924/591166c9/attachment-0001.sig>


More information about the linux-arm-kernel mailing list