[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221228164813.67964-2-hhhawa@amazon.com>
Date: Wed, 28 Dec 2022 16:48:12 +0000
From: Hanna Hawa <hhhawa@...zon.com>
To: <andriy.shevchenko@...ux.intel.com>, <wsa@...nel.org>,
<linus.walleij@...aro.org>, <linux-i2c@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-gpio@...r.kernel.org>
CC: <dwmw@...zon.co.uk>, <benh@...zon.com>, <ronenk@...zon.com>,
<talel@...zon.com>, <jonnyc@...zon.com>, <hanochu@...zon.com>,
<farbere@...zon.com>, <itamark@...zon.com>, <hhhawa@...zon.com>
Subject: [PATCH v5 1/2] 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@...zon.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
include/linux/pinctrl/devinfo.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/include/linux/pinctrl/devinfo.h b/include/linux/pinctrl/devinfo.h
index a48ff69acddd..670588bfc7ab 100644
--- a/include/linux/pinctrl/devinfo.h
+++ b/include/linux/pinctrl/devinfo.h
@@ -16,6 +16,8 @@
#ifdef CONFIG_PINCTRL
+#include <linux/device.h>
+
/* The device core acts as a consumer toward pinctrl */
#include <linux/pinctrl/consumer.h>
@@ -40,6 +42,14 @@ struct dev_pin_info {
extern int pinctrl_bind_pins(struct device *dev);
extern int pinctrl_init_done(struct device *dev);
+static inline struct pinctrl *dev_pinctrl(struct device *dev)
+{
+ if (!dev->pins)
+ return NULL;
+
+ return dev->pins->p;
+}
+
#else
struct device;
@@ -56,5 +66,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 */
--
2.38.1
Powered by blists - more mailing lists