Vojtech Pavlik writes:
> On Sun, Aug 13, 2000 at 10:56:56PM +0100, Alan Cox wrote:
> > > > -OX_OBJS                := $(sort $(filter     $(export-objs), $(obj-y)))
> > > > +O_OBJS         := $(filter-out $(export-objs), $(obj-y))
> > > > +OX_OBJS                := $(filter     $(export-objs), $(obj-y))
> > > 
> > > I fear that this change will make some modules linked in more than once.
> > > the $sort was put there for exactly that reason.
> > 
> > Sort is not the correct solution to that anyway - it breaks the ordering.
> 
> True. Ordering should not be important for USB, though. Any better solution?

Ok, there is a fix for this type of problem that was mentioned on lkml last week.
See http://www.uwsg.indiana.edu/hypermail/linux/kernel/0008.0/0223.html for the
mail.

Here is a new patch using this scheme:

diff -ur orig/drivers/usb/Makefile linux/drivers/usb/Makefile
--- orig/drivers/usb/Makefile   Thu Aug 10 20:46:21 2000
+++ linux/drivers/usb/Makefile  Sun Aug 13 23:21:45 2000
@@ -19,6 +19,10 @@
 
 export-objs            := usb.o input.o
 
+# Objects which appear many times
+
+common-objs    := input.o
+
 # Multipart objects.
 
 list-multi             := usbcore.o
@@ -37,27 +41,6 @@
 obj-n  :=
 obj-   :=
 
-# Object files in subdirectories
-
-ifeq ($(CONFIG_USB_SERIAL),y)
-       SUB_DIRS += serial
-       obj-y += serial/usb-serial.o
-else
-       ifeq ($(CONFIG_USB_SERIAL),m)
-               MOD_IN_SUB_DIRS += serial
-       endif
-endif
-
-ifeq ($(CONFIG_USB_STORAGE),y)
-       SUB_DIRS += storage
-       obj-y += storage/usb-storage.o
-else
-       ifeq ($(CONFIG_USB_STORAGE),m)
-               MOD_IN_SUB_DIRS += storage
-       endif
-endif
-
-
 # Each configuration option enables a list of files.
 
 obj-$(CONFIG_USB)              += usbcore.o
@@ -92,6 +75,33 @@
 obj-$(CONFIG_USB_MICROTEK)     += microtek.o
 obj-$(CONFIG_USB_BLUETOOTH)    += bluetooth.o
 
+# Object files in subdirectories
+
+ifeq ($(CONFIG_USB_SERIAL),y)
+       SUB_DIRS += serial
+       obj-y += serial/usb-serial.o
+else
+       ifeq ($(CONFIG_USB_SERIAL),m)
+               MOD_IN_SUB_DIRS += serial
+       endif
+endif
+
+ifeq ($(CONFIG_USB_STORAGE),y)
+       SUB_DIRS += storage
+       obj-y += storage/usb-storage.o
+else
+       ifeq ($(CONFIG_USB_STORAGE),m)
+               MOD_IN_SUB_DIRS += storage
+       endif
+endif
+
+# Remove duplicates.
+# The 'common-*' lists are intermediate lists used to filter out
+# duplicates.
+
+common-y       := $(filter $(obj-y),$(common-obj))
+obj-y          := $(filter-out $(common-y), $(obj-y)) $(common-y)
+
 # Extract lists of the multi-part drivers.
 # The 'int-*' lists are the intermediate files used to build the multi's.
 
@@ -111,8 +121,8 @@
 
 # Translate to Rules.make lists.
 
-O_OBJS         := $(sort $(filter-out $(export-objs), $(obj-y)))
-OX_OBJS                := $(sort $(filter     $(export-objs), $(obj-y)))
+O_OBJS         := $(filter-out $(export-objs), $(obj-y))
+OX_OBJS                := $(filter     $(export-objs), $(obj-y))
 M_OBJS         := $(sort $(filter-out $(export-objs), $(obj-m)))
 MX_OBJS                := $(sort $(filter     $(export-objs), $(obj-m)))
 MI_OBJS                := $(sort $(filter-out $(export-objs), $(int-m)))
diff -ur orig/drivers/usb/usb-core.c linux/drivers/usb/usb-core.c
--- orig/drivers/usb/usb-core.c Tue May 30 23:51:22 2000
+++ linux/drivers/usb/usb-core.c        Sat Aug 12 20:29:31 2000
@@ -13,6 +13,7 @@
 #include <linux/version.h>
 #include <linux/kernel.h>
 #include <linux/config.h>
+#include <linux/init.h>
 #include <linux/usb.h>
 
 /*
@@ -42,13 +43,11 @@
 int uhci_init(void);
 int ohci_hcd_init(void);
 
-#ifdef MODULE
-
 /*
  * Cleanup
  */
 
-void cleanup_module(void)
+static void __exit usb_exit(void)
 {
        usb_major_cleanup();
        usbdevfs_cleanup();
@@ -59,10 +58,7 @@
  * Init
  */
 
-int init_module(void)
-#else
-int usb_init(void)
-#endif
+static int __init usb_init(void)
 {
        usb_major_init();
        usbdevfs_init();
@@ -99,3 +95,6 @@
 #endif
        return 0;
 }
+
+module_init(usb_init);
+module_exit(usb_exit);

   _____
  |_____| ------------------------------------------------- ---+---+-
  |   |         Russell King        [EMAIL PROTECTED]      --- ---
  | | | | http://www.arm.linux.org.uk/personal/aboutme.html   /  /  |
  | +-+-+                                                     --- -+-
  /   |               THE developer of ARM Linux              |+| /|\
 /  | | |                                                     ---  |
    +-+-+ -------------------------------------------------  /\\\  |

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to