Patchwork [27/37] powerpc fsl_msi: don't abuse platform_data for driver_data

login
register
mail settings
Submitter Milton Miller
Date May 11, 2011, 5:30 a.m.
Message ID <ed4319ec825be60a30d7ce5fd50654cde2c5829d.1305092637.git.miltonm@bga.com>
Download mbox | patch
Permalink /patch/95085/
State Accepted
Commit 6c4c82e20a1b476589c1e2b0b7c2adc783c93006
Delegated to: Benjamin Herrenschmidt
Headers show

Comments

Milton Miller - May 11, 2011, 5:30 a.m.
The msi platform device driver was abusing dev.platform_data for its
platform_driver_data.  Use the correct pointer for storage.

Platform_data is supposed to be for platforms to communicate to drivers
parameters that are not otherwise discoverable.  Its lifetime matches
the platform_device not the platform device driver.  It is generally
not needed for drivers that only support systems with device trees.

Signed-off-by: Milton Miller <miltonm@bga.com>
---
---
 arch/powerpc/sysdev/fsl_msi.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Grant Likely - May 11, 2011, 7:05 p.m.
On Wed, May 11, 2011 at 7:30 AM, Milton Miller <miltonm@bga.com> wrote:
> The msi platform device driver was abusing dev.platform_data for its
> platform_driver_data.  Use the correct pointer for storage.
>
> Platform_data is supposed to be for platforms to communicate to drivers
> parameters that are not otherwise discoverable.  Its lifetime matches
> the platform_device not the platform device driver.  It is generally
> not needed for drivers that only support systems with device trees.
>
> Signed-off-by: Milton Miller <miltonm@bga.com>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
> ---
>  arch/powerpc/sysdev/fsl_msi.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
> index d5679dc..077776c 100644
> --- a/arch/powerpc/sysdev/fsl_msi.c
> +++ b/arch/powerpc/sysdev/fsl_msi.c
> @@ -253,7 +253,7 @@ unlock:
>
>  static int fsl_of_msi_remove(struct platform_device *ofdev)
>  {
> -       struct fsl_msi *msi = ofdev->dev.platform_data;
> +       struct fsl_msi *msi = platform_get_drvdata(ofdev);
>        int virq, i;
>        struct fsl_msi_cascade_data *cascade_data;
>
> @@ -327,7 +327,7 @@ static int __devinit fsl_of_msi_probe(struct platform_device *dev)
>                dev_err(&dev->dev, "No memory for MSI structure\n");
>                return -ENOMEM;
>        }
> -       dev->dev.platform_data = msi;
> +       platform_set_drvdata(dev, msi);
>
>        msi->irqhost = irq_alloc_host(dev->dev.of_node, IRQ_HOST_MAP_LINEAR,
>                                      NR_MSI_IRQS, &fsl_msi_host_ops, 0);
> --
> 1.7.0.4
>
>

Patch

diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index d5679dc..077776c 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -253,7 +253,7 @@  unlock:
 
 static int fsl_of_msi_remove(struct platform_device *ofdev)
 {
-	struct fsl_msi *msi = ofdev->dev.platform_data;
+	struct fsl_msi *msi = platform_get_drvdata(ofdev);
 	int virq, i;
 	struct fsl_msi_cascade_data *cascade_data;
 
@@ -327,7 +327,7 @@  static int __devinit fsl_of_msi_probe(struct platform_device *dev)
 		dev_err(&dev->dev, "No memory for MSI structure\n");
 		return -ENOMEM;
 	}
-	dev->dev.platform_data = msi;
+	platform_set_drvdata(dev, msi);
 
 	msi->irqhost = irq_alloc_host(dev->dev.of_node, IRQ_HOST_MAP_LINEAR,
 				      NR_MSI_IRQS, &fsl_msi_host_ops, 0);