linux/drivers/gpio/gpiolib-of.h
Andy Shevchenko adcad5364a gpio: of: Make of_gpio_get_count() take firmware node as a parameter
Make of_gpio_get_count() take firmware node as a parameter in order
to be aligned with other functions and decouple from unused device
pointer. The latter helps to create a common fwnode_gpio_count()
in the future.

While at it, rename to be of_gpio_count() to be aligned with the others.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-03-01 09:07:21 +01:00

46 lines
1.1 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef GPIOLIB_OF_H
#define GPIOLIB_OF_H
#include <linux/err.h>
#include <linux/types.h>
#include <linux/notifier.h>
struct device;
struct fwnode_handle;
struct gpio_chip;
struct gpio_desc;
struct gpio_device;
#ifdef CONFIG_OF_GPIO
struct gpio_desc *of_find_gpio(struct device_node *np,
const char *con_id,
unsigned int idx,
unsigned long *lookupflags);
int of_gpiochip_add(struct gpio_chip *gc);
void of_gpiochip_remove(struct gpio_chip *gc);
int of_gpio_count(const struct fwnode_handle *fwnode, const char *con_id);
#else
static inline struct gpio_desc *of_find_gpio(struct device_node *np,
const char *con_id,
unsigned int idx,
unsigned long *lookupflags)
{
return ERR_PTR(-ENOENT);
}
static inline int of_gpiochip_add(struct gpio_chip *gc) { return 0; }
static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
static inline int of_gpio_count(const struct fwnode_handle *fwnode,
const char *con_id)
{
return 0;
}
#endif /* CONFIG_OF_GPIO */
extern struct notifier_block gpio_of_notifier;
#endif /* GPIOLIB_OF_H */