Commit 426577bd authored by Johan Hovold's avatar Johan Hovold Committed by Linus Walleij

gpio: sysfs: rename gpiochip registration functions

Rename the gpio-chip export/unexport functions to the more descriptive
names gpiochip_sysfs_register and gpiochip_sysfs_unregister.
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Reviewed-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 6a4b6b0a
...@@ -765,13 +765,14 @@ void gpiod_unexport(struct gpio_desc *desc) ...@@ -765,13 +765,14 @@ void gpiod_unexport(struct gpio_desc *desc)
} }
EXPORT_SYMBOL_GPL(gpiod_unexport); EXPORT_SYMBOL_GPL(gpiod_unexport);
int gpiochip_export(struct gpio_chip *chip) int gpiochip_sysfs_register(struct gpio_chip *chip)
{ {
struct device *dev; struct device *dev;
/* Many systems register gpio chips for SOC support very early, /*
* Many systems add gpio chips for SOC support very early,
* before driver model support is available. In those cases we * before driver model support is available. In those cases we
* export this later, in gpiolib_sysfs_init() ... here we just * register later, in gpiolib_sysfs_init() ... here we just
* verify that _some_ field of gpio_class got initialized. * verify that _some_ field of gpio_class got initialized.
*/ */
if (!gpio_class.p) if (!gpio_class.p)
...@@ -791,7 +792,7 @@ int gpiochip_export(struct gpio_chip *chip) ...@@ -791,7 +792,7 @@ int gpiochip_export(struct gpio_chip *chip)
return 0; return 0;
} }
void gpiochip_unexport(struct gpio_chip *chip) void gpiochip_sysfs_unregister(struct gpio_chip *chip)
{ {
struct gpio_desc *desc; struct gpio_desc *desc;
unsigned int i; unsigned int i;
...@@ -836,15 +837,16 @@ static int __init gpiolib_sysfs_init(void) ...@@ -836,15 +837,16 @@ static int __init gpiolib_sysfs_init(void)
continue; continue;
/* /*
* TODO we yield gpio_lock here because gpiochip_export() * TODO we yield gpio_lock here because
* acquires a mutex. This is unsafe and needs to be fixed. * gpiochip_sysfs_register() acquires a mutex. This is unsafe
* and needs to be fixed.
* *
* Also it would be nice to use gpiochip_find() here so we * Also it would be nice to use gpiochip_find() here so we
* can keep gpio_chips local to gpiolib.c, but the yield of * can keep gpio_chips local to gpiolib.c, but the yield of
* gpio_lock prevents us from doing this. * gpio_lock prevents us from doing this.
*/ */
spin_unlock_irqrestore(&gpio_lock, flags); spin_unlock_irqrestore(&gpio_lock, flags);
status = gpiochip_export(chip); status = gpiochip_sysfs_register(chip);
spin_lock_irqsave(&gpio_lock, flags); spin_lock_irqsave(&gpio_lock, flags);
} }
spin_unlock_irqrestore(&gpio_lock, flags); spin_unlock_irqrestore(&gpio_lock, flags);
......
...@@ -285,7 +285,7 @@ int gpiochip_add(struct gpio_chip *chip) ...@@ -285,7 +285,7 @@ int gpiochip_add(struct gpio_chip *chip)
of_gpiochip_add(chip); of_gpiochip_add(chip);
acpi_gpiochip_add(chip); acpi_gpiochip_add(chip);
status = gpiochip_export(chip); status = gpiochip_sysfs_register(chip);
if (status) if (status)
goto err_remove_chip; goto err_remove_chip;
...@@ -330,7 +330,7 @@ void gpiochip_remove(struct gpio_chip *chip) ...@@ -330,7 +330,7 @@ void gpiochip_remove(struct gpio_chip *chip)
unsigned id; unsigned id;
bool requested = false; bool requested = false;
gpiochip_unexport(chip); gpiochip_sysfs_unregister(chip);
gpiochip_irqchip_remove(chip); gpiochip_irqchip_remove(chip);
......
...@@ -151,17 +151,17 @@ static int __maybe_unused gpio_chip_hwgpio(const struct gpio_desc *desc) ...@@ -151,17 +151,17 @@ static int __maybe_unused gpio_chip_hwgpio(const struct gpio_desc *desc)
#ifdef CONFIG_GPIO_SYSFS #ifdef CONFIG_GPIO_SYSFS
int gpiochip_export(struct gpio_chip *chip); int gpiochip_sysfs_register(struct gpio_chip *chip);
void gpiochip_unexport(struct gpio_chip *chip); void gpiochip_sysfs_unregister(struct gpio_chip *chip);
#else #else
static inline int gpiochip_export(struct gpio_chip *chip) static inline int gpiochip_sysfs_register(struct gpio_chip *chip)
{ {
return 0; return 0;
} }
static inline void gpiochip_unexport(struct gpio_chip *chip) static inline void gpiochip_sysfs_unregister(struct gpio_chip *chip)
{ {
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment