@@ -1169,6 +1169,23 @@ void gpio_device_put(struct gpio_device *gdev)
}
EXPORT_SYMBOL_GPL(gpio_device_put);
+/**
+ * gpio_device_to_device() - Retrieve the address of the underlying struct
+ * device.
+ * @gdev: GPIO device for which to return the address.
+ *
+ * This does not increase the reference count of the GPIO device nor the
+ * underlying struct device.
+ *
+ * Returns:
+ * Address of struct device backing this GPIO device.
+ */
+struct device *gpio_device_to_device(struct gpio_device *gdev)
+{
+ return &gdev->dev;
+}
+EXPORT_SYMBOL_GPL(gpio_device_to_device);
+
#ifdef CONFIG_GPIOLIB_IRQCHIP
/*
@@ -618,6 +618,8 @@ void gpio_device_put(struct gpio_device *gdev);
DEFINE_FREE(gpio_device_put, struct gpio_device *,
if (IS_ERR_OR_NULL(_T)) gpio_device_put(_T));
+struct device *gpio_device_to_device(struct gpio_device *gdev);
+
bool gpiochip_line_is_irq(struct gpio_chip *gc, unsigned int offset);
int gpiochip_reqres_irq(struct gpio_chip *gc, unsigned int offset);
void gpiochip_relres_irq(struct gpio_chip *gc, unsigned int offset);