Revert "gpio-sysfs: Use gpio descriptor name instead of gpiochip names array"

This reverts commit ddd5404007.

We need to preserve only using this naming strategy for names
coming from chip->names[], the descripor->name field is for the
new interface.
This commit is contained in:
Linus Walleij 2015-10-05 13:07:47 +02:00
parent f32517bf1a
commit 78856ac0dd
1 changed files with 7 additions and 1 deletions

View File

@ -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);