diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-01-21 11:36:30 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-02-18 18:15:42 -0500 |
commit | 5a09b7120a965a7d7e8494d0ed509135bbce0118 (patch) | |
tree | ad2893b2ab904ffa56226a7a133b262b2f8d17eb /drivers/mfd/ucb1x00-core.c | |
parent | a4b54acf9e691a3051950444d33980741e7d63a8 (diff) |
MFD: ucb1x00-core: convert to use dev_pm_ops
Convert the ucb1x00-core driver to use dev_pm_ops rather than the legacy
members in the mcp driver.
Acked-by: Jochen Friedrich <jochen@scram.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/mfd/ucb1x00-core.c')
-rw-r--r-- | drivers/mfd/ucb1x00-core.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c index ed2a4b2e518f..6fab82557543 100644 --- a/drivers/mfd/ucb1x00-core.c +++ b/drivers/mfd/ucb1x00-core.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/device.h> | 26 | #include <linux/device.h> |
27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
28 | #include <linux/mfd/ucb1x00.h> | 28 | #include <linux/mfd/ucb1x00.h> |
29 | #include <linux/pm.h> | ||
29 | #include <linux/gpio.h> | 30 | #include <linux/gpio.h> |
30 | 31 | ||
31 | static DEFINE_MUTEX(ucb1x00_mutex); | 32 | static DEFINE_MUTEX(ucb1x00_mutex); |
@@ -697,47 +698,50 @@ void ucb1x00_unregister_driver(struct ucb1x00_driver *drv) | |||
697 | mutex_unlock(&ucb1x00_mutex); | 698 | mutex_unlock(&ucb1x00_mutex); |
698 | } | 699 | } |
699 | 700 | ||
700 | static int ucb1x00_suspend(struct mcp *mcp, pm_message_t state) | 701 | static int ucb1x00_suspend(struct device *dev) |
701 | { | 702 | { |
702 | struct ucb1x00 *ucb = mcp_get_drvdata(mcp); | 703 | struct ucb1x00 *ucb = dev_get_drvdata(dev); |
703 | struct ucb1x00_dev *dev; | 704 | struct ucb1x00_dev *udev; |
704 | 705 | ||
705 | mutex_lock(&ucb1x00_mutex); | 706 | mutex_lock(&ucb1x00_mutex); |
706 | list_for_each_entry(dev, &ucb->devs, dev_node) { | 707 | list_for_each_entry(udev, &ucb->devs, dev_node) { |
707 | if (dev->drv->suspend) | 708 | if (udev->drv->suspend) |
708 | dev->drv->suspend(dev, state); | 709 | udev->drv->suspend(udev); |
709 | } | 710 | } |
710 | mutex_unlock(&ucb1x00_mutex); | 711 | mutex_unlock(&ucb1x00_mutex); |
711 | return 0; | 712 | return 0; |
712 | } | 713 | } |
713 | 714 | ||
714 | static int ucb1x00_resume(struct mcp *mcp) | 715 | static int ucb1x00_resume(struct device *dev) |
715 | { | 716 | { |
716 | struct ucb1x00 *ucb = mcp_get_drvdata(mcp); | 717 | struct ucb1x00 *ucb = dev_get_drvdata(dev); |
717 | struct ucb1x00_dev *dev; | 718 | struct ucb1x00_dev *udev; |
718 | 719 | ||
719 | ucb1x00_enable(ucb); | 720 | ucb1x00_enable(ucb); |
720 | ucb1x00_reg_write(ucb, UCB_IO_DATA, ucb->io_out); | 721 | ucb1x00_reg_write(ucb, UCB_IO_DATA, ucb->io_out); |
721 | ucb1x00_reg_write(ucb, UCB_IO_DIR, ucb->io_dir); | 722 | ucb1x00_reg_write(ucb, UCB_IO_DIR, ucb->io_dir); |
722 | ucb1x00_disable(ucb); | 723 | ucb1x00_disable(ucb); |
723 | mutex_lock(&ucb1x00_mutex); | 724 | mutex_lock(&ucb1x00_mutex); |
724 | list_for_each_entry(dev, &ucb->devs, dev_node) { | 725 | list_for_each_entry(udev, &ucb->devs, dev_node) { |
725 | if (dev->drv->resume) | 726 | if (udev->drv->resume) |
726 | dev->drv->resume(dev); | 727 | udev->drv->resume(udev); |
727 | } | 728 | } |
728 | mutex_unlock(&ucb1x00_mutex); | 729 | mutex_unlock(&ucb1x00_mutex); |
729 | return 0; | 730 | return 0; |
730 | } | 731 | } |
731 | 732 | ||
733 | static const struct dev_pm_ops ucb1x00_pm_ops = { | ||
734 | SET_SYSTEM_SLEEP_PM_OPS(ucb1x00_suspend, ucb1x00_resume) | ||
735 | }; | ||
736 | |||
732 | static struct mcp_driver ucb1x00_driver = { | 737 | static struct mcp_driver ucb1x00_driver = { |
733 | .drv = { | 738 | .drv = { |
734 | .name = "ucb1x00", | 739 | .name = "ucb1x00", |
735 | .owner = THIS_MODULE, | 740 | .owner = THIS_MODULE, |
741 | .pm = &ucb1x00_pm_ops, | ||
736 | }, | 742 | }, |
737 | .probe = ucb1x00_probe, | 743 | .probe = ucb1x00_probe, |
738 | .remove = ucb1x00_remove, | 744 | .remove = ucb1x00_remove, |
739 | .suspend = ucb1x00_suspend, | ||
740 | .resume = ucb1x00_resume, | ||
741 | }; | 745 | }; |
742 | 746 | ||
743 | static int __init ucb1x00_init(void) | 747 | static int __init ucb1x00_init(void) |