static void tusb_exit_module(void) { kfree(ltp_usb.dev); #if 0 usb_free_bus(ltp_usb.bus); #endif unregister_chrdev(Major, DEVICE_NAME); usb_deregister(&test_usb_driver); }
int usb_find_busses(void) { struct usb_bus *busses, *bus; int ret, changes = 0; ret = usb_os_find_busses(&busses); if (ret < 0) return ret; /* * Now walk through all of the busses we know about and compare against * this new list. Any duplicates will be removed from the new list. * If we don't find it in the new list, the bus was removed. Any * busses still in the new list, are new to us. */ bus = usb_busses; while (bus) { int found = 0; struct usb_bus *nbus, *tbus = bus->next; nbus = busses; while (nbus) { struct usb_bus *tnbus = nbus->next; if (!strcmp(bus->dirname, nbus->dirname)) { /* Remove it from the new busses list */ LIST_DEL(busses, nbus); usb_free_bus(nbus); found = 1; break; } nbus = tnbus; } if (!found) { /* The bus was removed from the system */ LIST_DEL(usb_busses, bus); usb_free_bus(bus); changes++; } bus = tbus; } /* * Anything on the *busses list is new. So add them to usb_busses and * process them like the new bus it is. */ bus = busses; while (bus) { struct usb_bus *tbus = bus->next; /* * Remove it from the temporary list first and add it to the real * usb_busses list. */ LIST_DEL(busses, bus); LIST_ADD(usb_busses, bus); changes++; bus = tbus; } return changes; }