Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 15477
b: refs/heads/master
c: 3cf0a22
h: refs/heads/master
i:
  15475: f7e61bc
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Jan 4, 2006
1 parent 448143b commit 09950f1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a21d4fed4b00eaf7e7c3b2e2b25de24f540bfa66
refs/heads/master: 3cf0a22e8b1b3f44288db773d315e72e89d51c4c
43 changes: 31 additions & 12 deletions trunk/drivers/usb/gadget/dummy_hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1576,7 +1576,7 @@ static int dummy_hub_status (struct usb_hcd *hcd, char *buf)
dum = hcd_to_dummy (hcd);

spin_lock_irqsave (&dum->lock, flags);
if (hcd->state != HC_STATE_RUNNING)
if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))
goto done;

if (dum->resuming && time_after_eq (jiffies, dum->re_timeout)) {
Expand Down Expand Up @@ -1623,7 +1623,7 @@ static int dummy_hub_control (
int retval = 0;
unsigned long flags;

if (hcd->state != HC_STATE_RUNNING)
if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))
return -ETIMEDOUT;

dum = hcd_to_dummy (hcd);
Expand Down Expand Up @@ -1756,24 +1756,36 @@ static int dummy_bus_suspend (struct usb_hcd *hcd)
{
struct dummy *dum = hcd_to_dummy (hcd);

dev_dbg (&hcd->self.root_hub->dev, "%s\n", __FUNCTION__);

spin_lock_irq (&dum->lock);
dum->rh_state = DUMMY_RH_SUSPENDED;
set_link_state (dum);
hcd->state = HC_STATE_SUSPENDED;
spin_unlock_irq (&dum->lock);
return 0;
}

static int dummy_bus_resume (struct usb_hcd *hcd)
{
struct dummy *dum = hcd_to_dummy (hcd);
int rc = 0;

dev_dbg (&hcd->self.root_hub->dev, "%s\n", __FUNCTION__);

spin_lock_irq (&dum->lock);
dum->rh_state = DUMMY_RH_RUNNING;
set_link_state (dum);
if (!list_empty(&dum->urbp_list))
mod_timer (&dum->timer, jiffies);
if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) {
dev_warn (&hcd->self.root_hub->dev, "HC isn't running!\n");
rc = -ENODEV;
} else {
dum->rh_state = DUMMY_RH_RUNNING;
set_link_state (dum);
if (!list_empty(&dum->urbp_list))
mod_timer (&dum->timer, jiffies);
hcd->state = HC_STATE_RUNNING;
}
spin_unlock_irq (&dum->lock);
return 0;
return rc;
}

/*-------------------------------------------------------------------------*/
Expand Down Expand Up @@ -1933,22 +1945,29 @@ static int dummy_hcd_remove (struct platform_device *pdev)
static int dummy_hcd_suspend (struct platform_device *pdev, pm_message_t state)
{
struct usb_hcd *hcd;
struct dummy *dum;
int rc = 0;

dev_dbg (&pdev->dev, "%s\n", __FUNCTION__);
hcd = platform_get_drvdata (pdev);

hcd->state = HC_STATE_SUSPENDED;
return 0;
hcd = platform_get_drvdata (pdev);
dum = hcd_to_dummy (hcd);
if (dum->rh_state == DUMMY_RH_RUNNING) {
dev_warn(&pdev->dev, "Root hub isn't suspended!\n");
rc = -EBUSY;
} else
clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
return rc;
}

static int dummy_hcd_resume (struct platform_device *pdev)
{
struct usb_hcd *hcd;

dev_dbg (&pdev->dev, "%s\n", __FUNCTION__);
hcd = platform_get_drvdata (pdev);
hcd->state = HC_STATE_RUNNING;

hcd = platform_get_drvdata (pdev);
set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
usb_hcd_poll_rh_status (hcd);
return 0;
}
Expand Down

0 comments on commit 09950f1

Please sign in to comment.