diff options
Diffstat (limited to 'include/linux/pinctrl/devinfo.h')
| -rw-r--r-- | include/linux/pinctrl/devinfo.h | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/include/linux/pinctrl/devinfo.h b/include/linux/pinctrl/devinfo.h index d01a8638bb45..bb6653af4f92 100644 --- a/include/linux/pinctrl/devinfo.h +++ b/include/linux/pinctrl/devinfo.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ /* * Per-device information from the pin control system. * This is the stuff that get included into the device @@ -8,18 +9,22 @@ * This interface is used in the core to keep track of pins. * * Author: Linus Walleij <linus.walleij@linaro.org> - * - * License terms: GNU General Public License (GPL) version 2 */ #ifndef PINCTRL_DEVINFO_H #define PINCTRL_DEVINFO_H +struct device; + #ifdef CONFIG_PINCTRL +#include <linux/device.h> + /* The device core acts as a consumer toward pinctrl */ #include <linux/pinctrl/consumer.h> +struct pinctrl; + /** * struct dev_pin_info - pin state container for devices * @p: pinctrl handle for the containing device @@ -41,9 +46,15 @@ struct dev_pin_info { extern int pinctrl_bind_pins(struct device *dev); extern int pinctrl_init_done(struct device *dev); -#else +static inline struct pinctrl *dev_pinctrl(struct device *dev) +{ + if (!dev->pins) + return NULL; -struct device; + return dev->pins->p; +} + +#else /* Stubs if we're not using pinctrl */ @@ -57,5 +68,10 @@ static inline int pinctrl_init_done(struct device *dev) return 0; } +static inline struct pinctrl *dev_pinctrl(struct device *dev) +{ + return NULL; +} + #endif /* CONFIG_PINCTRL */ #endif /* PINCTRL_DEVINFO_H */ |
