mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-24 01:41:39 +00:00
gpio-sysfs: Use gpio descriptor name instead of gpiochip names array
The name is now stored in the gpio descriptor as well, for example to allow to store names from DT. This patch changes the sysfs gpio files to use the gpio descriptor name. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
5f3ca7329b
commit
ddd5404007
1 changed files with 1 additions and 7 deletions
|
@ -550,9 +550,7 @@ int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
|
||||||
struct gpiod_data *data;
|
struct gpiod_data *data;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int status;
|
int status;
|
||||||
const char *ioname = NULL;
|
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
int offset;
|
|
||||||
|
|
||||||
/* can't export until sysfs is available ... */
|
/* can't export until sysfs is available ... */
|
||||||
if (!gpio_class.p) {
|
if (!gpio_class.p) {
|
||||||
|
@ -601,13 +599,9 @@ int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
|
||||||
else
|
else
|
||||||
data->direction_can_change = false;
|
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,
|
dev = device_create_with_groups(&gpio_class, chip->dev,
|
||||||
MKDEV(0, 0), data, gpio_groups,
|
MKDEV(0, 0), data, gpio_groups,
|
||||||
ioname ? ioname : "gpio%u",
|
desc->name ? desc->name : "gpio%u",
|
||||||
desc_to_gpio(desc));
|
desc_to_gpio(desc));
|
||||||
if (IS_ERR(dev)) {
|
if (IS_ERR(dev)) {
|
||||||
status = PTR_ERR(dev);
|
status = PTR_ERR(dev);
|
||||||
|
|
Loading…
Reference in a new issue