b53: use drvdata to store driver data

we should not abuse the platform_data pointer.

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


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@39354 3c298f89-4303-0410-b956-a3cf2f4a3e73
master
Hauke Mehrtens 2014-01-20 20:01:22 +00:00
parent 6bb0e2caf4
commit e6007e192a
3 changed files with 6 additions and 10 deletions

View 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);
}

View 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;

View 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);
}