Skip to contentSkip to conversation

duplication of devices, hotplug, pegasus (a lot ;-)

linux-usb-devel Pete Zaitcev 2 participants 2 messages Jul 12, 2001 – Jul 13, 2001 USB

lore
Share & tools
lore
#0 lore raw
Quoted 6 lines

From: Norbert Preining <[email protected]>
To: [email protected],
[email protected]
Date: Thu, 12 Jul 2001 11:42:00 +0200

I get a duplication of devices with linux-2.4.6, ohci:

Try this:

drivers/usb/usb.c +14 -3
diff -ur linux-2.4.5/drivers/usb/usb.c linux-2.4.5-tr5/drivers/usb/usb.c
@@ -688,10 +688,12 @@
 		return -1;
 	}
 
+	down(&dev->serialize);
+
 	interface = dev->actconfig->interface + ifnum;
 
 	if (usb_interface_claimed(interface))
-		return -1;
+		goto out_err;
 
 	private = NULL;
 	for (tmp = usb_driver_list.next; tmp != &usb_driver_list;) {
@@ -699,7 +701,6 @@
 		driver = list_entry(tmp, struct usb_driver, driver_list);
 		tmp = tmp->next;
 
-		down(&driver->serialize);
 		id = driver->id_table;
 		/* new style driver? */
 		if (id) {
@@ -707,7 +708,9 @@
 			  	interface->act_altsetting = i;
 				id = usb_match_id(dev, interface, id);
 				if (id) {
+					down(&driver->serialize);
 					private = driver->probe(dev,ifnum,id);
+					up(&driver->serialize);
 					if (private != NULL)
 						break;
 				}
@@ -717,15 +720,21 @@
 				interface->act_altsetting = 0;
 		}
 		else /* "old style" driver */
+		{
+			down(&driver->serialize);
 			private = driver->probe(dev, ifnum, NULL);
+			up(&driver->serialize);
+		}
 
-		up(&driver->serialize);
 		if (private) {
 			usb_driver_claim_interface(driver, interface, private);
+			up(&dev->serialize);
 			return 0;
 		}
 	}
 
+out_err:
+	up(&dev->serialize);
 	return -1;
 }
 
@@ -924,6 +933,8 @@
 	atomic_set(&dev->refcnt, 1);
 	INIT_LIST_HEAD(&dev->inodes);
 	INIT_LIST_HEAD(&dev->filelist);
+
+	init_MUTEX(&dev->serialize);
 
 	dev->bus->op->allocate(dev);
 
include/linux/usb.h +1 -0
diff -ur linux-2.4.5/include/linux/usb.h linux-2.4.5-tr5/include/linux/usb.h
@@ -595,6 +595,7 @@
 	int slow;			/* Slow device? */
 
 	atomic_t refcnt;		/* Reference count */
+	struct semaphore serialize;
 
 	unsigned int toggle[2];		/* one bit for each endpoint ([0] = IN, [1] = OUT) */
 	unsigned int halted[2];		/* endpoint halts; one bit per endpoint # & direction; */
Quoted 2 lines

Another problem: The pegasus stops working while downloading big files and the kernel oopses [...]

Sorry, not my piece of code. Try to identify the pegasus maintainer...

-- Pete

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 3 lines · Pete Zaitcev
Quoted 1 line

I get a duplication of devices with linux-2.4.6, ohci:

Try this:

Working, thanks a lot.

Quoted 5 lines
Quoted 2 lines

Another problem: The pegasus stops working while downloading big files and the kernel oopses [...]

Sorry, not my piece of code. Try to identify the pegasus maintainer...

I think it was a problem of the duplicated eth devices within the pegasus driver. Now (and yesterday when loading by hand) it was working well.

Thanks a lot

Best wishes

Norbert

Signature · 13 lines
ciao
norb

+-------------------------------------------------------------------+
| Norbert Preining              http://www.logic.at/people/preining |
| University of Technology Vienna, Austria        [email protected] |
| DSA: 0x09C5B094 (RSA: 0xCF1FA165) mail subject: get [DSA|RSA]-key |
+-------------------------------------------------------------------+

_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel