* [PATCH] i2c: mv64xxx: Fix reset controller handling
@ 2014-03-10 11:12 Maxime Ripard
[not found] ` <1394449930-29696-1-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Maxime Ripard @ 2014-03-10 11:12 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
kevin.z.m.zh-Re5JQEeQqe8AvxtiuMwx3w,
sunny-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf,
shuge-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf,
zhuzhenhua-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf,
linux-lFZ/pmaqli7XmaaqVzeoHQ, Maxime Ripard
The reset framework recently gained optional stubs when CONFIG_RESET_CONTROLLER
is not selected. It also introduced a function reset_get_optional, that is also
dummy-defined whenever the framework isn't enabled, for drivers that needs an
optional reset controller.
Switch to this function, since the mv64xxx driver is in this case. This also
fixes a compilation breakage whenever the reset framework wasn't selected:
drivers/i2c/busses/i2c-mv64xxx.c:771:2: error: implicit declaration of function 'devm_reset_control_get'
While we're at it, remove the redundant test on dev.of_node surrounding the
calls to reset framework functions, since it will either be a valid pointer, an
error pointer in the case where we called reset_get_optional without an of_node
pointer or if it failed, or NULL if we're not loaded through DT.
Signed-off-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
Obviously, this patch depends on Philipp Zabel's "reset: Add optional resets
and stubs" patch that he merged and will send a pull request for.
drivers/i2c/busses/i2c-mv64xxx.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 203a5482a866..a09af20342ed 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -768,7 +768,7 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
}
drv_data->irq = irq_of_parse_and_map(np, 0);
- drv_data->rstc = devm_reset_control_get(dev, NULL);
+ drv_data->rstc = devm_reset_control_get_optional(dev, NULL);
if (IS_ERR(drv_data->rstc)) {
if (PTR_ERR(drv_data->rstc) == -EPROBE_DEFER) {
rc = -EPROBE_DEFER;
@@ -900,7 +900,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
exit_free_irq:
free_irq(drv_data->irq, drv_data);
exit_reset:
- if (pd->dev.of_node && !IS_ERR(drv_data->rstc))
+ if (!IS_ERR_OR_NULL(drv_data->rstc))
reset_control_assert(drv_data->rstc);
exit_clk:
#if defined(CONFIG_HAVE_CLK)
@@ -920,7 +920,7 @@ mv64xxx_i2c_remove(struct platform_device *dev)
i2c_del_adapter(&drv_data->adapter);
free_irq(drv_data->irq, drv_data);
- if (dev->dev.of_node && !IS_ERR(drv_data->rstc))
+ if (!IS_ERR_OR_NULL(drv_data->rstc))
reset_control_assert(drv_data->rstc);
#if defined(CONFIG_HAVE_CLK)
/* Not all platforms have a clk */
--
1.9.0
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <1394449930-29696-1-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>]
* Re: [PATCH] i2c: mv64xxx: Fix reset controller handling [not found] ` <1394449930-29696-1-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> @ 2014-03-28 7:49 ` Wolfram Sang 2014-03-28 8:24 ` Maxime Ripard 0 siblings, 1 reply; 3+ messages in thread From: Wolfram Sang @ 2014-03-28 7:49 UTC (permalink / raw) To: Maxime Ripard Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA, kevin.z.m.zh-Re5JQEeQqe8AvxtiuMwx3w, sunny-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf, shuge-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf, zhuzhenhua-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf, linux-lFZ/pmaqli7XmaaqVzeoHQ [-- Attachment #1: Type: text/plain, Size: 1068 bytes --] On Mon, Mar 10, 2014 at 12:12:10PM +0100, Maxime Ripard wrote: > The reset framework recently gained optional stubs when CONFIG_RESET_CONTROLLER > is not selected. It also introduced a function reset_get_optional, that is also > dummy-defined whenever the framework isn't enabled, for drivers that needs an > optional reset controller. > > Switch to this function, since the mv64xxx driver is in this case. This also > fixes a compilation breakage whenever the reset framework wasn't selected: > > drivers/i2c/busses/i2c-mv64xxx.c:771:2: error: implicit declaration of function 'devm_reset_control_get' > > While we're at it, remove the redundant test on dev.of_node surrounding the > calls to reset framework functions, since it will either be a valid pointer, an > error pointer in the case where we called reset_get_optional without an of_node > pointer or if it failed, or NULL if we're not loaded through DT. > > Signed-off-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> Applied to for-next, thanks! [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] i2c: mv64xxx: Fix reset controller handling 2014-03-28 7:49 ` Wolfram Sang @ 2014-03-28 8:24 ` Maxime Ripard 0 siblings, 0 replies; 3+ messages in thread From: Maxime Ripard @ 2014-03-28 8:24 UTC (permalink / raw) To: Wolfram Sang Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA, kevin.z.m.zh-Re5JQEeQqe8AvxtiuMwx3w, sunny-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf, shuge-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf, zhuzhenhua-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf, linux-lFZ/pmaqli7XmaaqVzeoHQ [-- Attachment #1: Type: text/plain, Size: 1333 bytes --] On Fri, Mar 28, 2014 at 08:49:00AM +0100, Wolfram Sang wrote: > On Mon, Mar 10, 2014 at 12:12:10PM +0100, Maxime Ripard wrote: > > The reset framework recently gained optional stubs when CONFIG_RESET_CONTROLLER > > is not selected. It also introduced a function reset_get_optional, that is also > > dummy-defined whenever the framework isn't enabled, for drivers that needs an > > optional reset controller. > > > > Switch to this function, since the mv64xxx driver is in this case. This also > > fixes a compilation breakage whenever the reset framework wasn't selected: > > > > drivers/i2c/busses/i2c-mv64xxx.c:771:2: error: implicit declaration of function 'devm_reset_control_get' > > > > While we're at it, remove the redundant test on dev.of_node surrounding the > > calls to reset framework functions, since it will either be a valid pointer, an > > error pointer in the case where we called reset_get_optional without an of_node > > pointer or if it failed, or NULL if we're not loaded through DT. > > > > Signed-off-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> > > Applied to for-next, thanks! Thanks for your patience, and sorry for the mess. -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-28 8:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-10 11:12 [PATCH] i2c: mv64xxx: Fix reset controller handling Maxime Ripard
[not found] ` <1394449930-29696-1-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-03-28 7:49 ` Wolfram Sang
2014-03-28 8:24 ` Maxime Ripard
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).