# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.653   -> 1.654  
#	drivers/usb/usb-ohci.c	1.29    -> 1.30   
#	   drivers/usb/usb.c	1.24    -> 1.25   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/12	zwane@mwaikambo.name	1.654
# [PATCH] trivial ohci fixes
# 
# This is just a trivial patch for the following, and also a
# buglet (clear_bit usb_register/derister race there?) fix
# 
# usb-uhci.c: $Revision: 1.1.1.1 $ time 21:43:25 Sep  8 2002
# usb-uhci.c: High bandwidth mode enabled
# usb-uhci.c: v1.275:USB Universal Host Controller Interface driver
# usb-ohci.c: USB OHCI at membase 0xd0012000, IRQ 11
# usb-ohci.c: usb-00:01.2, Silicon Integrated Systems [SiS] 7001
# usb-ohci.c: USB HC TakeOver failed!
# usb.c: USB bus -1 deregistered <--
# --------------------------------------------
#
diff -Nru a/drivers/usb/usb-ohci.c b/drivers/usb/usb-ohci.c
--- a/drivers/usb/usb-ohci.c	Thu Sep 12 16:25:40 2002
+++ b/drivers/usb/usb-ohci.c	Thu Sep 12 16:25:40 2002
@@ -2442,8 +2442,9 @@
 	}
 	pci_set_drvdata(ohci->ohci_dev, NULL);
 	if (ohci->bus) {
-		if (ohci->bus->busnum)
+		if (ohci->bus->busnum != -1)
 			usb_deregister_bus (ohci->bus);
+
 		usb_free_bus (ohci->bus);
 	}
 
diff -Nru a/drivers/usb/usb.c b/drivers/usb/usb.c
--- a/drivers/usb/usb.c	Thu Sep 12 16:25:40 2002
+++ b/drivers/usb/usb.c	Thu Sep 12 16:25:40 2002
@@ -468,11 +468,10 @@
 	 */
 	down (&usb_bus_list_lock);
 	list_del(&bus->bus_list);
+	clear_bit(bus->busnum, busmap.busmap);
 	up (&usb_bus_list_lock);
 
 	usbdevfs_remove_bus(bus);
-
-	clear_bit(bus->busnum, busmap.busmap);
 
 	usb_bus_put(bus);
 }