aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorEric Miao <eric.miao@marvell.com>2009-01-31 09:47:44 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-03-24 19:38:24 -0400
commit71b3e0c1ad90f28e34c105069175cbd4edb43dfa (patch)
treeaf7f1dd890d10acc33e36a923d2604ff26dfb071 /drivers/base
parent49b420a13ff95b449947181190b08367348e3e1b (diff)
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.c21
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)
603 */ 603 */
604static int platform_match(struct device *dev, struct device_driver *drv) 604static int platform_match(struct device *dev, struct device_driver *drv)
605{ 605{
606 struct platform_device *pdev; 606 struct platform_device *pdev = to_platform_device(dev);
607 607
608 pdev = container_of(dev, struct platform_device, dev);
609 return (strcmp(pdev->name, drv->name) == 0); 608 return (strcmp(pdev->name, drv->name) == 0);
610} 609}
611 610
@@ -623,26 +622,24 @@ static int platform_legacy_suspend(struct device *dev, pm_message_t mesg)
623 622
624static int platform_legacy_suspend_late(struct device *dev, pm_message_t mesg) 623static int platform_legacy_suspend_late(struct device *dev, pm_message_t mesg)
625{ 624{
626 struct platform_driver *drv = to_platform_driver(dev->driver); 625 struct platform_driver *pdrv = to_platform_driver(dev->driver);
627 struct platform_device *pdev; 626 struct platform_device *pdev = to_platform_device(dev);
628 int ret = 0; 627 int ret = 0;
629 628
630 pdev = container_of(dev, struct platform_device, dev); 629 if (dev->driver && pdrv->suspend_late)
631 if (dev->driver && drv->suspend_late) 630 ret = pdrv->suspend_late(pdev, mesg);
632 ret = drv->suspend_late(pdev, mesg);
633 631
634 return ret; 632 return ret;
635} 633}
636 634
637static int platform_legacy_resume_early(struct device *dev) 635static int platform_legacy_resume_early(struct device *dev)
638{ 636{
639 struct platform_driver *drv = to_platform_driver(dev->driver); 637 struct platform_driver *pdrv = to_platform_driver(dev->driver);
640 struct platform_device *pdev; 638 struct platform_device *pdev = to_platform_device(dev);
641 int ret = 0; 639 int ret = 0;
642 640
643 pdev = container_of(dev, struct platform_device, dev); 641 if (dev->driver && pdrv->resume_early)
644 if (dev->driver && drv->resume_early) 642 ret = pdrv->resume_early(pdev);
645 ret = drv->resume_early(pdev);
646 643
647 return ret; 644 return ret;
648} 645}