mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] pinctrl: split off consumer API into linux/pinctrl/consumer.h
@ 2024-05-17  5:56 Ahmad Fatoum
  2024-05-17  5:56 ` [PATCH 2/3] pinctrl: rename barebox pinctrl_select_state to pinctrl_get_select Ahmad Fatoum
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2024-05-17  5:56 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Follow-up patches will align the barebox pinctrl consumer API with
Linux'. So it makes sense to have the header called the same as well.
Users of the old pinctrl.h header are unaffected as it will include
the new <linux/pinctrl/consumer.h>.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/linux/pinctrl/consumer.h | 61 ++++++++++++++++++++++++++++++++
 include/pinctrl.h                | 55 +++-------------------------
 2 files changed, 65 insertions(+), 51 deletions(-)
 create mode 100644 include/linux/pinctrl/consumer.h

diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
new file mode 100644
index 000000000000..3028f960deb4
--- /dev/null
+++ b/include/linux/pinctrl/consumer.h
@@ -0,0 +1,61 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef LINUX_PINCTRL_CONSUMER_H
+#define LINUX_PINCTRL_CONSUMER_H
+
+#include <linux/errno.h>
+
+struct device;
+struct device_node;
+
+#ifdef CONFIG_PINCTRL
+int pinctrl_select_state(struct device *dev, const char *state);
+int pinctrl_select_state_default(struct device *dev);
+int of_pinctrl_select_state(struct device_node *np, const char *state);
+int of_pinctrl_select_state_default(struct device_node *np);
+int pinctrl_gpio_direction_input(unsigned pin);
+int pinctrl_gpio_direction_output(unsigned int pin);
+int pinctrl_gpio_get_direction(unsigned pin);
+int pinctrl_single_probe(struct device *dev);
+#else
+static inline int pinctrl_select_state(struct device *dev, const char *state)
+{
+	return -ENODEV;
+}
+
+static inline int pinctrl_select_state_default(struct device *dev)
+{
+	return -ENODEV;
+}
+
+static inline int of_pinctrl_select_state(struct device_node *np, const char *state)
+{
+	return -ENODEV;
+}
+
+static inline int of_pinctrl_select_state_default(struct device_node *np)
+{
+	return -ENODEV;
+}
+
+static inline int pinctrl_gpio_direction_input(unsigned pin)
+{
+	return -ENOTSUPP;
+}
+
+static inline int pinctrl_gpio_direction_output(unsigned int pin)
+{
+	return -ENOTSUPP;
+}
+
+static inline int pinctrl_gpio_get_direction(unsigned pin)
+{
+	return -ENOTSUPP;
+}
+
+static inline int pinctrl_single_probe(struct device *dev)
+{
+	return -ENOSYS;
+}
+#endif
+
+#endif /* LINUX_PINCTRL_CONSUMER_H */
diff --git a/include/pinctrl.h b/include/pinctrl.h
index f0f7c2cc8b3e..4ba7b489345b 100644
--- a/include/pinctrl.h
+++ b/include/pinctrl.h
@@ -2,7 +2,11 @@
 #ifndef PINCTRL_H
 #define PINCTRL_H
 
+#include <linux/types.h>
+#include <linux/pinctrl/consumer.h>
+
 struct pinctrl_device;
+struct device_node;
 
 struct pinctrl_ops {
 	int (*set_state)(struct pinctrl_device *, struct device_node *);
@@ -21,55 +25,4 @@ struct pinctrl_device {
 int pinctrl_register(struct pinctrl_device *pdev);
 void pinctrl_unregister(struct pinctrl_device *pdev);
 
-#ifdef CONFIG_PINCTRL
-int pinctrl_select_state(struct device *dev, const char *state);
-int pinctrl_select_state_default(struct device *dev);
-int of_pinctrl_select_state(struct device_node *np, const char *state);
-int of_pinctrl_select_state_default(struct device_node *np);
-int pinctrl_gpio_direction_input(unsigned pin);
-int pinctrl_gpio_direction_output(unsigned int pin);
-int pinctrl_gpio_get_direction(unsigned pin);
-int pinctrl_single_probe(struct device *dev);
-#else
-static inline int pinctrl_select_state(struct device *dev, const char *state)
-{
-	return -ENODEV;
-}
-
-static inline int pinctrl_select_state_default(struct device *dev)
-{
-	return -ENODEV;
-}
-
-static inline int of_pinctrl_select_state(struct device_node *np, const char *state)
-{
-	return -ENODEV;
-}
-
-static inline int of_pinctrl_select_state_default(struct device_node *np)
-{
-	return -ENODEV;
-}
-
-static inline int pinctrl_gpio_direction_input(unsigned pin)
-{
-	return -ENOTSUPP;
-}
-
-static inline int pinctrl_gpio_direction_output(unsigned int pin)
-{
-	return -ENOTSUPP;
-}
-
-static inline int pinctrl_gpio_get_direction(unsigned pin)
-{
-	return -ENOTSUPP;
-}
-
-static inline int pinctrl_single_probe(struct device *dev)
-{
-	return -ENOSYS;
-}
-#endif
-
 #endif /* PINCTRL_H */
-- 
2.39.2




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-05-21 11:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-17  5:56 [PATCH 1/3] pinctrl: split off consumer API into linux/pinctrl/consumer.h Ahmad Fatoum
2024-05-17  5:56 ` [PATCH 2/3] pinctrl: rename barebox pinctrl_select_state to pinctrl_get_select Ahmad Fatoum
2024-05-17  5:56 ` [PATCH 3/3] pinctrl: implement pinctrl_lookup_state/select_state Ahmad Fatoum
2024-05-21 11:03 ` [PATCH 1/3] pinctrl: split off consumer API into linux/pinctrl/consumer.h Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox