Merge tag 'staging-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[linux-2.6-block.git] / drivers / gpio / gpiolib-of.h
CommitLineData
f626d6df
LW
1/* SPDX-License-Identifier: GPL-2.0 */
2
3#ifndef GPIOLIB_OF_H
4#define GPIOLIB_OF_H
5
08a149c4 6#include <linux/err.h>
08a149c4
AS
7#include <linux/types.h>
8
9#include <linux/notifier.h>
10
11struct device;
12
f626d6df 13struct gpio_chip;
08a149c4
AS
14struct gpio_desc;
15struct gpio_device;
f626d6df
LW
16
17#ifdef CONFIG_OF_GPIO
07445ae1 18struct gpio_desc *of_find_gpio(struct device_node *np,
f626d6df
LW
19 const char *con_id,
20 unsigned int idx,
21 unsigned long *lookupflags);
f626d6df
LW
22int of_gpiochip_add(struct gpio_chip *gc);
23void of_gpiochip_remove(struct gpio_chip *gc);
24int of_gpio_get_count(struct device *dev, const char *con_id);
f626d6df 25#else
07445ae1 26static inline struct gpio_desc *of_find_gpio(struct device_node *np,
f626d6df
LW
27 const char *con_id,
28 unsigned int idx,
29 unsigned long *lookupflags)
30{
31 return ERR_PTR(-ENOENT);
32}
f626d6df
LW
33static inline int of_gpiochip_add(struct gpio_chip *gc) { return 0; }
34static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
35static inline int of_gpio_get_count(struct device *dev, const char *con_id)
36{
37 return 0;
38}
f626d6df
LW
39#endif /* CONFIG_OF_GPIO */
40
63636d95
GU
41extern struct notifier_block gpio_of_notifier;
42
f626d6df 43#endif /* GPIOLIB_OF_H */