* [PATCH] mxc-nand: no need to check for validity of platform drive data
@ 2010-01-11 14:05 Uwe Kleine-König
2010-01-11 16:53 ` [PATCH] mxc-nand: don't disable clock in mxcnd-suspend Uwe Kleine-König
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2010-01-11 14:05 UTC (permalink / raw)
To: linux-mtd
Cc: Vladimir Barinov, Artem Bityutskiy, Sascha Hauer, David Woodhouse
The probe function calls platform_set_drvdata with a valid pointer when
the probe is successful. As mxcnd_suspend and mxcnd_resume are only
called on bound devices, platform_get_drvdata always returns non-NULL.
This fix isn't critical as the pointer is always valid so it doesn't
matter if the compiler generated code for it or not.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reported-by: David Binderman <dcb314@hotmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Vladimir Barinov <vova.barinov@gmail.com>
---
drivers/mtd/nand/mxc_nand.c | 17 +++++++----------
1 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 45dec57..84f3635 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -886,11 +886,10 @@ static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state)
int ret = 0;
DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND suspend\n");
- if (mtd) {
- ret = mtd->suspend(mtd);
- /* Disable the NFC clock */
- clk_disable(host->clk);
- }
+
+ ret = mtd->suspend(mtd);
+ /* Disable the NFC clock */
+ clk_disable(host->clk);
return ret;
}
@@ -904,11 +903,9 @@ static int mxcnd_resume(struct platform_device *pdev)
DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND resume\n");
- if (mtd) {
- /* Enable the NFC clock */
- clk_enable(host->clk);
- mtd->resume(mtd);
- }
+ /* Enable the NFC clock */
+ clk_enable(host->clk);
+ mtd->resume(mtd);
return ret;
}
--
1.6.5.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] mxc-nand: don't disable clock in mxcnd-suspend
2010-01-11 14:05 [PATCH] mxc-nand: no need to check for validity of platform drive data Uwe Kleine-König
@ 2010-01-11 16:53 ` Uwe Kleine-König
2010-01-11 18:00 ` Sascha Hauer
2010-01-11 18:00 ` [PATCH] mxc-nand: no need to check for validity of platform drive data Sascha Hauer
2010-01-17 8:25 ` Artem Bityutskiy
2 siblings, 1 reply; 7+ messages in thread
From: Uwe Kleine-König @ 2010-01-11 16:53 UTC (permalink / raw)
To: linux-mtd
Cc: Vladimir Barinov, Artem Bityutskiy, Sascha Hauer, David Woodhouse
The clock must already be off after mtd->suspend. Disabling it again
results in an negative overflow of the clock usage count. This didn't
hurt as mxcnd_resume undid it after wake up.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Vladimir Barinov <vova.barinov@gmail.com>
---
drivers/mtd/nand/mxc_nand.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 84f3635..970ce6b 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -888,8 +888,12 @@ static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state)
DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND suspend\n");
ret = mtd->suspend(mtd);
- /* Disable the NFC clock */
- clk_disable(host->clk);
+
+ /*
+ * nand_suspend locks the device for exclusive access, so
+ * the clock must already be off.
+ */
+ BUG_ON(!ret && host->clk_act);
return ret;
}
@@ -903,8 +907,6 @@ static int mxcnd_resume(struct platform_device *pdev)
DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND resume\n");
- /* Enable the NFC clock */
- clk_enable(host->clk);
mtd->resume(mtd);
return ret;
--
1.6.5.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] mxc-nand: no need to check for validity of platform drive data
2010-01-11 14:05 [PATCH] mxc-nand: no need to check for validity of platform drive data Uwe Kleine-König
2010-01-11 16:53 ` [PATCH] mxc-nand: don't disable clock in mxcnd-suspend Uwe Kleine-König
@ 2010-01-11 18:00 ` Sascha Hauer
2010-01-17 8:25 ` Artem Bityutskiy
2 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2010-01-11 18:00 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Vladimir Barinov, David Woodhouse, linux-mtd, Artem Bityutskiy
On Mon, Jan 11, 2010 at 03:05:35PM +0100, Uwe Kleine-König wrote:
> The probe function calls platform_set_drvdata with a valid pointer when
> the probe is successful. As mxcnd_suspend and mxcnd_resume are only
> called on bound devices, platform_get_drvdata always returns non-NULL.
>
> This fix isn't critical as the pointer is always valid so it doesn't
> matter if the compiler generated code for it or not.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Reported-by: David Binderman <dcb314@hotmail.com>
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
> Cc: Vladimir Barinov <vova.barinov@gmail.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> drivers/mtd/nand/mxc_nand.c | 17 +++++++----------
> 1 files changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
> index 45dec57..84f3635 100644
> --- a/drivers/mtd/nand/mxc_nand.c
> +++ b/drivers/mtd/nand/mxc_nand.c
> @@ -886,11 +886,10 @@ static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state)
> int ret = 0;
>
> DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND suspend\n");
> - if (mtd) {
> - ret = mtd->suspend(mtd);
> - /* Disable the NFC clock */
> - clk_disable(host->clk);
> - }
> +
> + ret = mtd->suspend(mtd);
> + /* Disable the NFC clock */
> + clk_disable(host->clk);
>
> return ret;
> }
> @@ -904,11 +903,9 @@ static int mxcnd_resume(struct platform_device *pdev)
>
> DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND resume\n");
>
> - if (mtd) {
> - /* Enable the NFC clock */
> - clk_enable(host->clk);
> - mtd->resume(mtd);
> - }
> + /* Enable the NFC clock */
> + clk_enable(host->clk);
> + mtd->resume(mtd);
>
> return ret;
> }
> --
> 1.6.5.2
>
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mxc-nand: don't disable clock in mxcnd-suspend
2010-01-11 16:53 ` [PATCH] mxc-nand: don't disable clock in mxcnd-suspend Uwe Kleine-König
@ 2010-01-11 18:00 ` Sascha Hauer
0 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2010-01-11 18:00 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Vladimir Barinov, David Woodhouse, linux-mtd, Artem Bityutskiy
On Mon, Jan 11, 2010 at 05:53:16PM +0100, Uwe Kleine-König wrote:
> The clock must already be off after mtd->suspend. Disabling it again
> results in an negative overflow of the clock usage count. This didn't
> hurt as mxcnd_resume undid it after wake up.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
> Cc: Vladimir Barinov <vova.barinov@gmail.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> drivers/mtd/nand/mxc_nand.c | 10 ++++++----
> 1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
> index 84f3635..970ce6b 100644
> --- a/drivers/mtd/nand/mxc_nand.c
> +++ b/drivers/mtd/nand/mxc_nand.c
> @@ -888,8 +888,12 @@ static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state)
> DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND suspend\n");
>
> ret = mtd->suspend(mtd);
> - /* Disable the NFC clock */
> - clk_disable(host->clk);
> +
> + /*
> + * nand_suspend locks the device for exclusive access, so
> + * the clock must already be off.
> + */
> + BUG_ON(!ret && host->clk_act);
>
> return ret;
> }
> @@ -903,8 +907,6 @@ static int mxcnd_resume(struct platform_device *pdev)
>
> DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND resume\n");
>
> - /* Enable the NFC clock */
> - clk_enable(host->clk);
> mtd->resume(mtd);
>
> return ret;
> --
> 1.6.5.2
>
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mxc-nand: no need to check for validity of platform drive data
2010-01-11 14:05 [PATCH] mxc-nand: no need to check for validity of platform drive data Uwe Kleine-König
2010-01-11 16:53 ` [PATCH] mxc-nand: don't disable clock in mxcnd-suspend Uwe Kleine-König
2010-01-11 18:00 ` [PATCH] mxc-nand: no need to check for validity of platform drive data Sascha Hauer
@ 2010-01-17 8:25 ` Artem Bityutskiy
2010-02-05 13:47 ` Uwe Kleine-König
2 siblings, 1 reply; 7+ messages in thread
From: Artem Bityutskiy @ 2010-01-17 8:25 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Vladimir Barinov, Artem Bityutskiy, Sascha Hauer, linux-mtd,
David Woodhouse
On Mon, 2010-01-11 at 15:05 +0100, Uwe Kleine-König wrote:
> The probe function calls platform_set_drvdata with a valid pointer when
> the probe is successful. As mxcnd_suspend and mxcnd_resume are only
> called on bound devices, platform_get_drvdata always returns non-NULL.
>
> This fix isn't critical as the pointer is always valid so it doesn't
> matter if the compiler generated code for it or not.
I've put these patches to my l2-mtd-2.6.git/master
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mxc-nand: no need to check for validity of platform drive data
2010-01-17 8:25 ` Artem Bityutskiy
@ 2010-02-05 13:47 ` Uwe Kleine-König
2010-02-05 13:55 ` Artem Bityutskiy
0 siblings, 1 reply; 7+ messages in thread
From: Uwe Kleine-König @ 2010-02-05 13:47 UTC (permalink / raw)
To: Artem Bityutskiy
Cc: Vladimir Barinov, Artem Bityutskiy, Sascha Hauer, linux-mtd,
David Woodhouse
Hello Artem,
On Sun, Jan 17, 2010 at 10:25:54AM +0200, Artem Bityutskiy wrote:
> On Mon, 2010-01-11 at 15:05 +0100, Uwe Kleine-König wrote:
> > The probe function calls platform_set_drvdata with a valid pointer when
> > the probe is successful. As mxcnd_suspend and mxcnd_resume are only
> > called on bound devices, platform_get_drvdata always returns non-NULL.
> >
> > This fix isn't critical as the pointer is always valid so it doesn't
> > matter if the compiler generated code for it or not.
>
> I've put these patches to my l2-mtd-2.6.git/master
Up to now this patch didn't hit next. Maybe you want to ask Steven
Rothwell to merge your tree, too?
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mxc-nand: no need to check for validity of platform drive data
2010-02-05 13:47 ` Uwe Kleine-König
@ 2010-02-05 13:55 ` Artem Bityutskiy
0 siblings, 0 replies; 7+ messages in thread
From: Artem Bityutskiy @ 2010-02-05 13:55 UTC (permalink / raw)
To: ext Uwe Kleine-König
Cc: Vladimir Barinov, David Woodhouse, Sascha Hauer,
linux-mtd@lists.infradead.org
Hi,
On Fri, 2010-02-05 at 14:47 +0100, ext Uwe Kleine-König wrote:
> Hello Artem,
>
> On Sun, Jan 17, 2010 at 10:25:54AM +0200, Artem Bityutskiy wrote:
> > On Mon, 2010-01-11 at 15:05 +0100, Uwe Kleine-König wrote:
> > > The probe function calls platform_set_drvdata with a valid pointer when
> > > the probe is successful. As mxcnd_suspend and mxcnd_resume are only
> > > called on bound devices, platform_get_drvdata always returns non-NULL.
> > >
> > > This fix isn't critical as the pointer is always valid so it doesn't
> > > matter if the compiler generated code for it or not.
> >
> > I've put these patches to my l2-mtd-2.6.git/master
> Up to now this patch didn't hit next. Maybe you want to ask Steven
> Rothwell to merge your tree, too?
This is up to dwmw2, who is the MTD maintainer. All I do is I am helping
dwmw2 by providing him a git tree with all MTD patches from the mailing
list. So he does not have to go through whole mailing list. I put stuff
I reviewed to "master", and stuff I did/could not review to "dunno"
Hence, my tree is "level 2".
To get into the "next" tree, you should contact dwmw2.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-02-05 13:55 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-11 14:05 [PATCH] mxc-nand: no need to check for validity of platform drive data Uwe Kleine-König
2010-01-11 16:53 ` [PATCH] mxc-nand: don't disable clock in mxcnd-suspend Uwe Kleine-König
2010-01-11 18:00 ` Sascha Hauer
2010-01-11 18:00 ` [PATCH] mxc-nand: no need to check for validity of platform drive data Sascha Hauer
2010-01-17 8:25 ` Artem Bityutskiy
2010-02-05 13:47 ` Uwe Kleine-König
2010-02-05 13:55 ` Artem Bityutskiy
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).