aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/dummy_hcd.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2010-06-22 16:39:10 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-10 17:35:37 -0400
commit541c7d432f76771079e7c295d596ea47cc6a3030 (patch)
tree9e04330713366d21849cecf0f3fd2f2c1834574d /drivers/usb/gadget/dummy_hcd.c
parent89ba85d4015b7fa738b35bcc228075c117a9a578 (diff)
USB: convert usb_hcd bitfields into atomic flags
This patch (as1393) converts several of the single-bit fields in struct usb_hcd to atomic flags. This is for safety's sake; not all CPUs can update bitfield values atomically, and these flags are used in multiple contexts. The flag fields that are set only during registration or removal can remain as they are, since non-atomic accesses at those times will not cause any problems. (Strictly speaking, the authorized_default flag should become atomic as well. I didn't bother with it because it gets changed only via sysfs. It can be done later, if anyone wants.) Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/dummy_hcd.c')
-rw-r--r--drivers/usb/gadget/dummy_hcd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 4f9e578cde9d..dc6546248ed9 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -1542,7 +1542,7 @@ static int dummy_hub_status (struct usb_hcd *hcd, char *buf)
1542 dum = hcd_to_dummy (hcd); 1542 dum = hcd_to_dummy (hcd);
1543 1543
1544 spin_lock_irqsave (&dum->lock, flags); 1544 spin_lock_irqsave (&dum->lock, flags);
1545 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) 1545 if (!HCD_HW_ACCESSIBLE(hcd))
1546 goto done; 1546 goto done;
1547 1547
1548 if (dum->resuming && time_after_eq (jiffies, dum->re_timeout)) { 1548 if (dum->resuming && time_after_eq (jiffies, dum->re_timeout)) {
@@ -1588,7 +1588,7 @@ static int dummy_hub_control (
1588 int retval = 0; 1588 int retval = 0;
1589 unsigned long flags; 1589 unsigned long flags;
1590 1590
1591 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) 1591 if (!HCD_HW_ACCESSIBLE(hcd))
1592 return -ETIMEDOUT; 1592 return -ETIMEDOUT;
1593 1593
1594 dum = hcd_to_dummy (hcd); 1594 dum = hcd_to_dummy (hcd);
@@ -1739,7 +1739,7 @@ static int dummy_bus_resume (struct usb_hcd *hcd)
1739 dev_dbg (&hcd->self.root_hub->dev, "%s\n", __func__); 1739 dev_dbg (&hcd->self.root_hub->dev, "%s\n", __func__);
1740 1740
1741 spin_lock_irq (&dum->lock); 1741 spin_lock_irq (&dum->lock);
1742 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { 1742 if (!HCD_HW_ACCESSIBLE(hcd)) {
1743 rc = -ESHUTDOWN; 1743 rc = -ESHUTDOWN;
1744 } else { 1744 } else {
1745 dum->rh_state = DUMMY_RH_RUNNING; 1745 dum->rh_state = DUMMY_RH_RUNNING;