--- zzzz-none-000/linux-2.6.13.1/drivers/usb/core/hcd.c 2005-09-10 02:42:58.000000000 +0000 +++ ohio-7170-487/linux-2.6.13.1/drivers/usb/core/hcd.c 2006-02-22 16:35:22.000000000 +0000 @@ -748,14 +748,21 @@ { struct usb_bus *bus; - bus = kmalloc (sizeof *bus, GFP_KERNEL); + /* Bugfix for AHCI: WK 20060222: wrong struct size allocated*/ + /* bus = kmalloc (sizeof *bus, GFP_KERNEL); */ + bus = kmalloc (sizeof (struct usb_hcd), GFP_KERNEL); + if (!bus) return NULL; - memset(bus, 0, sizeof(struct usb_bus)); + /* Bugfix for AHCI: WK 20060222 */ + /* memset(bus, 0, sizeof(struct usb_bus)); */ + memset(bus, 0, sizeof (struct usb_hcd)); + usb_bus_init (bus); bus->op = op; return bus; } +EXPORT_SYMBOL(usb_alloc_bus); /* <<<< only for AHCI */ /*-------------------------------------------------------------------------*/ @@ -767,7 +774,7 @@ * Assigns a bus number, and links the controller into usbcore data * structures so that it can be seen by scanning the bus list. */ -static int usb_register_bus(struct usb_bus *bus) +int usb_register_bus(struct usb_bus *bus) { int busnum; @@ -801,6 +808,7 @@ dev_info (bus->controller, "new USB bus registered, assigned bus number %d\n", bus->busnum); return 0; } +EXPORT_SYMBOL(usb_register_bus); /* <<<< only for AHCI */ /** * usb_deregister_bus - deregisters the USB host controller @@ -810,7 +818,7 @@ * Recycles the bus number, and unlinks the controller from usbcore data * structures so that it won't be seen by scanning the bus list. */ -static void usb_deregister_bus (struct usb_bus *bus) +void usb_deregister_bus (struct usb_bus *bus) { dev_info (bus->controller, "USB bus %d deregistered\n", bus->busnum); @@ -830,6 +838,7 @@ class_device_unregister(bus->class_dev); } +EXPORT_SYMBOL(usb_deregister_bus); /* <<<< only for AHCI */ /** * register_root_hub - called by usb_add_hcd() to register a root hub @@ -896,9 +905,12 @@ struct usb_hcd *hcd; hcd = container_of (bus, struct usb_hcd, self); - if (hcd->driver->hub_irq_enable && !hcd->poll_rh && - hcd->state != HC_STATE_HALT) - hcd->driver->hub_irq_enable (hcd); + /* Patch for AHCI: WK 20060222*/ + if (hcd->driver != NULL) { + if (hcd->driver->hub_irq_enable && !hcd->poll_rh && + hcd->state != HC_STATE_HALT) + hcd->driver->hub_irq_enable (hcd); + } }