of/gpio: export of_simple_xlate function
PATCH 1/5 of/gpio: export of_simple_xlate function
So we'll able to use it for the non-memory mapped drivers (like I2C GPIO expanders).
Signed-off-by Anton Vorontsov <[email protected]>
---
Depends on the previous OF GPIO work.
drivers/of/gpio.c | 6 +++--- include/linux/of_gpio.h | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-)
drivers/of/gpio.c +3 -3
@@ -106,9 +106,8 @@ err0: }EXPORT_SYMBOL (of_get_gpio); -static int of_gpio_simple_xlate (struct of_gpio_chip *of_gc, -struct device_node *np, -const void *gpio_spec) +int of_gpio_simple_xlate (struct of_gpio_chip *of_gc,struct device_node *np, +const void *gpio_spec) {const u32 *gpio = gpio_spec;
@@ -117,6 +116,7 @@ static int of_gpio_simple_xlate(struct of_gpio_chip *of_gc,return *gpio; } +EXPORT_SYMBOL (of_gpio_simple_xlate);int of_mm_gpiochip_add (struct device_node *np,struct of_mm_gpio_chip *mm_gc)
include/linux/of_gpio.h +13 -0
@@ -83,6 +83,19 @@ extern int of_get_gpio(struct device_node *np, int index);extern int of_mm_gpiochip_add (struct device_node *np,struct of_mm_gpio_chip *mm_gc); +/** +* of_gpio_simple_xlate - translate gpio_spec to the GPIO number +* @of_gc: pointer to the of_gpio_chip structure +* @np: device node of the GPIO chip +* @gpio_spec: gpio specifier as found in the device tree +* +* This is simple translation function, suitable for the most 1:1 mapped +* gpio chips. This function performs only one sanity check: whether gpio +* is less than ngpios (that is specified in the gpio_chip). +*/ +extern int of_gpio_simple_xlate (struct of_gpio_chip *of_gc, +struct device_node *np, +const void *gpio_spec);#else /* Drivers may not strictly depend on the GPIO support, so let them link. */
Signature · 1 line
1.5.2.2