Skip to contentSkip to conversation

reset: Add non CONFIG_RESET_CONTROLLER routines

PATCH In review Ivan T. Ivanov 2 participants 3 messages Oct 10, 2013 Reset controller framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reset: Add non CONFIG_RESET_CONTROLLER routines

From: "Ivan T. Ivanov" <[email protected]>

Make sure client drivers will still build on systems without reset control support.

Cc Pavel Machek <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Marek Vasut <[email protected]>
---
 include/linux/reset.h |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
include/linux/reset.h +44 -0
index 6082247..0df3e30 100644
@@ -4,6 +4,8 @@
 struct device;
 struct reset_control;
 
+#if defined(CONFIG_RESET_CONTROLLER)
+
 int reset_control_reset(struct reset_control *rstc);
 int reset_control_assert(struct reset_control *rstc);
 int reset_control_deassert(struct reset_control *rstc);
@@ -14,4 +16,46 @@ struct reset_control *devm_reset_control_get(struct device *dev, const char *id)
 
 int device_reset(struct device *dev);
 
+#else /* !CONFIG_RESET_CONTROLLER */
+
+/*
+ * Make sure client drivers will still build on systems without
+ * reset control support.
+ */
+static inline int reset_control_reset(struct reset_control *rstc)
+{
+	return 0;
+}
+
+static inline int reset_control_assert(struct reset_control *rstc)
+{
+	return 0;
+}
+
+static inline int reset_control_deassert(struct reset_control *rstc)
+{
+	return 0;
+}
+
+static inline struct reset_control *
+reset_control_get(struct device *dev, const char *id)
+{
+	return 0;
+}
+
+static inline void reset_control_put(struct reset_control *rstc){}
+
+static inline struct reset_control *
+devm_reset_control_get(struct device *dev, const char *id)
+{
+	return NULL;
+}
+
+static inline int device_reset(struct device *dev)
+{
+	return 0;
+}
+
+#endif
+
 #endif
Signature · 1 line
1.7.9.5
maintainer
#1 lore raw

Hi Ivan,

Am Donnerstag, den 10.10.2013, 12:14 +0300 schrieb Ivan T. Ivanov:

Quoted 4 lines

From: "Ivan T. Ivanov" <[email protected]>

Make sure client drivers will still build on systems without reset control support.

the stubs should at least return errors, but then this turns a compile time error into a runtime error for devices that don't work without being properly reset.

Please also refer to this thread:
http://lists.infradead.org/pipermail/linux-arm-kernel/2013-June/174758.html

regards
Philipp

Quoted 69 lines
Cc Pavel Machek <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Marek Vasut <[email protected]>
---
 include/linux/reset.h |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
include/linux/reset.h +44 -0
index 6082247..0df3e30 100644
@@ -4,6 +4,8 @@
 struct device;
 struct reset_control;
 
+#if defined(CONFIG_RESET_CONTROLLER)
+
 int reset_control_reset(struct reset_control *rstc);
 int reset_control_assert(struct reset_control *rstc);
 int reset_control_deassert(struct reset_control *rstc);
@@ -14,4 +16,46 @@ struct reset_control *devm_reset_control_get(struct device *dev, const char *id)
 
 int device_reset(struct device *dev);
 
+#else /* !CONFIG_RESET_CONTROLLER */
+
+/*
+ * Make sure client drivers will still build on systems without
+ * reset control support.
+ */
+static inline int reset_control_reset(struct reset_control *rstc)
+{
+	return 0;
+}
+
+static inline int reset_control_assert(struct reset_control *rstc)
+{
+	return 0;
+}
+
+static inline int reset_control_deassert(struct reset_control *rstc)
+{
+	return 0;
+}
+
+static inline struct reset_control *
+reset_control_get(struct device *dev, const char *id)
+{
+	return 0;
+}
+
+static inline void reset_control_put(struct reset_control *rstc){}
+
+static inline struct reset_control *
+devm_reset_control_get(struct device *dev, const char *id)
+{
+	return NULL;
+}
+
+static inline int device_reset(struct device *dev)
+{
+	return 0;
+}
+
+#endif
+
 #endif
#2 lore raw

Hi,

Quoted 8 lines · Philipp Zabel

Hi Ivan,

Am Donnerstag, den 10.10.2013, 12:14 +0300 schrieb Ivan T. Ivanov:

Quoted 4 lines

From: "Ivan T. Ivanov" <[email protected]>

Make sure client drivers will still build on systems without reset control support.

Quoted 7 lines

the stubs should at least return errors, but then this turns a compile time error into a runtime error for devices that don't work without being properly reset.

Please also refer to this thread:
http://lists.infradead.org/pipermail/linux-arm-kernel/2013-June/174758.html

I have missed this one. Is there conclusion on the topic? I have followed approach taken by clock and regulator consumer API.

Regards,
Ivan

Quoted 3 lines

regards
Philipp