public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Hanna Hawa <hhhawa@amazon.com>
To: <andriy.shevchenko@linux.intel.com>, <wsa@kernel.org>,
	<linus.walleij@linaro.org>, <linux-i2c@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-gpio@vger.kernel.org>
Cc: <dwmw@amazon.co.uk>, <benh@amazon.com>, <ronenk@amazon.com>,
	<talel@amazon.com>, <jonnyc@amazon.com>, <hanochu@amazon.com>,
	<farbere@amazon.com>, <itamark@amazon.com>, <hhhawa@amazon.com>
Subject: [PATCH v5 1/2] pinctrl: Add an API to get the pinctrl pins if initialized
Date: Wed, 28 Dec 2022 16:48:12 +0000	[thread overview]
Message-ID: <20221228164813.67964-2-hhhawa@amazon.com> (raw)
In-Reply-To: <20221228164813.67964-1-hhhawa@amazon.com>

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>
---
 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


  reply	other threads:[~2022-12-28 16:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-28 16:48 [PATCH v5 0/2] i2c: Set i2c pinctrl recovery info from it's device pinctrl Hanna Hawa
2022-12-28 16:48 ` Hanna Hawa [this message]
2022-12-29  0:25   ` [PATCH v5 1/2] pinctrl: Add an API to get the pinctrl pins if initialized Linus Walleij
2023-01-20  8:52   ` Wolfram Sang
2022-12-28 16:48 ` [PATCH v5 2/2] i2c: Set i2c pinctrl recovery info from it's device pinctrl Hanna Hawa
2023-01-20  8:53   ` Wolfram Sang
2024-04-11 17:08   ` Robert Marko
2024-04-14 10:34     ` Dan Carpenter
2024-04-14 17:47       ` Robert Marko
2024-04-15 13:43         ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221228164813.67964-2-hhhawa@amazon.com \
    --to=hhhawa@amazon.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=benh@amazon.com \
    --cc=dwmw@amazon.co.uk \
    --cc=farbere@amazon.com \
    --cc=hanochu@amazon.com \
    --cc=itamark@amazon.com \
    --cc=jonnyc@amazon.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ronenk@amazon.com \
    --cc=talel@amazon.com \
    --cc=wsa@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox