Commit 5e4ccd9e authored by Wonhong Kwon's avatar Wonhong Kwon Committed by Greg Kroah-Hartman

usb: ehci/ohci-platform: use SIMPLE_DEV_PM_OPS to support hibernation

ehci/ohci-platform just define .suspend/.resume functions for dev_pm_ops,
but in order to support both STR(suspend-to-ram) and hibernation, other
callbacks such as .freeze/.thaw are also required.

Registering all required callbacks for both STR and hibernation can
be done by SIMPLE_DEV_PM_OPS macro function.
Signed-off-by: default avatarWonhong Kwon <wonhong.kwon@lge.com>
Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a57971bf
...@@ -311,8 +311,7 @@ static int ehci_platform_remove(struct platform_device *dev) ...@@ -311,8 +311,7 @@ static int ehci_platform_remove(struct platform_device *dev)
return 0; return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP
static int ehci_platform_suspend(struct device *dev) static int ehci_platform_suspend(struct device *dev)
{ {
struct usb_hcd *hcd = dev_get_drvdata(dev); struct usb_hcd *hcd = dev_get_drvdata(dev);
...@@ -348,11 +347,7 @@ static int ehci_platform_resume(struct device *dev) ...@@ -348,11 +347,7 @@ static int ehci_platform_resume(struct device *dev)
ehci_resume(hcd, false); ehci_resume(hcd, false);
return 0; return 0;
} }
#endif /* CONFIG_PM_SLEEP */
#else /* !CONFIG_PM */
#define ehci_platform_suspend NULL
#define ehci_platform_resume NULL
#endif /* CONFIG_PM */
static const struct of_device_id vt8500_ehci_ids[] = { static const struct of_device_id vt8500_ehci_ids[] = {
{ .compatible = "via,vt8500-ehci", }, { .compatible = "via,vt8500-ehci", },
...@@ -368,10 +363,8 @@ static const struct platform_device_id ehci_platform_table[] = { ...@@ -368,10 +363,8 @@ static const struct platform_device_id ehci_platform_table[] = {
}; };
MODULE_DEVICE_TABLE(platform, ehci_platform_table); MODULE_DEVICE_TABLE(platform, ehci_platform_table);
static const struct dev_pm_ops ehci_platform_pm_ops = { static SIMPLE_DEV_PM_OPS(ehci_platform_pm_ops, ehci_platform_suspend,
.suspend = ehci_platform_suspend, ehci_platform_resume);
.resume = ehci_platform_resume,
};
static struct platform_driver ehci_platform_driver = { static struct platform_driver ehci_platform_driver = {
.id_table = ehci_platform_table, .id_table = ehci_platform_table,
......
...@@ -293,8 +293,7 @@ static int ohci_platform_remove(struct platform_device *dev) ...@@ -293,8 +293,7 @@ static int ohci_platform_remove(struct platform_device *dev)
return 0; return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP
static int ohci_platform_suspend(struct device *dev) static int ohci_platform_suspend(struct device *dev)
{ {
struct usb_hcd *hcd = dev_get_drvdata(dev); struct usb_hcd *hcd = dev_get_drvdata(dev);
...@@ -330,11 +329,7 @@ static int ohci_platform_resume(struct device *dev) ...@@ -330,11 +329,7 @@ static int ohci_platform_resume(struct device *dev)
ohci_resume(hcd, false); ohci_resume(hcd, false);
return 0; return 0;
} }
#endif /* CONFIG_PM_SLEEP */
#else /* !CONFIG_PM */
#define ohci_platform_suspend NULL
#define ohci_platform_resume NULL
#endif /* CONFIG_PM */
static const struct of_device_id ohci_platform_ids[] = { static const struct of_device_id ohci_platform_ids[] = {
{ .compatible = "generic-ohci", }, { .compatible = "generic-ohci", },
...@@ -348,10 +343,8 @@ static const struct platform_device_id ohci_platform_table[] = { ...@@ -348,10 +343,8 @@ static const struct platform_device_id ohci_platform_table[] = {
}; };
MODULE_DEVICE_TABLE(platform, ohci_platform_table); MODULE_DEVICE_TABLE(platform, ohci_platform_table);
static const struct dev_pm_ops ohci_platform_pm_ops = { static SIMPLE_DEV_PM_OPS(ohci_platform_pm_ops, ohci_platform_suspend,
.suspend = ohci_platform_suspend, ohci_platform_resume);
.resume = ohci_platform_resume,
};
static struct platform_driver ohci_platform_driver = { static struct platform_driver ohci_platform_driver = {
.id_table = ohci_platform_table, .id_table = ohci_platform_table,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment