[PATCH] mtd: maps: use platform_{get,set}_drvdata()
Jingoo Han
jg1.han at samsung.com
Thu May 23 06:30:11 EDT 2013
Use the wrapper functions for getting and setting the driver data using
platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev,
so we can directly pass a struct platform_device.
Signed-off-by: Jingoo Han <jg1.han at samsung.com>
---
drivers/mtd/maps/physmap_of.c | 5 ++---
drivers/mtd/maps/sun_uflash.c | 4 ++--
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index d111097..d7deda9 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -43,10 +43,9 @@ static int of_flash_remove(struct platform_device *dev)
struct of_flash *info;
int i;
- info = dev_get_drvdata(&dev->dev);
+ info = platform_get_drvdata(dev);
if (!info)
return 0;
- dev_set_drvdata(&dev->dev, NULL);
if (info->cmtd != info->list[0].mtd) {
mtd_device_unregister(info->cmtd);
@@ -204,7 +203,7 @@ static int of_flash_probe(struct platform_device *dev)
if (!info)
goto err_flash_remove;
- dev_set_drvdata(&dev->dev, info);
+ platform_set_drvdata(dev, info);
mtd_list = kzalloc(sizeof(*mtd_list) * count, GFP_KERNEL);
if (!mtd_list)
diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c
index d467f3b..1cd4037 100644
--- a/drivers/mtd/maps/sun_uflash.c
+++ b/drivers/mtd/maps/sun_uflash.c
@@ -103,7 +103,7 @@ int uflash_devinit(struct platform_device *op, struct device_node *dp)
mtd_device_register(up->mtd, NULL, 0);
- dev_set_drvdata(&op->dev, up);
+ platform_set_drvdata(op, up);
return 0;
}
@@ -123,7 +123,7 @@ static int uflash_probe(struct platform_device *op)
static int uflash_remove(struct platform_device *op)
{
- struct uflash_dev *up = dev_get_drvdata(&op->dev);
+ struct uflash_dev *up = platform_get_drvdata(op);
if (up->mtd) {
mtd_device_unregister(up->mtd);
--
1.7.10.4
More information about the linux-mtd
mailing list