Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: Add an API to get the pinctrl pins if initialized

Add an API to get the pinctrl pins if it was initialized before driver
probed. This API will be used in I2C core to get the device pinctrl
information for recovery state change.

Signed-off-by: Hanna Hawa <hhhawa@amazon.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>

authored by

Hanna Hawa and committed by
Wolfram Sang
13e80244 5f451bef

+15
+15
include/linux/pinctrl/devinfo.h
··· 18 18 19 19 #ifdef CONFIG_PINCTRL 20 20 21 + #include <linux/device.h> 22 + 21 23 /* The device core acts as a consumer toward pinctrl */ 22 24 #include <linux/pinctrl/consumer.h> 23 25 ··· 46 44 extern int pinctrl_bind_pins(struct device *dev); 47 45 extern int pinctrl_init_done(struct device *dev); 48 46 47 + static inline struct pinctrl *dev_pinctrl(struct device *dev) 48 + { 49 + if (!dev->pins) 50 + return NULL; 51 + 52 + return dev->pins->p; 53 + } 54 + 49 55 #else 50 56 51 57 /* Stubs if we're not using pinctrl */ ··· 66 56 static inline int pinctrl_init_done(struct device *dev) 67 57 { 68 58 return 0; 59 + } 60 + 61 + static inline struct pinctrl *dev_pinctrl(struct device *dev) 62 + { 63 + return NULL; 69 64 } 70 65 71 66 #endif /* CONFIG_PINCTRL */