linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: torvalds@transmeta.com
Cc: randy.dunlap@intel.com, jgarzik@mandrakesoft.com,
	linux-kernel@vger.kernel.org
Subject: USB init order dependencies.
Date: Tue, 31 Oct 2000 17:58:05 +0000	[thread overview]
Message-ID: <1827.973015085@redhat.com> (raw)

Personally, I think this fix is less ugly than any of the alternatives I've 
seen so far.

It removes the dependency on init order completely, by statically putting 
the hub driver into the usb_driver_list at compile time.

Leave the link ordering stuff for 2.5.

Index: drivers/usb//hub.c
===================================================================
RCS file: /inst/cvs/linux/drivers/usb/hub.c,v
retrieving revision 1.2.2.38
diff -u -r1.2.2.38 hub.c
--- drivers/usb//hub.c	2000/10/12 16:50:36	1.2.2.38
+++ drivers/usb//hub.c	2000/10/31 17:50:58
@@ -759,11 +759,13 @@
 	return 0;
 }
 
-static struct usb_driver hub_driver = {
+struct usb_driver hub_driver = {
 	name:		"hub",
 	probe:		hub_probe,
 	ioctl:		hub_ioctl,
-	disconnect:	hub_disconnect
+	disconnect:	hub_disconnect,
+	serialize:      __MUTEX_INITIALIZER(hub_driver.serialize),
+	driver_list:	LIST_HEAD_INIT(usb_driver_list)
 };
 
 /*
@@ -772,11 +774,6 @@
 int usb_hub_init(void)
 {
 	int pid;
-
-	if (usb_register(&hub_driver) < 0) {
-		err("Unable to register USB hub driver");
-		return -1;
-	}
 
 	pid = kernel_thread(usb_hub_thread, NULL,
 		CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
Index: drivers/usb//usb.c
===================================================================
RCS file: /inst/cvs/linux/drivers/usb/usb.c,v
retrieving revision 1.2.2.52
diff -u -r1.2.2.52 usb.c
--- drivers/usb//usb.c	2000/10/04 12:29:27	1.2.2.52
+++ drivers/usb//usb.c	2000/10/31 17:50:58
@@ -56,8 +56,14 @@
 
 /*
  * We have a per-interface "registered driver" list.
+ * We link the USB hub driver into the list statically at compile
+ * time, to prevent ugly dependencies on the order in which the
+ * init routines are called.
  */
-LIST_HEAD(usb_driver_list);
+
+extern struct usb_driver hub_driver;
+
+struct list_head usb_driver_list = LIST_HEAD_INIT(hub_driver.driver_list);
 LIST_HEAD(usb_bus_list);
 
 static struct usb_busmap busmap;


--
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

             reply	other threads:[~2000-10-31 17:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-31 17:58 David Woodhouse [this message]
2000-10-31 18:10 USB init order dependencies Dunlap, Randy
2000-11-03 10:38 ` Russell King
2000-11-04  8:24   ` Jeff Garzik
2000-11-04 14:38     ` Russell King
2000-11-04 15:30       ` Jeff Garzik
2000-11-05  1:36 Dunlap, Randy
2000-11-05 10:03 ` Russell King
2000-11-06 23:53 Dunlap, Randy
2000-11-07  7:26 ` Russell King
2000-11-07 18:27   ` David Woodhouse
2000-11-07 18:48 Dunlap, Randy
2000-11-07 18:50 ` David Woodhouse
2000-11-07 19:02 Dunlap, Randy

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=1827.973015085@redhat.com \
    --to=dwmw2@infradead.org \
    --cc=jgarzik@mandrakesoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randy.dunlap@intel.com \
    --cc=torvalds@transmeta.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).