diff mbox

reset: prepare to deprecate _optional APIs

Message ID 1471357620-21903-1-git-send-email-yamada.masahiro@socionext.com
State New
Headers show

Commit Message

Masahiro Yamada Aug. 16, 2016, 2:26 p.m. UTC
When the reset control sub-system was initially supported, there
were no stubs, so none of reset consumers could be built without
CONFIG_RESET_CONTROLLER defined.  The motivation for this was to
prevent the misconfigured kernel from being generated.

Then, commit b424080a9e08 ("reset: Add optional resets and stubs")
added some APIs with stubs for drivers that want reset controlling,
but are still functional without it.

The initial motivation was lost when commit 5bcd0b7f3c56 ("reset:
Add (devm_)reset_control_get stub functions") added stubs also for
non-optional APIs for the purpose of compilation test coverage.
Since then, the difference between with/without _optional is the
WARN_ON(1) that makes the console log louder when a misconfigured
kernel is running.

As discussed in [1], we did not see the value of the additional
run-time warning for reset_control_get, where every caller checks
the returned error code.

This commit removes WARN_ON(1) to let all drivers migrate to non-
optional reset_control_get variants.  The _optional variants will
be kept as aliases of the non-optional ones in the meantime.

[1] http://marc.info/?t=146927313100001&r=1&w=2

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

---

This commit intends to replace
commit 289363fd99a17d6249ee1373541f1da43cbb22c5
("reset: add WARN_ON(1) to non-optional reset_control_get variants")
in the reset/next branch.


 include/linux/reset.h | 84 ++++++++++++++++++++++-----------------------------
 1 file changed, 36 insertions(+), 48 deletions(-)

-- 
1.9.1
diff mbox

Patch

diff --git a/include/linux/reset.h b/include/linux/reset.h
index 5daff15..39328c7 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -18,51 +18,35 @@  void reset_control_put(struct reset_control *rstc);
 struct reset_control *__devm_reset_control_get(struct device *dev,
 				     const char *id, int index, int shared);
 
-int __must_check device_reset(struct device *dev);
-
-static inline int device_reset_optional(struct device *dev)
-{
-	return device_reset(dev);
-}
+int device_reset(struct device *dev);
 
 #else
 
 static inline int reset_control_reset(struct reset_control *rstc)
 {
-	WARN_ON(1);
 	return 0;
 }
 
 static inline int reset_control_assert(struct reset_control *rstc)
 {
-	WARN_ON(1);
 	return 0;
 }
 
 static inline int reset_control_deassert(struct reset_control *rstc)
 {
-	WARN_ON(1);
 	return 0;
 }
 
 static inline int reset_control_status(struct reset_control *rstc)
 {
-	WARN_ON(1);
 	return 0;
 }
 
 static inline void reset_control_put(struct reset_control *rstc)
 {
-	WARN_ON(1);
 }
 
-static inline int __must_check device_reset(struct device *dev)
-{
-	WARN_ON(1);
-	return -ENOTSUPP;
-}
-
-static inline int device_reset_optional(struct device *dev)
+static inline int device_reset(struct device *dev)
 {
 	return -ENOTSUPP;
 }
@@ -101,9 +85,6 @@  static inline struct reset_control *__devm_reset_control_get(
 static inline struct reset_control *
 __must_check reset_control_get_exclusive(struct device *dev, const char *id)
 {
-#ifndef CONFIG_RESET_CONTROLLER
-	WARN_ON(1);
-#endif
 	return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 0);
 }
 
@@ -135,18 +116,6 @@  static inline struct reset_control *reset_control_get_shared(
 	return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 1);
 }
 
-static inline struct reset_control *reset_control_get_optional_exclusive(
-					struct device *dev, const char *id)
-{
-	return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 0);
-}
-
-static inline struct reset_control *reset_control_get_optional_shared(
-					struct device *dev, const char *id)
-{
-	return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 1);
-}
-
 /**
  * of_reset_control_get_exclusive - Lookup and obtain an exclusive reference
  *                                  to a reset controller.
@@ -249,9 +218,6 @@  static inline struct reset_control *
 __must_check devm_reset_control_get_exclusive(struct device *dev,
 					      const char *id)
 {
-#ifndef CONFIG_RESET_CONTROLLER
-	WARN_ON(1);
-#endif
 	return __devm_reset_control_get(dev, id, 0, 0);
 }
 
@@ -270,18 +236,6 @@  static inline struct reset_control *devm_reset_control_get_shared(
 	return __devm_reset_control_get(dev, id, 0, 1);
 }
 
-static inline struct reset_control *devm_reset_control_get_optional_exclusive(
-					struct device *dev, const char *id)
-{
-	return __devm_reset_control_get(dev, id, 0, 0);
-}
-
-static inline struct reset_control *devm_reset_control_get_optional_shared(
-					struct device *dev, const char *id)
-{
-	return __devm_reset_control_get(dev, id, 0, 1);
-}
-
 /**
  * devm_reset_control_get_exclusive_by_index - resource managed
  *                                             reset_control_get_exclusive()
@@ -319,6 +273,40 @@  devm_reset_control_get_shared_by_index(struct device *dev, int index)
 /*
  * TEMPORARY calls to use during transition:
  *
+ *   _optional variants will be deprecated.
+ */
+static inline int device_reset_optional(struct device *dev)
+{
+	return device_reset(dev);
+}
+
+static inline struct reset_control *reset_control_get_optional_exclusive(
+					struct device *dev, const char *id)
+{
+	return reset_control_get_exclusive(dev, id);
+}
+
+static inline struct reset_control *reset_control_get_optional_shared(
+					struct device *dev, const char *id)
+{
+	return reset_control_get_shared(dev, id);
+}
+
+static inline struct reset_control *devm_reset_control_get_optional_exclusive(
+					struct device *dev, const char *id)
+{
+	return devm_reset_control_get_exclusive(dev, id);
+}
+
+static inline struct reset_control *devm_reset_control_get_optional_shared(
+					struct device *dev, const char *id)
+{
+	return devm_reset_control_get_shared(dev, id);
+}
+
+/*
+ * TEMPORARY calls to use during transition:
+ *
  *   of_reset_control_get() => of_reset_control_get_exclusive()
  *
  * These inline function calls will be removed once all consumers