aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/i2c-core.c118
1 files changed, 0 insertions, 118 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 39d25a8cb1ad..393bb0e8c8f2 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -698,101 +698,6 @@ static void i2c_device_shutdown(struct device *dev)
698 driver->shutdown(client); 698 driver->shutdown(client);
699} 699}
700 700
701#ifdef CONFIG_PM_SLEEP
702static int i2c_legacy_suspend(struct device *dev, pm_message_t mesg)
703{
704 struct i2c_client *client = i2c_verify_client(dev);
705 struct i2c_driver *driver;
706
707 if (!client || !dev->driver)
708 return 0;
709 driver = to_i2c_driver(dev->driver);
710 if (!driver->suspend)
711 return 0;
712 return driver->suspend(client, mesg);
713}
714
715static int i2c_legacy_resume(struct device *dev)
716{
717 struct i2c_client *client = i2c_verify_client(dev);
718 struct i2c_driver *driver;
719
720 if (!client || !dev->driver)
721 return 0;
722 driver = to_i2c_driver(dev->driver);
723 if (!driver->resume)
724 return 0;
725 return driver->resume(client);
726}
727
728static int i2c_device_pm_suspend(struct device *dev)
729{
730 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
731
732 if (pm)
733 return pm_generic_suspend(dev);
734 else
735 return i2c_legacy_suspend(dev, PMSG_SUSPEND);
736}
737
738static int i2c_device_pm_resume(struct device *dev)
739{
740 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
741
742 if (pm)
743 return pm_generic_resume(dev);
744 else
745 return i2c_legacy_resume(dev);
746}
747
748static int i2c_device_pm_freeze(struct device *dev)
749{
750 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
751
752 if (pm)
753 return pm_generic_freeze(dev);
754 else
755 return i2c_legacy_suspend(dev, PMSG_FREEZE);
756}
757
758static int i2c_device_pm_thaw(struct device *dev)
759{
760 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
761
762 if (pm)
763 return pm_generic_thaw(dev);
764 else
765 return i2c_legacy_resume(dev);
766}
767
768static int i2c_device_pm_poweroff(struct device *dev)
769{
770 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
771
772 if (pm)
773 return pm_generic_poweroff(dev);
774 else
775 return i2c_legacy_suspend(dev, PMSG_HIBERNATE);
776}
777
778static int i2c_device_pm_restore(struct device *dev)
779{
780 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
781
782 if (pm)
783 return pm_generic_restore(dev);
784 else
785 return i2c_legacy_resume(dev);
786}
787#else /* !CONFIG_PM_SLEEP */
788#define i2c_device_pm_suspend NULL
789#define i2c_device_pm_resume NULL
790#define i2c_device_pm_freeze NULL
791#define i2c_device_pm_thaw NULL
792#define i2c_device_pm_poweroff NULL
793#define i2c_device_pm_restore NULL
794#endif /* !CONFIG_PM_SLEEP */
795
796static void i2c_client_dev_release(struct device *dev) 701static void i2c_client_dev_release(struct device *dev)
797{ 702{
798 kfree(to_i2c_client(dev)); 703 kfree(to_i2c_client(dev));
@@ -837,27 +742,12 @@ static const struct attribute_group *i2c_dev_attr_groups[] = {
837 NULL 742 NULL
838}; 743};
839 744
840static const struct dev_pm_ops i2c_device_pm_ops = {
841 .suspend = i2c_device_pm_suspend,
842 .resume = i2c_device_pm_resume,
843 .freeze = i2c_device_pm_freeze,
844 .thaw = i2c_device_pm_thaw,
845 .poweroff = i2c_device_pm_poweroff,
846 .restore = i2c_device_pm_restore,
847 SET_RUNTIME_PM_OPS(
848 pm_generic_runtime_suspend,
849 pm_generic_runtime_resume,
850 NULL
851 )
852};
853
854struct bus_type i2c_bus_type = { 745struct bus_type i2c_bus_type = {
855 .name = "i2c", 746 .name = "i2c",
856 .match = i2c_device_match, 747 .match = i2c_device_match,
857 .probe = i2c_device_probe, 748 .probe = i2c_device_probe,
858 .remove = i2c_device_remove, 749 .remove = i2c_device_remove,
859 .shutdown = i2c_device_shutdown, 750 .shutdown = i2c_device_shutdown,
860 .pm = &i2c_device_pm_ops,
861}; 751};
862EXPORT_SYMBOL_GPL(i2c_bus_type); 752EXPORT_SYMBOL_GPL(i2c_bus_type);
863 753
@@ -1859,14 +1749,6 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
1859 if (res) 1749 if (res)
1860 return res; 1750 return res;
1861 1751
1862 /* Drivers should switch to dev_pm_ops instead. */
1863 if (driver->suspend)
1864 pr_warn("i2c-core: driver [%s] using legacy suspend method\n",
1865 driver->driver.name);
1866 if (driver->resume)
1867 pr_warn("i2c-core: driver [%s] using legacy resume method\n",
1868 driver->driver.name);
1869
1870 pr_debug("i2c-core: driver [%s] registered\n", driver->driver.name); 1752 pr_debug("i2c-core: driver [%s] registered\n", driver->driver.name);
1871 1753
1872 INIT_LIST_HEAD(&driver->clients); 1754 INIT_LIST_HEAD(&driver->clients);