linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] reset: make device_reset_optional() really optional
@ 2017-10-28 16:50 Masahiro Yamada
  2017-10-28 16:50 ` [PATCH 2/4] reset: remove remaining WARN_ON() in <linux/reset.h> Masahiro Yamada
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Masahiro Yamada @ 2017-10-28 16:50 UTC (permalink / raw)
  To: Philipp Zabel; +Cc: Masahiro Yamada, linux-kernel

Commit bb475230b8e5 ("reset: make optional functions really optional")
converted *_get_optional* functions, but device_reset_optional() was
left behind.  Convert it in the same way.

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

 drivers/reset/core.c  |  9 +++++----
 include/linux/reset.h | 28 +++++++++++++---------------
 2 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 1d21c6f..da4292e 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -566,17 +566,18 @@ EXPORT_SYMBOL_GPL(__devm_reset_control_get);
  * device_reset - find reset controller associated with the device
  *                and perform reset
  * @dev: device to be reset by the controller
+ * @optional: whether it is optional to reset the device
  *
- * Convenience wrapper for reset_control_get() and reset_control_reset().
+ * Convenience wrapper for __reset_control_get() and reset_control_reset().
  * This is useful for the common case of devices with single, dedicated reset
  * lines.
  */
-int device_reset(struct device *dev)
+int __device_reset(struct device *dev, bool optional)
 {
 	struct reset_control *rstc;
 	int ret;
 
-	rstc = reset_control_get(dev, NULL);
+	rstc = __reset_control_get(dev, NULL, 0, 0, optional);
 	if (IS_ERR(rstc))
 		return PTR_ERR(rstc);
 
@@ -586,7 +587,7 @@ int device_reset(struct device *dev)
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(device_reset);
+EXPORT_SYMBOL_GPL(__device_reset);
 
 /**
  * APIs to manage an array of reset controls.
diff --git a/include/linux/reset.h b/include/linux/reset.h
index 56463f3..c2fe7b6 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -19,22 +19,16 @@ struct reset_control *__reset_control_get(struct device *dev, const char *id,
 					  int index, bool shared,
 					  bool optional);
 void reset_control_put(struct reset_control *rstc);
+int __device_reset(struct device *dev, bool optional);
 struct reset_control *__devm_reset_control_get(struct device *dev,
 				     const char *id, int index, bool shared,
 				     bool optional);
 
-int __must_check device_reset(struct device *dev);
-
 struct reset_control *devm_reset_control_array_get(struct device *dev,
 						   bool shared, bool optional);
 struct reset_control *of_reset_control_array_get(struct device_node *np,
 						 bool shared, bool optional);
 
-static inline int device_reset_optional(struct device *dev)
-{
-	return device_reset(dev);
-}
-
 #else
 
 static inline int reset_control_reset(struct reset_control *rstc)
@@ -61,15 +55,9 @@ static inline void reset_control_put(struct reset_control *rstc)
 {
 }
 
-static inline int __must_check device_reset(struct device *dev)
+static inline int __device_reset(struct device *dev, bool optional)
 {
-	WARN_ON(1);
-	return -ENOTSUPP;
-}
-
-static inline int device_reset_optional(struct device *dev)
-{
-	return -ENOTSUPP;
+	return optional ? 0 : -ENOTSUPP;
 }
 
 static inline struct reset_control *__of_reset_control_get(
@@ -108,6 +96,16 @@ of_reset_control_array_get(struct device_node *np, bool shared, bool optional)
 
 #endif /* CONFIG_RESET_CONTROLLER */
 
+static inline int __must_check device_reset(struct device *dev)
+{
+	return __device_reset(dev, false);
+}
+
+static inline int device_reset_optional(struct device *dev)
+{
+	return __device_reset(dev, true);
+}
+
 /**
  * reset_control_get_exclusive - Lookup and obtain an exclusive reference
  *                               to a reset controller.
-- 
2.7.4

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

* [PATCH 2/4] reset: remove remaining WARN_ON() in <linux/reset.h>
  2017-10-28 16:50 [PATCH 1/4] reset: make device_reset_optional() really optional Masahiro Yamada
@ 2017-10-28 16:50 ` Masahiro Yamada
  2017-10-28 16:50 ` [PATCH 3/4] reset: minimize the number of headers included from <linux/reset.h> Masahiro Yamada
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2017-10-28 16:50 UTC (permalink / raw)
  To: Philipp Zabel; +Cc: Masahiro Yamada, linux-kernel

Commit bb475230b8e5 ("reset: make optional functions really optional")
gave a new meaning to _get_optional variants.

The differentiation by WARN_ON() is not needed any more.  We already
have inconsistency about this; (devm_)reset_control_get_exclusive()
has WARN_ON() check, but of_reset_control_get_exclusive() does not.

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

 include/linux/reset.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/include/linux/reset.h b/include/linux/reset.h
index c2fe7b6..9329664 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -124,9 +124,6 @@ static inline int device_reset_optional(struct device *dev)
 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 __reset_control_get(dev, id, 0, false, false);
 }
 
@@ -272,9 +269,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, false, false);
 }
 
-- 
2.7.4

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

* [PATCH 3/4] reset: minimize the number of headers included from <linux/reset.h>
  2017-10-28 16:50 [PATCH 1/4] reset: make device_reset_optional() really optional Masahiro Yamada
  2017-10-28 16:50 ` [PATCH 2/4] reset: remove remaining WARN_ON() in <linux/reset.h> Masahiro Yamada
@ 2017-10-28 16:50 ` Masahiro Yamada
  2017-10-28 16:50 ` [PATCH 4/4] reset: remove reset_control_get(_optional) Masahiro Yamada
  2017-10-30 15:23 ` [PATCH 1/4] reset: make device_reset_optional() really optional Philipp Zabel
  3 siblings, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2017-10-28 16:50 UTC (permalink / raw)
  To: Philipp Zabel; +Cc: Masahiro Yamada, linux-kernel

Commit 62e24c5775ec ("reset: add exported __reset_control_get, return
NULL if optional") moved the dev->of_node reference to core.c, so
<linux/reset.h> does not need to know the members of struct device.
Declaring device and device_node as structure is enough.

<linux/types.h> is necessary for bool, true, and false.

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

 include/linux/reset.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/linux/reset.h b/include/linux/reset.h
index 9329664..53e5e78 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -1,8 +1,10 @@
 #ifndef _LINUX_RESET_H_
 #define _LINUX_RESET_H_
 
-#include <linux/device.h>
+#include <linux/types.h>
 
+struct device;
+struct device_node;
 struct reset_control;
 
 #ifdef CONFIG_RESET_CONTROLLER
-- 
2.7.4

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

* [PATCH 4/4] reset: remove reset_control_get(_optional)
  2017-10-28 16:50 [PATCH 1/4] reset: make device_reset_optional() really optional Masahiro Yamada
  2017-10-28 16:50 ` [PATCH 2/4] reset: remove remaining WARN_ON() in <linux/reset.h> Masahiro Yamada
  2017-10-28 16:50 ` [PATCH 3/4] reset: minimize the number of headers included from <linux/reset.h> Masahiro Yamada
@ 2017-10-28 16:50 ` Masahiro Yamada
  2017-10-30 15:23 ` [PATCH 1/4] reset: make device_reset_optional() really optional Philipp Zabel
  3 siblings, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2017-10-28 16:50 UTC (permalink / raw)
  To: Philipp Zabel; +Cc: Masahiro Yamada, linux-kernel

No more users of these two.

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

 include/linux/reset.h | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/include/linux/reset.h b/include/linux/reset.h
index 53e5e78..0aa3d0d 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -343,18 +343,6 @@ devm_reset_control_get_shared_by_index(struct device *dev, int index)
  * These inline function calls will be removed once all consumers
  * have been moved over to the new explicit API.
  */
-static inline struct reset_control *reset_control_get(
-				struct device *dev, const char *id)
-{
-	return reset_control_get_exclusive(dev, id);
-}
-
-static inline struct reset_control *reset_control_get_optional(
-					struct device *dev, const char *id)
-{
-	return reset_control_get_optional_exclusive(dev, id);
-}
-
 static inline struct reset_control *of_reset_control_get(
 				struct device_node *node, const char *id)
 {
-- 
2.7.4

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

* Re: [PATCH 1/4] reset: make device_reset_optional() really optional
  2017-10-28 16:50 [PATCH 1/4] reset: make device_reset_optional() really optional Masahiro Yamada
                   ` (2 preceding siblings ...)
  2017-10-28 16:50 ` [PATCH 4/4] reset: remove reset_control_get(_optional) Masahiro Yamada
@ 2017-10-30 15:23 ` Philipp Zabel
  3 siblings, 0 replies; 5+ messages in thread
From: Philipp Zabel @ 2017-10-30 15:23 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kernel

Hi Masahiro,

On Sun, 2017-10-29 at 01:50 +0900, Masahiro Yamada wrote:
> Commit bb475230b8e5 ("reset: make optional functions really optional")
> converted *_get_optional* functions, but device_reset_optional() was
> left behind.  Convert it in the same way.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

thank you for the patches, I have applied all four to reset/next.

regards
Philipp

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

end of thread, other threads:[~2017-10-30 15:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-28 16:50 [PATCH 1/4] reset: make device_reset_optional() really optional Masahiro Yamada
2017-10-28 16:50 ` [PATCH 2/4] reset: remove remaining WARN_ON() in <linux/reset.h> Masahiro Yamada
2017-10-28 16:50 ` [PATCH 3/4] reset: minimize the number of headers included from <linux/reset.h> Masahiro Yamada
2017-10-28 16:50 ` [PATCH 4/4] reset: remove reset_control_get(_optional) Masahiro Yamada
2017-10-30 15:23 ` [PATCH 1/4] reset: make device_reset_optional() really optional Philipp Zabel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).