summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2015-10-05 13:07:47 +0200
committerLinus Walleij <linus.walleij@linaro.org>2015-10-05 13:07:47 +0200
commit78856ac0dd33036ae08a18b644e9fa40b30ee011 (patch)
tree028b48aa009348c542b2050e9cfa819adf59ff34 /drivers/gpio
parentf32517bf1ae0a2de72b3f27200233bd3ad65bfeb (diff)
downloadop-kernel-dev-78856ac0dd33036ae08a18b644e9fa40b30ee011.zip
op-kernel-dev-78856ac0dd33036ae08a18b644e9fa40b30ee011.tar.gz
Revert "gpio-sysfs: Use gpio descriptor name instead of gpiochip names array"
This reverts commit ddd5404007b8496f20ad2efe1147e102e6226634. We need to preserve only using this naming strategy for names coming from chip->names[], the descripor->name field is for the new interface.
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpiolib-sysfs.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
index 3e81f28..b57ed8e 100644
--- a/drivers/gpio/gpiolib-sysfs.c
+++ b/drivers/gpio/gpiolib-sysfs.c
@@ -550,7 +550,9 @@ int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
struct gpiod_data *data;
unsigned long flags;
int status;
+ const char *ioname = NULL;
struct device *dev;
+ int offset;
/* can't export until sysfs is available ... */
if (!gpio_class.p) {
@@ -599,9 +601,13 @@ int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
else
data->direction_can_change = false;
+ offset = gpio_chip_hwgpio(desc);
+ if (chip->names && chip->names[offset])
+ ioname = chip->names[offset];
+
dev = device_create_with_groups(&gpio_class, chip->dev,
MKDEV(0, 0), data, gpio_groups,
- desc->name ? desc->name : "gpio%u",
+ ioname ? ioname : "gpio%u",
desc_to_gpio(desc));
if (IS_ERR(dev)) {
status = PTR_ERR(dev);
OpenPOWER on IntegriCloud