All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pete Zaitcev <zaitcev@redhat.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: [linux-usb-devel] duplication of devices, hotplug, pegasus (a lot ;-)
Date: Thu, 12 Jul 2001 18:04:22 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-99496112300410@msgid-missing> (raw)

> From: Norbert Preining <preining@logic.at>
> To: linux-usb-devel@lists.sourceforge.net,
>    linux-hotplug-devel@lists.sourceforge.net
> Date: Thu, 12 Jul 2001 11:42:00 +0200

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

Try this:

diff -ur linux-2.4.5/drivers/usb/usb.c linux-2.4.5-tr5/drivers/usb/usb.c
--- linux-2.4.5/drivers/usb/usb.c	Sat Apr 28 11:28:09 2001
+++ linux-2.4.5-tr5/drivers/usb/usb.c	Tue May 29 18:22:19 2001
@@ -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);
 
diff -ur linux-2.4.5/include/linux/usb.h linux-2.4.5-tr5/include/linux/usb.h
--- linux-2.4.5/include/linux/usb.h	Fri May 25 18:02:43 2001
+++ linux-2.4.5-tr5/include/linux/usb.h	Tue May 29 18:12:33 2001
@@ -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; */

> 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
Linux-hotplug-devel@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

             reply	other threads:[~2001-07-12 18:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-12 18:04 Pete Zaitcev [this message]
2001-07-13  6:27 ` [linux-usb-devel] duplication of devices, hotplug, pegasus (a lot ;-) Norbert Preining

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-hotplug-99496112300410@msgid-missing \
    --to=zaitcev@redhat.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.