stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dinh Nguyen <dinguyen@kernel.org>
To: stable@vger.kernel.org
Cc: dinguyen@kernel.org, gregkh@linuxfoundation.org,
	sashal@kernel.org, Philipp Zabel <p.zabel@pengutronix.de>,
	Ramiro Oliveira <Ramiro.Oliveira@synopsys.com>
Subject: [PATCH for v4.19-stable 3/6] reset: fix optional reset_control_get stubs to return NULL
Date: Mon,  3 Dec 2018 15:42:11 -0600	[thread overview]
Message-ID: <20181203214214.28612-3-dinguyen@kernel.org> (raw)
In-Reply-To: <20181203214214.28612-1-dinguyen@kernel.org>

From: Philipp Zabel <p.zabel@pengutronix.de>

commit 0ca10b60ceeb5372da01798ca68c116ae45a6eb6 upstream.

When RESET_CONTROLLER is not enabled, the optional reset_control_get
stubs should now also return NULL.

Since it is now valid for reset_control_assert/deassert/reset/status/put
to be called unconditionally, with NULL as an argument for optional
resets, the stubs are not allowed to warn anymore.

Fixes: bb475230b8e5 ("reset: make optional functions really optional")
Reported-by: Andrzej Hajda <a.hajda@samsung.com>
Tested-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Cc: Ramiro Oliveira <Ramiro.Oliveira@synopsys.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 include/linux/reset.h | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/include/linux/reset.h b/include/linux/reset.h
index 86b4ed75359e..96fb139bdd08 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -31,31 +31,26 @@ static inline int device_reset_optional(struct device *dev)
 
 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)
@@ -74,14 +69,14 @@ static inline struct reset_control *__of_reset_control_get(
 					const char *id, int index, bool shared,
 					bool optional)
 {
-	return ERR_PTR(-ENOTSUPP);
+	return optional ? NULL : ERR_PTR(-ENOTSUPP);
 }
 
 static inline struct reset_control *__devm_reset_control_get(
 					struct device *dev, const char *id,
 					int index, bool shared, bool optional)
 {
-	return ERR_PTR(-ENOTSUPP);
+	return optional ? NULL : ERR_PTR(-ENOTSUPP);
 }
 
 #endif /* CONFIG_RESET_CONTROLLER */
-- 
2.17.1

  parent reply	other threads:[~2018-12-03 21:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-03 21:42 [PATCH for v4.19-stable 1/6] reset: make optional functions really optional Dinh Nguyen
2018-12-03 21:42 ` [PATCH for v4.19-stable 2/6] reset: core: fix reset_control_put Dinh Nguyen
2018-12-03 21:42 ` Dinh Nguyen [this message]
2018-12-03 21:42 ` [PATCH for v4.19-stable 4/6] reset: add exported __reset_control_get, return NULL if optional Dinh Nguyen
2018-12-03 21:42 ` [PATCH for v4.19-stable 5/6] reset: make device_reset_optional() really optional Dinh Nguyen
2018-12-03 21:42 ` [PATCH for v4.19-stable 6/6] reset: remove remaining WARN_ON() in <linux/reset.h> Dinh Nguyen
2018-12-04  7:26 ` [PATCH for v4.19-stable 1/6] reset: make optional functions really optional Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181203214214.28612-3-dinguyen@kernel.org \
    --to=dinguyen@kernel.org \
    --cc=Ramiro.Oliveira@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=p.zabel@pengutronix.de \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).