2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-25 13:43:55 +08:00

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>
This commit is contained in:
Sebastian Andrzej Siewior 2011-06-17 19:43:13 +02:00 committed by Greg Kroah-Hartman
parent 4baa74fe32
commit fc0b721f27

View File

@ -1030,18 +1030,22 @@ static int dummy_udc_remove (struct platform_device *pdev)
return 0;
}
static void dummy_udc_pm(struct dummy *dum, struct dummy_hcd *dum_hcd,
int suspend)
{
spin_lock_irq(&dum->lock);
dum->udc_suspended = suspend;
set_link_state(dum_hcd);
spin_unlock_irq(&dum->lock);
}
static int dummy_udc_suspend(struct platform_device *pdev, pm_message_t state)
{
struct dummy *dum = platform_get_drvdata(pdev);
struct dummy_hcd *dum_hcd;
struct dummy_hcd *dum_hcd = gadget_to_dummy_hcd(&dum->gadget);
dev_dbg(&pdev->dev, "%s\n", __func__);
dum_hcd = gadget_to_dummy_hcd(&dum->gadget);
spin_lock_irq (&dum->lock);
dum->udc_suspended = 1;
set_link_state(dum_hcd);
spin_unlock_irq (&dum->lock);
dummy_udc_pm(dum, dum_hcd, 1);
usb_hcd_poll_rh_status(dummy_hcd_to_hcd(dum_hcd));
return 0;
}
@ -1049,15 +1053,10 @@ static int dummy_udc_suspend (struct platform_device *pdev, pm_message_t state)
static int dummy_udc_resume(struct platform_device *pdev)
{
struct dummy *dum = platform_get_drvdata(pdev);
struct dummy_hcd *dum_hcd;
struct dummy_hcd *dum_hcd = gadget_to_dummy_hcd(&dum->gadget);
dev_dbg(&pdev->dev, "%s\n", __func__);
dum_hcd = gadget_to_dummy_hcd(&dum->gadget);
spin_lock_irq (&dum->lock);
dum->udc_suspended = 0;
set_link_state(dum_hcd);
spin_unlock_irq (&dum->lock);
dummy_udc_pm(dum, dum_hcd, 0);
usb_hcd_poll_rh_status(dummy_hcd_to_hcd(dum_hcd));
return 0;
}