aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2011-06-17 13:43:13 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-07-01 17:31:09 -0400
commitfc0b721f27beb5464d9fb5e521f5cd68127dd14e (patch)
tree1aed52fe517cd666d05d22fe5c6d6d5cb922ed40 /drivers/usb
parent4baa74fe32f330d464d59a00d01980fd16a15ecc (diff)
usb: gadget: dummy_hcd: move common bits of suspend/resume into one function
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/dummy_hcd.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 6d189e1b5710..1916360072ad 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -1030,34 +1030,33 @@ static int dummy_udc_remove (struct platform_device *pdev)
1030 return 0; 1030 return 0;
1031} 1031}
1032 1032
1033static int dummy_udc_suspend (struct platform_device *pdev, pm_message_t state) 1033static void dummy_udc_pm(struct dummy *dum, struct dummy_hcd *dum_hcd,
1034 int suspend)
1034{ 1035{
1035 struct dummy *dum = platform_get_drvdata(pdev); 1036 spin_lock_irq(&dum->lock);
1036 struct dummy_hcd *dum_hcd; 1037 dum->udc_suspended = suspend;
1037
1038 dev_dbg (&pdev->dev, "%s\n", __func__);
1039 dum_hcd = gadget_to_dummy_hcd(&dum->gadget);
1040 spin_lock_irq (&dum->lock);
1041 dum->udc_suspended = 1;
1042 set_link_state(dum_hcd); 1038 set_link_state(dum_hcd);
1043 spin_unlock_irq (&dum->lock); 1039 spin_unlock_irq(&dum->lock);
1040}
1041
1042static int dummy_udc_suspend(struct platform_device *pdev, pm_message_t state)
1043{
1044 struct dummy *dum = platform_get_drvdata(pdev);
1045 struct dummy_hcd *dum_hcd = gadget_to_dummy_hcd(&dum->gadget);
1044 1046
1047 dev_dbg(&pdev->dev, "%s\n", __func__);
1048 dummy_udc_pm(dum, dum_hcd, 1);
1045 usb_hcd_poll_rh_status(dummy_hcd_to_hcd(dum_hcd)); 1049 usb_hcd_poll_rh_status(dummy_hcd_to_hcd(dum_hcd));
1046 return 0; 1050 return 0;
1047} 1051}
1048 1052
1049static int dummy_udc_resume (struct platform_device *pdev) 1053static int dummy_udc_resume(struct platform_device *pdev)
1050{ 1054{
1051 struct dummy *dum = platform_get_drvdata(pdev); 1055 struct dummy *dum = platform_get_drvdata(pdev);
1052 struct dummy_hcd *dum_hcd; 1056 struct dummy_hcd *dum_hcd = gadget_to_dummy_hcd(&dum->gadget);
1053
1054 dev_dbg (&pdev->dev, "%s\n", __func__);
1055 dum_hcd = gadget_to_dummy_hcd(&dum->gadget);
1056 spin_lock_irq (&dum->lock);
1057 dum->udc_suspended = 0;
1058 set_link_state(dum_hcd);
1059 spin_unlock_irq (&dum->lock);
1060 1057
1058 dev_dbg(&pdev->dev, "%s\n", __func__);
1059 dummy_udc_pm(dum, dum_hcd, 0);
1061 usb_hcd_poll_rh_status(dummy_hcd_to_hcd(dum_hcd)); 1060 usb_hcd_poll_rh_status(dummy_hcd_to_hcd(dum_hcd));
1062 return 0; 1061 return 0;
1063} 1062}