From: Dinh Nguyen <dinguyen@kernel.org>
To: stable@vger.kernel.org
Cc: dinguyen@kernel.org, gregkh@linuxfoundation.org,
sashal@kernel.org,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Philipp Zabel <p.zabel@pengutronix.de>
Subject: [PATCHv2 for v4.19-stable 5/6] reset: make device_reset_optional() really optional
Date: Tue, 4 Dec 2018 09:34:47 -0600 [thread overview]
Message-ID: <20181204153448.6189-6-dinguyen@kernel.org> (raw)
In-Reply-To: <20181204153448.6189-1-dinguyen@kernel.org>
From: Masahiro Yamada <yamada.masahiro@socionext.com>
commit 1554bbd4ad401b7f0f916c0891874111c10befe5 upstream.
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>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
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 e8cb31616c3e..188205a55261 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -410,17 +410,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);
@@ -430,4 +431,4 @@ int device_reset(struct device *dev)
return ret;
}
-EXPORT_SYMBOL_GPL(device_reset);
+EXPORT_SYMBOL_GPL(__device_reset);
diff --git a/include/linux/reset.h b/include/linux/reset.h
index 13d8681210d5..61a0dda3f981 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -19,17 +19,11 @@ 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);
-
-static inline int device_reset_optional(struct device *dev)
-{
- return device_reset(dev);
-}
-
#else
static inline int reset_control_reset(struct reset_control *rstc)
@@ -56,15 +50,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(
@@ -91,6 +79,16 @@ static inline struct reset_control *__devm_reset_control_get(
#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.17.1
next prev parent reply other threads:[~2018-12-04 15:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-04 15:34 [PATCHv2 for v4.19-stable 0/6] reset: make optional functions Dinh Nguyen
2018-12-04 15:34 ` [PATCHv2 for v4.19-stable 1/6] reset: make optional functions really optional Dinh Nguyen
2018-12-04 15:34 ` [PATCHv2 for v4.19-stable 2/6] reset: core: fix reset_control_put Dinh Nguyen
2018-12-04 15:34 ` [PATCHv2 for v4.19-stable 3/6] reset: fix optional reset_control_get stubs to return NULL Dinh Nguyen
2018-12-04 15:34 ` [PATCHv2 for v4.19-stable 4/6] reset: add exported __reset_control_get, return NULL if optional Dinh Nguyen
2018-12-04 15:34 ` Dinh Nguyen [this message]
2018-12-04 15:34 ` [PATCHv2 for v4.19-stable 6/6] reset: remove remaining WARN_ON() in <linux/reset.h> Dinh Nguyen
2018-12-04 15:45 ` [PATCHv2 for v4.19-stable 0/6] reset: make optional functions Greg KH
2018-12-04 15:45 ` Greg KH
2018-12-04 17:27 ` Dinh Nguyen
2018-12-06 11:01 ` Greg KH
2018-12-06 15:17 ` Dinh Nguyen
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=20181204153448.6189-6-dinguyen@kernel.org \
--to=dinguyen@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=p.zabel@pengutronix.de \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
--cc=yamada.masahiro@socionext.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.