2022-12-28 17:04:39

by Hanna Hawa

[permalink] [raw]
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 <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
---
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


2022-12-29 00:33:09

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v5 1/2] pinctrl: Add an API to get the pinctrl pins if initialized

On Wed, Dec 28, 2022 at 5:48 PM Hanna Hawa <[email protected]> wrote:

> 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 <[email protected]>
> Reviewed-by: Andy Shevchenko <[email protected]>

Okay then:
Reviewed-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2023-01-20 09:04:42

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH v5 1/2] pinctrl: Add an API to get the pinctrl pins if initialized

On Wed, Dec 28, 2022 at 04:48:12PM +0000, Hanna Hawa wrote:
> 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 <[email protected]>
> Reviewed-by: Andy Shevchenko <[email protected]>

Applied to for-next, thanks!


Attachments:
(No filename) (403.00 B)
signature.asc (849.00 B)
Download all attachments