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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
89ba85d401
commit
541c7d432f
@ -190,7 +190,7 @@ static int uhci_hub_status_data(struct usb_hcd *hcd, char *buf)
|
||||
spin_lock_irqsave(&uhci->lock, flags);
|
||||
|
||||
uhci_scan_schedule(uhci);
|
||||
if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags) || uhci->dead)
|
||||
if (!HCD_HW_ACCESSIBLE(hcd) || uhci->dead)
|
||||
goto done;
|
||||
uhci_check_ports(uhci);
|
||||
|
||||
@ -246,7 +246,7 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
|
||||
u16 wPortChange, wPortStatus;
|
||||
unsigned long flags;
|
||||
|
||||
if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags) || uhci->dead)
|
||||
if (!HCD_HW_ACCESSIBLE(hcd) || uhci->dead)
|
||||
return -ETIMEDOUT;
|
||||
|
||||
spin_lock_irqsave(&uhci->lock, flags);
|
||||
|
Reference in New Issue
Block a user