patch-2.4.7 linux/drivers/usb/inode.c

Next file: linux/drivers/usb/mdc800.c
Previous file: linux/drivers/usb/dsbr100.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.6/linux/drivers/usb/inode.c linux/drivers/usb/inode.c
@@ -260,11 +260,15 @@
         struct list_head *list;
         struct usb_bus *bus;
 
+	read_lock_irq (&usb_bus_list_lock);
         for (list = usb_bus_list.next; list != &usb_bus_list; list = list->next) {
                 bus = list_entry(list, struct usb_bus, bus_list);
-                if (bus->busnum == busnr)
+                if (bus->busnum == busnr) {
+			read_unlock_irq (&usb_bus_list_lock);
                         return bus;
+		}
         }
+	read_unlock_irq (&usb_bus_list_lock);
         return NULL;
 }
 
@@ -412,7 +416,7 @@
 		if (i < 2+NRSPECIAL)
 			return 0;
 		i -= 2+NRSPECIAL;
-		lock_kernel();
+		read_lock_irq (&usb_bus_list_lock);
 		for (list = usb_bus_list.next; list != &usb_bus_list; list = list->next) {
 			if (i > 0) {
 				i--;
@@ -424,7 +428,7 @@
 				break;
 			filp->f_pos++;
 		}
-		unlock_kernel();
+		read_unlock_irq (&usb_bus_list_lock);
 		return 0;
 	}
 }
@@ -635,13 +639,13 @@
 		list_add_tail(&inode->u.usbdev_i.slist, &s->u.usbdevfs_sb.ilist);
 		list_add_tail(&inode->u.usbdev_i.dlist, &special[i].inodes);
 	}
-	lock_kernel();
+	read_lock_irq (&usb_bus_list_lock);
 	for (blist = usb_bus_list.next; blist != &usb_bus_list; blist = blist->next) {
 		bus = list_entry(blist, struct usb_bus, bus_list);
 		new_bus_inode(bus, s);
 		recurse_new_dev_inode(bus->root_hub, s);
 	}
-	unlock_kernel();
+	read_unlock_irq (&usb_bus_list_lock);
         return s;
 
  out_no_root:

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)