patch-2.3.36 linux/drivers/usb/usb-core.c

Next file: linux/drivers/usb/usb-serial.c
Previous file: linux/drivers/usb/uhci.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.35/linux/drivers/usb/usb-core.c linux/drivers/usb/usb-core.c
@@ -9,78 +9,57 @@
  * library, while this file handles starting drivers, etc.
  *
  */
+
 #include <linux/version.h>
 #include <linux/kernel.h>
 #include <linux/config.h>
 
-#include "inits.h"
 #include "usb.h"
 
-#ifndef CONFIG_USB_MODULE
-#	ifdef CONFIG_USB_UHCI
-		int uhci_init(void);
-#	endif
-#	ifdef CONFIG_USB_OHCI_HCD
-		int ohci_hcd_init(void);
-#	endif
-#endif
+/*
+ * USB core
+ */
 
-int usb_init(void)
-{
-	usb_major_init();
-#ifdef CONFIG_USB_PROC
-	proc_usb_init();
-#endif
-	usb_hub_init();
+int usb_hub_init(void);
+void usb_hub_cleanup(void);
+int usb_major_init(void);
+void usb_major_cleanup(void);
+int proc_usb_init(void);
+void proc_usb_cleanup(void);
 
-#ifndef CONFIG_USB_MODULE
-#	ifdef CONFIG_USB_UHCI
-		uhci_init();
-#	endif
-#	ifdef CONFIG_USB_OHCI_HCD
-		ohci_hcd_init(); 
-#	endif
-#	ifdef CONFIG_USB_MOUSE
-		usb_mouse_init();
-#	endif
-#       ifdef CONFIG_USB_SCANNER
-                usb_scanner_init();
-#       endif
-#	ifdef CONFIG_USB_KBD
-		usb_kbd_init();
-#	endif
-#	ifdef CONFIG_USB_AUDIO
-		usb_audio_init();
-#	endif
-#	ifdef CONFIG_USB_ACM
-		usb_acm_init();
-#	endif
-#	ifdef CONFIG_USB_PRINTER
-		usb_printer_init();
-#	endif
-#	ifdef CONFIG_USB_SERIAL
-		usb_serial_init();
-#	endif
-#	ifdef CONFIG_USB_CPIA
-		usb_cpia_init();
-#	endif
-#	ifdef CONFIG_USB_DC2XX
-		usb_dc2xx_init();
-#	endif
-#	ifdef CONFIG_USB_SCSI
-		usb_scsi_init();
-#	endif
-#	ifdef CONFIG_USB_DABUSB
-		dabusb_init();
-#	endif
-#endif
-	return 0;
-}
+/*
+ * USB device drivers
+ */
+
+int usb_acm_init(void);
+int usb_audio_init(void);
+int usb_cpia_init(void);
+int usb_ov511_init(void);
+int usb_dc2xx_init(void);
+int usb_scanner_init(void);
+int usb_printer_init(void);
+int usb_scsi_init(void);
+int usb_serial_init(void);
+int dabusb_init(void);
+int hid_init(void);
+int input_init(void);
+int usb_mouse_init(void);
+int usb_kbd_init(void);
 
 /*
- *  Clean up when unloading the module
+ * HCI drivers
  */
-void cleanup_drivers(void)
+
+int uhci_init(void);
+int ohci_hcd_init(void);
+
+#ifdef MODULE
+
+/*
+ * Cleanup
+ */
+
+void cleanup_module(void)
 {
 	usb_major_cleanup();
 #ifdef CONFIG_USB_PROC
@@ -88,39 +67,72 @@
 #endif
 	usb_hub_cleanup();	
 
-#ifndef MODULE
-#	ifdef CONFIG_USB_MOUSE
-        	usb_mouse_cleanup();
-#	endif
-#       ifdef CONFIG_USB_SCANNER
-                usb_scanner_cleanup();
-#       endif
-#	ifdef CONFIG_USB_DABUSB
-		dabusb_cleanup();
-#	endif
-#	ifdef CONFIG_USB_KBD
-		usb_kbd_cleanup();
-#	endif
-#	ifdef CONFIG_USB_ACM
-		usb_acm_cleanup();
-#	endif
-#	ifdef CONFIG_USB_CPIA
-		usb_cpia_cleanup();
-#	endif
-#	ifdef CONFIG_USB_DC2XX
-		usb_dc2xx_cleanup();
-#	endif
-#endif
 }
 
-#ifdef MODULE
+/*
+ * Init
+ */
+
 int init_module(void)
+#else
+int usb_init(void)
+#endif
 {
-	return usb_init();
-}
+	usb_major_init();
+#ifdef CONFIG_USB_PROC
+	proc_usb_init();
+#endif
+	usb_hub_init();
 
-void cleanup_module(void)
-{
-	cleanup_drivers();
-}
+#ifndef CONFIG_USB_MODULE
+#ifdef CONFIG_USB_SCANNER
+	usb_scanner_init();
+#endif
+#ifdef CONFIG_USB_AUDIO
+	usb_audio_init();
+#endif
+#ifdef CONFIG_USB_ACM
+	usb_acm_init();
+#endif
+#ifdef CONFIG_USB_PRINTER
+	usb_printer_init();
 #endif
+#ifdef CONFIG_USB_SERIAL
+	usb_serial_init();
+#endif
+#ifdef CONFIG_USB_CPIA
+	usb_cpia_init();
+#endif
+#ifdef CONFIG_USB_OV511
+	usb_ov511_init();
+#endif
+#ifdef CONFIG_USB_DC2XX
+	usb_dc2xx_init();
+#endif
+#ifdef CONFIG_USB_SCSI
+	usb_scsi_init();
+#endif
+#ifdef CONFIG_USB_DABUSB
+	dabusb_init();
+#endif
+#if defined(CONFIG_USB_HID) || defined(CONFIG_USB_MOUSE) || defined(CONFIG_USB_KBD)
+	input_init();
+#endif
+#ifdef CONFIG_USB_HID
+	hid_init();
+#endif
+#ifdef CONFIG_USB_MOUSE
+	usb_mouse_init();
+#endif
+#ifdef CONFIG_USB_KBD
+	usb_kbd_init();
+#endif
+#ifdef CONFIG_USB_UHCI
+	uhci_init();
+#endif
+#ifdef CONFIG_USB_OHCI_HCD
+	ohci_hcd_init(); 
+#endif
+#endif
+	return 0;
+}

FUNET's LINUX-ADM group, [email protected]
TCL-scripts by Sam Shen (who was at: [email protected])