* [PATCH] staging/nvec: Pass proper resource to mfd_add_devices()
@ 2014-07-21 11:52 Thierry Reding
2014-07-21 20:01 ` Marc Dietrich
2014-07-21 21:20 ` Greg Kroah-Hartman
0 siblings, 2 replies; 5+ messages in thread
From: Thierry Reding @ 2014-07-21 11:52 UTC (permalink / raw)
To: Marc Dietrich, Greg Kroah-Hartman
Cc: ac100-oU9gvf+ajcQ97yFScArB1dHuzzzSOjJt,
linux-tegra-u79uwXL29TY76Z2rM5mHXA,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b
From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
The mfd_add_devices() parameter takes a struct resource * as fifth
argument, but the nvec driver passes in a void __iomem *. The driver
gets away with it because none of the subdevices ever directly access
the registers.
While at it, use platform_get_irq() instead of platform_get_resource()
to get the device's interrupt. This makes it easier to pass in the
register region since the variable is no longer reused.
Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
Alternatively we could simply pass NULL into mfd_add_devices(), which
might be a slightly more accurate representation of what's going on.
Marc, Greg, any preferences?
drivers/staging/nvec/nvec.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index d32504844896..11f9e1c3447c 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -821,8 +821,8 @@ static int tegra_nvec_probe(struct platform_device *pdev)
if (IS_ERR(base))
return PTR_ERR(base);
- res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
- if (!res) {
+ nvec->irq = platform_get_irq(pdev, 0);
+ if (nvec->irq < 0) {
dev_err(&pdev->dev, "no irq resource?\n");
return -ENODEV;
}
@@ -840,7 +840,6 @@ static int tegra_nvec_probe(struct platform_device *pdev)
}
nvec->base = base;
- nvec->irq = res->start;
nvec->i2c_clk = i2c_clk;
nvec->rx = &nvec->msg_pool[0];
@@ -893,7 +892,7 @@ static int tegra_nvec_probe(struct platform_device *pdev)
}
ret = mfd_add_devices(nvec->dev, -1, nvec_devices,
- ARRAY_SIZE(nvec_devices), base, 0, NULL);
+ ARRAY_SIZE(nvec_devices), res, 0, NULL);
if (ret)
dev_err(nvec->dev, "error adding subdevices\n");
--
2.0.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] staging/nvec: Pass proper resource to mfd_add_devices()
2014-07-21 11:52 [PATCH] staging/nvec: Pass proper resource to mfd_add_devices() Thierry Reding
@ 2014-07-21 20:01 ` Marc Dietrich
2014-07-21 21:39 ` Greg Kroah-Hartman
2014-07-21 21:20 ` Greg Kroah-Hartman
1 sibling, 1 reply; 5+ messages in thread
From: Marc Dietrich @ 2014-07-21 20:01 UTC (permalink / raw)
To: Thierry Reding; +Cc: linux-tegra, Greg Kroah-Hartman, devel, ac100
Hi Thierry,
On Mon, 21 Jul 2014 13:52:41 +0200
Thierry Reding <thierry.reding@gmail.com> wrote:
> From: Thierry Reding <treding@nvidia.com>
>
> The mfd_add_devices() parameter takes a struct resource * as fifth
> argument, but the nvec driver passes in a void __iomem *. The driver
> gets away with it because none of the subdevices ever directly access
> the registers.
you are right, this one looked bogus.
> While at it, use platform_get_irq() instead of platform_get_resource()
> to get the device's interrupt. This makes it easier to pass in the
> register region since the variable is no longer reused.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
> Alternatively we could simply pass NULL into mfd_add_devices(), which
> might be a slightly more accurate representation of what's going on.
>
> Marc, Greg, any preferences?
I just tested with NULL as base and it seems to produce no harm. Even
if we may get rid of mfd_add_devices in the future, passing NULL is
cleaner for now and no children will ever make use of it. So please send
a new version with this change.
Otherwise, thanks for looking and cleaning up.
Marc
> drivers/staging/nvec/nvec.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> index d32504844896..11f9e1c3447c 100644
> --- a/drivers/staging/nvec/nvec.c
> +++ b/drivers/staging/nvec/nvec.c
> @@ -821,8 +821,8 @@ static int tegra_nvec_probe(struct platform_device *pdev)
> if (IS_ERR(base))
> return PTR_ERR(base);
>
> - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> - if (!res) {
> + nvec->irq = platform_get_irq(pdev, 0);
> + if (nvec->irq < 0) {
> dev_err(&pdev->dev, "no irq resource?\n");
> return -ENODEV;
> }
> @@ -840,7 +840,6 @@ static int tegra_nvec_probe(struct platform_device *pdev)
> }
>
> nvec->base = base;
> - nvec->irq = res->start;
> nvec->i2c_clk = i2c_clk;
> nvec->rx = &nvec->msg_pool[0];
>
> @@ -893,7 +892,7 @@ static int tegra_nvec_probe(struct platform_device *pdev)
> }
>
> ret = mfd_add_devices(nvec->dev, -1, nvec_devices,
> - ARRAY_SIZE(nvec_devices), base, 0, NULL);
> + ARRAY_SIZE(nvec_devices), res, 0, NULL);
> if (ret)
> dev_err(nvec->dev, "error adding subdevices\n");
>
> --
> 2.0.1
>
--
Marc Dietrich <marvin24@gmx.de>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] staging/nvec: Pass proper resource to mfd_add_devices()
2014-07-21 20:01 ` Marc Dietrich
@ 2014-07-21 21:39 ` Greg Kroah-Hartman
[not found] ` <20140721213915.GA8168-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2014-07-21 21:39 UTC (permalink / raw)
To: Marc Dietrich; +Cc: linux-tegra, devel, Thierry Reding, ac100
On Mon, Jul 21, 2014 at 10:01:36PM +0200, Marc Dietrich wrote:
> Hi Thierry,
>
> On Mon, 21 Jul 2014 13:52:41 +0200
> Thierry Reding <thierry.reding@gmail.com> wrote:
>
> > From: Thierry Reding <treding@nvidia.com>
> >
> > The mfd_add_devices() parameter takes a struct resource * as fifth
> > argument, but the nvec driver passes in a void __iomem *. The driver
> > gets away with it because none of the subdevices ever directly access
> > the registers.
>
> you are right, this one looked bogus.
>
> > While at it, use platform_get_irq() instead of platform_get_resource()
> > to get the device's interrupt. This makes it easier to pass in the
> > register region since the variable is no longer reused.
> >
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > ---
> > Alternatively we could simply pass NULL into mfd_add_devices(), which
> > might be a slightly more accurate representation of what's going on.
> >
> > Marc, Greg, any preferences?
>
> I just tested with NULL as base and it seems to produce no harm. Even
> if we may get rid of mfd_add_devices in the future, passing NULL is
> cleaner for now and no children will ever make use of it. So please send
> a new version with this change.
>
> Otherwise, thanks for looking and cleaning up.
Ok, can I get your ack for this patch then?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging/nvec: Pass proper resource to mfd_add_devices()
2014-07-21 11:52 [PATCH] staging/nvec: Pass proper resource to mfd_add_devices() Thierry Reding
2014-07-21 20:01 ` Marc Dietrich
@ 2014-07-21 21:20 ` Greg Kroah-Hartman
1 sibling, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2014-07-21 21:20 UTC (permalink / raw)
To: Thierry Reding; +Cc: linux-tegra, devel, ac100
On Mon, Jul 21, 2014 at 01:52:41PM +0200, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
>
> The mfd_add_devices() parameter takes a struct resource * as fifth
> argument, but the nvec driver passes in a void __iomem *. The driver
> gets away with it because none of the subdevices ever directly access
> the registers.
>
> While at it, use platform_get_irq() instead of platform_get_resource()
> to get the device's interrupt. This makes it easier to pass in the
> register region since the variable is no longer reused.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
> Alternatively we could simply pass NULL into mfd_add_devices(), which
> might be a slightly more accurate representation of what's going on.
>
> Marc, Greg, any preferences?
None from me, Marc?
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-07-21 21:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-21 11:52 [PATCH] staging/nvec: Pass proper resource to mfd_add_devices() Thierry Reding
2014-07-21 20:01 ` Marc Dietrich
2014-07-21 21:39 ` Greg Kroah-Hartman
[not found] ` <20140721213915.GA8168-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2014-07-21 21:49 ` Thierry Reding
2014-07-21 21:20 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox