Every little bit of code shrinkage helps ... :)

This removes the code supporting usb_device->hcpriv allocation/deallocation,
and hcd_dev-dev_list, from usbcore and the HCDs.

Signed-off-by: David Brownell <[EMAIL PROTECTED]>

--- epmax/drivers/usb/core/hcd.c	2004-11-27 23:29:53.000000000 -0800
+++ amd64/drivers/usb/core/hcd.c	2004-11-25 18:21:39.000000000 -0800
@@ -1018,40 +1018,6 @@
 
 /*-------------------------------------------------------------------------*/
 
-/* called from khubd, or root hub init threads for hcd-private init */
-static int hcd_alloc_dev (struct usb_device *udev)
-{
-	struct hcd_dev		*dev;
-	struct usb_hcd		*hcd;
-	unsigned long		flags;
-
-	if (!udev || udev->hcpriv)
-		return -EINVAL;
-	if (!udev->bus || !udev->bus->hcpriv)
-		return -ENODEV;
-	hcd = udev->bus->hcpriv;
-	if (hcd->state == USB_STATE_QUIESCING)
-		return -ENOLINK;
-
-	dev = (struct hcd_dev *) kmalloc (sizeof *dev, GFP_KERNEL);
-	if (dev == NULL)
-		return -ENOMEM;
-	memset (dev, 0, sizeof *dev);
-
-	INIT_LIST_HEAD (&dev->dev_list);
-	INIT_LIST_HEAD (&dev->urb_list);
-
-	spin_lock_irqsave (&hcd_data_lock, flags);
-	list_add (&dev->dev_list, &hcd->dev_list);
-	// refcount is implicit
-	udev->hcpriv = dev;
-	spin_unlock_irqrestore (&hcd_data_lock, flags);
-
-	return 0;
-}
-
-/*-------------------------------------------------------------------------*/
-
 static void urb_unlink (struct urb *urb)
 {
 	unsigned long		flags;
@@ -1464,44 +1426,6 @@
 
 /*-------------------------------------------------------------------------*/
 
-/* called by khubd, rmmod, apmd, or other thread for hcd-private cleanup.
- * we're guaranteed that the device is fully quiesced.  also, that each
- * endpoint has been hcd_endpoint_disabled.
- */
-
-static int hcd_free_dev (struct usb_device *udev)
-{
-	struct hcd_dev		*dev;
-	struct usb_hcd		*hcd;
-	unsigned long		flags;
-
-	if (!udev || !udev->hcpriv)
-		return -EINVAL;
-
-	if (!udev->bus || !udev->bus->hcpriv)
-		return -ENODEV;
-
-	// should udev->devnum == -1 ??
-
-	dev = udev->hcpriv;
-	hcd = udev->bus->hcpriv;
-
-	/* device driver problem with refcounts? */
-	if (!list_empty (&dev->urb_list)) {
-		dev_dbg (hcd->self.controller, "free busy dev, %s devnum %d (bug!)\n",
-			hcd->self.bus_name, udev->devnum);
-		return -EINVAL;
-	}
-
-	spin_lock_irqsave (&hcd_data_lock, flags);
-	list_del (&dev->dev_list);
-	udev->hcpriv = NULL;
-	spin_unlock_irqrestore (&hcd_data_lock, flags);
-
-	kfree (dev);
-	return 0;
-}
-
 /*
  * usb_hcd_operations - adapts usb_bus framework to HCD framework (bus glue)
  *
@@ -1510,11 +1434,9 @@
  * bus glue for non-PCI system busses will need to use this.
  */
 struct usb_operations usb_hcd_operations = {
-	.allocate =		hcd_alloc_dev,
 	.get_frame_number =	hcd_get_frame_number,
 	.submit_urb =		hcd_submit_urb,
 	.unlink_urb =		hcd_unlink_urb,
-	.deallocate =		hcd_free_dev,
 	.buffer_alloc =		hcd_buffer_alloc,
 	.buffer_free =		hcd_buffer_free,
 	.disable =		hcd_endpoint_disable,
--- epmax/drivers/usb/core/hcd-pci.c	2004-11-27 23:06:08.000000000 -0800
+++ amd64/drivers/usb/core/hcd-pci.c	2004-11-23 15:58:24.000000000 -0800
@@ -195,8 +195,6 @@
 	hcd->self.hcpriv = (void *) hcd;
 	init_timer (&hcd->rh_timer);
 
-	INIT_LIST_HEAD (&hcd->dev_list);
-
 	usb_register_bus (&hcd->self);
 
 	if ((retval = driver->start (hcd)) < 0) {
--- epmax/drivers/usb/core/usb.c	2004-11-27 23:25:45.000000000 -0800
+++ amd64/drivers/usb/core/usb.c	2004-11-27 21:40:33.000000000 -0800
@@ -646,8 +646,6 @@
 
 	udev = to_usb_device(dev);
 
-	if (udev->bus && udev->bus->op && udev->bus->op->deallocate)
-		udev->bus->op->deallocate(udev);
 	usb_destroy_configuration(udev);
 	usb_bus_put(udev->bus);
 	kfree (udev);
@@ -730,13 +729,6 @@
 
 	init_MUTEX(&dev->serialize);
 
-	if (dev->bus->op->allocate)
-		if (dev->bus->op->allocate(dev)) {
-			usb_bus_put(bus);
-			kfree(dev);
-			return NULL;
-		}
-
 	return dev;
 }
 
--- epmax/drivers/usb/host/ohci-lh7a404.c	2004-11-27 23:06:09.000000000 -0800
+++ amd64/drivers/usb/host/ohci-lh7a404.c	2004-11-23 15:58:24.000000000 -0800
@@ -151,8 +151,6 @@
 	hcd->self.bus_name = "lh7a404";
 	hcd->product_desc = "LH7A404 OHCI";
 
-	INIT_LIST_HEAD (&hcd->dev_list);
-
 	usb_register_bus (&hcd->self);
 
 	if ((retval = driver->start (hcd)) < 0)
--- epmax/drivers/usb/host/ohci-omap.c	2004-11-27 23:06:09.000000000 -0800
+++ amd64/drivers/usb/host/ohci-omap.c	2004-11-24 14:11:42.000000000 -0800
@@ -335,7 +335,6 @@
 	hcd->self.bus_name = pdev->dev.bus_id;
 	hcd->product_desc = "OMAP OHCI";
 
-	INIT_LIST_HEAD (&hcd->dev_list);
 	usb_register_bus (&hcd->self);
 
 	if ((retval = driver->start (hcd)) < 0) 
--- epmax/drivers/usb/host/ohci-pxa27x.c	2004-11-27 23:06:09.000000000 -0800
+++ amd64/drivers/usb/host/ohci-pxa27x.c	2004-11-23 15:58:24.000000000 -0800
@@ -249,8 +249,6 @@
 	hcd->self.bus_name = "pxa27x";
 	hcd->product_desc = "PXA27x OHCI";
 
-	INIT_LIST_HEAD (&hcd->dev_list);
-
 	usb_register_bus (&hcd->self);
 
 	if ((retval = driver->start (hcd)) < 0) {
--- epmax/drivers/usb/host/ohci-sa1111.c	2004-11-27 23:06:09.000000000 -0800
+++ amd64/drivers/usb/host/ohci-sa1111.c	2004-11-23 15:58:24.000000000 -0800
@@ -199,8 +199,6 @@
 	hcd->self.bus_name = "sa1111";
 	hcd->product_desc = "SA-1111 OHCI";
 
-	INIT_LIST_HEAD (&hcd->dev_list);
-
 	usb_register_bus (&hcd->self);
 
 	if ((retval = driver->start (hcd)) < 0) 

Reply via email to