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>
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 40c7a46..3ba2711 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2191,6 +2191,15 @@
dev_dbg (dev, "hcd alloc failed\n");
return NULL;
}
+ hcd->bandwidth_mutex = kmalloc(sizeof(*hcd->bandwidth_mutex),
+ GFP_KERNEL);
+ if (!hcd->bandwidth_mutex) {
+ kfree(hcd);
+ dev_dbg(dev, "hcd bandwidth mutex alloc failed\n");
+ return NULL;
+ }
+ mutex_init(hcd->bandwidth_mutex);
+
dev_set_drvdata(dev, hcd);
kref_init(&hcd->kref);
@@ -2205,7 +2214,6 @@
#ifdef CONFIG_USB_SUSPEND
INIT_WORK(&hcd->wakeup_work, hcd_resume_work);
#endif
- mutex_init(&hcd->bandwidth_mutex);
hcd->driver = driver;
hcd->product_desc = (driver->product_desc) ? driver->product_desc :
@@ -2218,6 +2226,7 @@
{
struct usb_hcd *hcd = container_of (kref, struct usb_hcd, kref);
+ kfree(hcd->bandwidth_mutex);
kfree(hcd);
}