diff options
author | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2010-10-15 11:55:24 -0400 |
---|---|---|
committer | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2011-03-13 21:07:14 -0400 |
commit | d673bfcbfffdeb56064a6b1ee047b85590bed76c (patch) | |
tree | 50a4efa53b8ca6815ca25292136e7990425f0d36 /drivers/usb/core/message.c | |
parent | 23e0d1066f429ab44305e96fbff13f1793886277 (diff) |
usb: Change usb_hcd->bandwidth_mutex to a pointer.
Change the bandwith_mutex in struct usb_hcd to a pointer. This will allow
the pointer to be shared across usb_hcds for the upcoming work to split
the xHCI driver roothub into a USB 2.0/1.1 and a USB 3.0 bus.
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Diffstat (limited to 'drivers/usb/core/message.c')
-rw-r--r-- | drivers/usb/core/message.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 832487423826..5701e857392b 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -1284,12 +1284,12 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) | |||
1284 | /* Make sure we have enough bandwidth for this alternate interface. | 1284 | /* Make sure we have enough bandwidth for this alternate interface. |
1285 | * Remove the current alt setting and add the new alt setting. | 1285 | * Remove the current alt setting and add the new alt setting. |
1286 | */ | 1286 | */ |
1287 | mutex_lock(&hcd->bandwidth_mutex); | 1287 | mutex_lock(hcd->bandwidth_mutex); |
1288 | ret = usb_hcd_alloc_bandwidth(dev, NULL, iface->cur_altsetting, alt); | 1288 | ret = usb_hcd_alloc_bandwidth(dev, NULL, iface->cur_altsetting, alt); |
1289 | if (ret < 0) { | 1289 | if (ret < 0) { |
1290 | dev_info(&dev->dev, "Not enough bandwidth for altsetting %d\n", | 1290 | dev_info(&dev->dev, "Not enough bandwidth for altsetting %d\n", |
1291 | alternate); | 1291 | alternate); |
1292 | mutex_unlock(&hcd->bandwidth_mutex); | 1292 | mutex_unlock(hcd->bandwidth_mutex); |
1293 | return ret; | 1293 | return ret; |
1294 | } | 1294 | } |
1295 | 1295 | ||
@@ -1311,10 +1311,10 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) | |||
1311 | } else if (ret < 0) { | 1311 | } else if (ret < 0) { |
1312 | /* Re-instate the old alt setting */ | 1312 | /* Re-instate the old alt setting */ |
1313 | usb_hcd_alloc_bandwidth(dev, NULL, alt, iface->cur_altsetting); | 1313 | usb_hcd_alloc_bandwidth(dev, NULL, alt, iface->cur_altsetting); |
1314 | mutex_unlock(&hcd->bandwidth_mutex); | 1314 | mutex_unlock(hcd->bandwidth_mutex); |
1315 | return ret; | 1315 | return ret; |
1316 | } | 1316 | } |
1317 | mutex_unlock(&hcd->bandwidth_mutex); | 1317 | mutex_unlock(hcd->bandwidth_mutex); |
1318 | 1318 | ||
1319 | /* FIXME drivers shouldn't need to replicate/bugfix the logic here | 1319 | /* FIXME drivers shouldn't need to replicate/bugfix the logic here |
1320 | * when they implement async or easily-killable versions of this or | 1320 | * when they implement async or easily-killable versions of this or |
@@ -1413,7 +1413,7 @@ int usb_reset_configuration(struct usb_device *dev) | |||
1413 | 1413 | ||
1414 | config = dev->actconfig; | 1414 | config = dev->actconfig; |
1415 | retval = 0; | 1415 | retval = 0; |
1416 | mutex_lock(&hcd->bandwidth_mutex); | 1416 | mutex_lock(hcd->bandwidth_mutex); |
1417 | /* Make sure we have enough bandwidth for each alternate setting 0 */ | 1417 | /* Make sure we have enough bandwidth for each alternate setting 0 */ |
1418 | for (i = 0; i < config->desc.bNumInterfaces; i++) { | 1418 | for (i = 0; i < config->desc.bNumInterfaces; i++) { |
1419 | struct usb_interface *intf = config->interface[i]; | 1419 | struct usb_interface *intf = config->interface[i]; |
@@ -1442,7 +1442,7 @@ reset_old_alts: | |||
1442 | usb_hcd_alloc_bandwidth(dev, NULL, | 1442 | usb_hcd_alloc_bandwidth(dev, NULL, |
1443 | alt, intf->cur_altsetting); | 1443 | alt, intf->cur_altsetting); |
1444 | } | 1444 | } |
1445 | mutex_unlock(&hcd->bandwidth_mutex); | 1445 | mutex_unlock(hcd->bandwidth_mutex); |
1446 | return retval; | 1446 | return retval; |
1447 | } | 1447 | } |
1448 | retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 1448 | retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
@@ -1451,7 +1451,7 @@ reset_old_alts: | |||
1451 | NULL, 0, USB_CTRL_SET_TIMEOUT); | 1451 | NULL, 0, USB_CTRL_SET_TIMEOUT); |
1452 | if (retval < 0) | 1452 | if (retval < 0) |
1453 | goto reset_old_alts; | 1453 | goto reset_old_alts; |
1454 | mutex_unlock(&hcd->bandwidth_mutex); | 1454 | mutex_unlock(hcd->bandwidth_mutex); |
1455 | 1455 | ||
1456 | /* re-init hc/hcd interface/endpoint state */ | 1456 | /* re-init hc/hcd interface/endpoint state */ |
1457 | for (i = 0; i < config->desc.bNumInterfaces; i++) { | 1457 | for (i = 0; i < config->desc.bNumInterfaces; i++) { |
@@ -1739,10 +1739,10 @@ free_interfaces: | |||
1739 | * host controller will not allow submissions to dropped endpoints. If | 1739 | * host controller will not allow submissions to dropped endpoints. If |
1740 | * this call fails, the device state is unchanged. | 1740 | * this call fails, the device state is unchanged. |
1741 | */ | 1741 | */ |
1742 | mutex_lock(&hcd->bandwidth_mutex); | 1742 | mutex_lock(hcd->bandwidth_mutex); |
1743 | ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); | 1743 | ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); |
1744 | if (ret < 0) { | 1744 | if (ret < 0) { |
1745 | mutex_unlock(&hcd->bandwidth_mutex); | 1745 | mutex_unlock(hcd->bandwidth_mutex); |
1746 | usb_autosuspend_device(dev); | 1746 | usb_autosuspend_device(dev); |
1747 | goto free_interfaces; | 1747 | goto free_interfaces; |
1748 | } | 1748 | } |
@@ -1761,11 +1761,11 @@ free_interfaces: | |||
1761 | if (!cp) { | 1761 | if (!cp) { |
1762 | usb_set_device_state(dev, USB_STATE_ADDRESS); | 1762 | usb_set_device_state(dev, USB_STATE_ADDRESS); |
1763 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); | 1763 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); |
1764 | mutex_unlock(&hcd->bandwidth_mutex); | 1764 | mutex_unlock(hcd->bandwidth_mutex); |
1765 | usb_autosuspend_device(dev); | 1765 | usb_autosuspend_device(dev); |
1766 | goto free_interfaces; | 1766 | goto free_interfaces; |
1767 | } | 1767 | } |
1768 | mutex_unlock(&hcd->bandwidth_mutex); | 1768 | mutex_unlock(hcd->bandwidth_mutex); |
1769 | usb_set_device_state(dev, USB_STATE_CONFIGURED); | 1769 | usb_set_device_state(dev, USB_STATE_CONFIGURED); |
1770 | 1770 | ||
1771 | /* Initialize the new interface structures and the | 1771 | /* Initialize the new interface structures and the |