linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] reset: Put back *_optional variants
@ 2016-05-26  1:15 John Youn
  2016-05-26 20:25 ` Hans de Goede
  0 siblings, 1 reply; 8+ messages in thread
From: John Youn @ 2016-05-26  1:15 UTC (permalink / raw)
  To: linux-arm-kernel

Prior to commit 6c96f05c8bb8 ("reset: Make [of_]reset_control_get[_foo]
functions wrappers"), the optional variants returned -ENOTSUPP when
CONFIG_RESET_CONTROLLER was not set. This patch reverts to this
behavior. Otherwise those calls will return -EINVAL causing users to
think that an error occurred when CONFIG_RESET_CONTROLLER is not set.

Fixes: 6c96f05c8bb8 ("reset: Make [of_]reset_control_get[_foo] functions wrappers")
Signed-off-by: John Youn <johnyoun@synopsys.com>
---

Hi Philipp, Hans,

The commit referenced above breaks an upcoming patch for the dwc2
driver that adds an optional reset control.

https://marc.info/?l=linux-usb&m=146161328211584&w=2

I've attempted to add the optional variants back the way they were
working before. Let me know if I need to do anything else to fix it or
if it should be done another way.

Regards,
John


 include/linux/reset.h | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/include/linux/reset.h b/include/linux/reset.h
index ec0306ce..739d33d 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -14,10 +14,24 @@ int reset_control_status(struct reset_control *rstc);
 
 struct reset_control *__of_reset_control_get(struct device_node *node,
 				     const char *id, int index, int shared);
+
+struct reset_control *__of_reset_control_get_optional(struct device_node *node,
+				     const char *id, int index, int shared)
+{
+	return __of_reset_control_get(node, id, index, shared);
+}
+
 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);
 
+static inline struct reset_control *__devm_reset_control_get_optional(
+					struct device *dev,
+					const char *id, int index, int shared)
+{
+	return __devm_reset_control_get(dev, id, index, shared);
+}
+
 int __must_check device_reset(struct device *dev);
 
 static inline int device_reset_optional(struct device *dev)
@@ -74,6 +88,13 @@ static inline struct reset_control *__of_reset_control_get(
 	return ERR_PTR(-EINVAL);
 }
 
+static inline struct reset_control *__of_reset_control_get_optional(
+					struct device_node *node,
+					const char *id, int index, int shared)
+{
+	return ERR_PTR(-ENOTSUPP);
+}
+
 static inline struct reset_control *__devm_reset_control_get(
 					struct device *dev,
 					const char *id, int index, int shared)
@@ -81,6 +102,13 @@ static inline struct reset_control *__devm_reset_control_get(
 	return ERR_PTR(-EINVAL);
 }
 
+static inline struct reset_control *__devm_reset_control_get_optional(
+					struct device *dev,
+					const char *id, int index, int shared)
+{
+	return ERR_PTR(-ENOTSUPP);
+}
+
 #endif /* CONFIG_RESET_CONTROLLER */
 
 /**
@@ -110,7 +138,8 @@ static inline struct reset_control *__must_check reset_control_get(
 static inline struct reset_control *reset_control_get_optional(
 					struct device *dev, const char *id)
 {
-	return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 0);
+	return __of_reset_control_get_optional(dev ? dev->of_node : NULL,
+					       id, 0, 0);
 }
 
 /**
@@ -194,7 +223,7 @@ static inline struct reset_control *__must_check devm_reset_control_get(
 static inline struct reset_control *devm_reset_control_get_optional(
 					struct device *dev, const char *id)
 {
-	return __devm_reset_control_get(dev, id, 0, 0);
+	return __devm_reset_control_get_optional(dev, id, 0, 0);
 }
 
 /**
-- 
2.8.2

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

end of thread, other threads:[~2016-05-31  5:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-26  1:15 [PATCH] reset: Put back *_optional variants John Youn
2016-05-26 20:25 ` Hans de Goede
2016-05-26 21:44   ` John Youn
2016-05-27  7:06     ` Hans de Goede
2016-05-30 10:18       ` Philipp Zabel
2016-05-30 11:32         ` Hans de Goede
2016-05-30 12:11           ` Philipp Zabel
2016-05-31  5:53           ` John Youn

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