diff options
author | Eric Miao <eric.miao@marvell.com> | 2009-01-31 17:47:44 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-03-25 02:38:24 +0300 |
commit | 71b3e0c1ad90f28e34c105069175cbd4edb43dfa (patch) | |
tree | af7f1dd890d10acc33e36a923d2604ff26dfb071 /drivers/base | |
parent | 49b420a13ff95b449947181190b08367348e3e1b (diff) | |
download | linux-71b3e0c1ad90f28e34c105069175cbd4edb43dfa.tar.xz |
platform: make better use of to_platform_{device,driver}() macros
This helps the code look more consistent and cleaner.
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/platform.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 349a1013603f..62a8768d96b3 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -603,9 +603,8 @@ static int platform_uevent(struct device *dev, struct kobj_uevent_env *env) */ static int platform_match(struct device *dev, struct device_driver *drv) { - struct platform_device *pdev; + struct platform_device *pdev = to_platform_device(dev); - pdev = container_of(dev, struct platform_device, dev); return (strcmp(pdev->name, drv->name) == 0); } @@ -623,26 +622,24 @@ static int platform_legacy_suspend(struct device *dev, pm_message_t mesg) static int platform_legacy_suspend_late(struct device *dev, pm_message_t mesg) { - struct platform_driver *drv = to_platform_driver(dev->driver); - struct platform_device *pdev; + struct platform_driver *pdrv = to_platform_driver(dev->driver); + struct platform_device *pdev = to_platform_device(dev); int ret = 0; - pdev = container_of(dev, struct platform_device, dev); - if (dev->driver && drv->suspend_late) - ret = drv->suspend_late(pdev, mesg); + if (dev->driver && pdrv->suspend_late) + ret = pdrv->suspend_late(pdev, mesg); return ret; } static int platform_legacy_resume_early(struct device *dev) { - struct platform_driver *drv = to_platform_driver(dev->driver); - struct platform_device *pdev; + struct platform_driver *pdrv = to_platform_driver(dev->driver); + struct platform_device *pdev = to_platform_device(dev); int ret = 0; - pdev = container_of(dev, struct platform_device, dev); - if (dev->driver && drv->resume_early) - ret = drv->resume_early(pdev); + if (dev->driver && pdrv->resume_early) + ret = pdrv->resume_early(pdev); return ret; } |