linux/drivers/gpio/gpiolib-of.h
Andrei Lalaev c32f66d174 gpiolib: of: add forward declaration for struct device_node
Commit 08a149c40b ("gpiolib: Clean up headers") added a forward
declaration for struct device.

Later, commit 07445ae1c2 ("gpiolib: of: change of_find_gpio() to
accept device node") changed the function signature to accept a struct
device_node instead of a struct device.

Replace forward declaration of struct device with struct device_node to
match the updated function signature.

Signed-off-by: Andrei Lalaev <andrey.lalaev@gmail.com>
Link: https://lore.kernel.org/r/20250721155737.261990-1-andrey.lalaev@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-07-24 11:53:29 +02:00

51 lines
1.3 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_node;
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);
bool of_gpiochip_instance_match(struct gpio_chip *gc, unsigned int index);
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 bool of_gpiochip_instance_match(struct gpio_chip *gc,
unsigned int index)
{
return false;
}
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 */