b53: use drvdata to store driver data
authorHauke Mehrtens <hauke@hauke-m.de>
Mon, 20 Jan 2014 20:01:22 +0000 (20:01 +0000)
committerHauke Mehrtens <hauke@hauke-m.de>
Mon, 20 Jan 2014 20:01:22 +0000 (20:01 +0000)
we should not abuse the platform_data pointer.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
SVN-Revision: 39354

target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c
target/linux/generic/files/drivers/net/phy/b53/b53_spi.c
target/linux/generic/files/drivers/net/phy/b53/b53_srab.c

index 1fd01581a2a6a963817a801ed7290f3c95775001..272360f6deedac41740ed938786725e1d543dfbb 100644 (file)
@@ -210,17 +210,16 @@ static int b53_mmap_probe(struct platform_device *pdev)
        if (pdata)
                dev->pdata = pdata;
 
-       pdev->dev.platform_data = dev;
+       platform_set_drvdata(pdev, dev);
 
        return b53_switch_register(dev);
 }
 
 static int b53_mmap_remove(struct platform_device *pdev)
 {
-       struct b53_device *dev = pdev->dev.platform_data;
+       struct b53_device *dev = platform_get_drvdata(pdev);
 
        if (dev) {
-               pdev->dev.platform_data = dev->pdata;
                b53_switch_remove(dev);
        }
 
index 6050fea32ed05c0cd9e4824d30d374bbc1979b6d..8c6b171e75b5cdc43d1269cfab2dc5f1f8caee11 100644 (file)
@@ -294,19 +294,17 @@ static int b53_spi_probe(struct spi_device *spi)
        if (ret)
                return ret;
 
-       spi->dev.platform_data = dev;
+       spi_set_drvdata(spi, dev);
 
        return 0;
 }
 
 static int b53_spi_remove(struct spi_device *spi)
 {
-       struct b53_device *dev = spi->dev.platform_data;
+       struct b53_device *dev = spi_get_drvdata(spi);
 
        if (dev) {
-               struct b53_platform_data *pdata = dev->pdata;
                b53_switch_remove(dev);
-               spi->dev.platform_data = pdata;
        }
 
        return 0;
index f0743b701708674ea9d589ac067740d39071dd4c..a68e27540a47780a76718783f7cbb1baa5583da5 100644 (file)
@@ -349,17 +349,16 @@ static int b53_srab_probe(struct platform_device *pdev)
        if (pdata)
                dev->pdata = pdata;
 
-       pdev->dev.platform_data = dev;
+       platform_set_drvdata(pdev, dev);
 
        return b53_switch_register(dev);
 }
 
 static int b53_srab_remove(struct platform_device *pdev)
 {
-       struct b53_device *dev = pdev->dev.platform_data;
+       struct b53_device *dev = platform_get_drvdata(pdev);
 
        if (dev) {
-               pdev->dev.platform_data = dev->pdata;
                b53_switch_remove(dev);
        }