aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpiolib.h
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2016-02-09 13:21:06 +0100
committerLinus Walleij <linus.walleij@linaro.org>2016-02-11 18:16:54 +0100
commitafbc4f312b5e6e87fcd383eb6764e09f1324c78e (patch)
tree5428e0fe100c576dd158bba68df183010cee2009 /drivers/gpio/gpiolib.h
parentgpio: remember to finally free gpio_device (diff)
downloadlinux-dev-afbc4f312b5e6e87fcd383eb6764e09f1324c78e.tar.xz
linux-dev-afbc4f312b5e6e87fcd383eb6764e09f1324c78e.zip
gpio: move sysfs mock device to the gpio_device
Since gpio_device is the struct that survives if the backing gpio_chip is removed, move the sysfs mock device to this state container so it becomes part of the dangling state of the GPIO device on removal. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpiolib.h')
-rw-r--r--drivers/gpio/gpiolib.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
index 1524ba0ca99d..c5a5b57463c7 100644
--- a/drivers/gpio/gpiolib.h
+++ b/drivers/gpio/gpiolib.h
@@ -27,6 +27,8 @@ struct acpi_device;
* @id: numerical ID number for the GPIO chip
* @dev: the GPIO device struct
* @chrdev: character device for the GPIO device
+ * @mockdev: class device used by the deprecated sysfs interface (may be
+ * NULL)
* @owner: helps prevent removal of modules exporting active GPIOs
* @chip: pointer to the corresponding gpiochip, holding static
* data for this device
@@ -41,6 +43,7 @@ struct gpio_device {
int id;
struct device dev;
struct cdev chrdev;
+ struct device *mockdev;
struct module *owner;
struct gpio_chip *chip;
struct list_head list;
@@ -190,17 +193,17 @@ static int __maybe_unused gpio_chip_hwgpio(const struct gpio_desc *desc)
#ifdef CONFIG_GPIO_SYSFS
-int gpiochip_sysfs_register(struct gpio_chip *chip);
-void gpiochip_sysfs_unregister(struct gpio_chip *chip);
+int gpiochip_sysfs_register(struct gpio_device *gdev);
+void gpiochip_sysfs_unregister(struct gpio_device *gdev);
#else
-static inline int gpiochip_sysfs_register(struct gpio_chip *chip)
+static inline int gpiochip_sysfs_register(struct gpio_device *gdev)
{
return 0;
}
-static inline void gpiochip_sysfs_unregister(struct gpio_chip *chip)
+static inline void gpiochip_sysfs_unregister(struct gpio_device *gdev)
{
}