patch-2.3.46 linux/drivers/usb/usb_storage.c
Next file: linux/drivers/video/bwtwofb.c
Previous file: linux/drivers/usb/usb.c
Back to the patch index
Back to the overall index
- Lines: 72
- Date:
Wed Feb 16 10:25:40 2000
- Orig file:
v2.3.45/linux/drivers/usb/usb_storage.c
- Orig date:
Fri Jan 28 15:09:08 2000
diff -u --recursive --new-file v2.3.45/linux/drivers/usb/usb_storage.c linux/drivers/usb/usb_storage.c
@@ -39,6 +39,14 @@
#include "usb.h"
#include "usb_storage.h"
+/*
+ * This is the size of the structure Scsi_Host_Template. We create
+ * an instance of this structure in this file and this is a check
+ * to see if this structure may have changed within the SCSI module.
+ * This is by no means foolproof, but it does help us some.
+ */
+#define SCSI_HOST_TEMPLATE_SIZE (104)
+
/* direction table -- this indicates the direction of the data
* transfer for each command code -- a 1 indicates input
*/
@@ -1013,7 +1021,7 @@
bcb.Flags, bcb.Length);
result = usb_bulk_msg(us->pusb_dev, pipe, &bcb,
US_BULK_CB_WRAP_LEN, &partial, HZ*5);
- US_DEBUGP("Bulk command transfer result 0x%x\n", result);
+ US_DEBUGP("Bulk command transfer result=%d\n", result);
/* if we stall, we need to clear it before we go on */
if (result == -EPIPE) {
@@ -1327,6 +1335,7 @@
NULL, /* reset */
NULL, /* slave_attach */
NULL, /* bios_param */
+ NULL, /* select_queue_depths */
1, /* can_queue */
-1, /* this_id */
SG_ALL, /* sg_tablesize */
@@ -1811,10 +1820,18 @@
* Initialization and registration
***********************************************************************/
-int usb_stor_init(void)
+int __init usb_stor_init(void)
{
// MOD_INC_USE_COUNT;
+ if (sizeof(my_host_template) != SCSI_HOST_TEMPLATE_SIZE) {
+ printk(KERN_ERR "usb-storage: SCSI_HOST_TEMPLATE_SIZE does not match\n") ;
+ printk(KERN_ERR "usb-storage: expected %d bytes, got %d bytes\n",
+ SCSI_HOST_TEMPLATE_SIZE, sizeof(my_host_template)) ;
+
+ return -1 ;
+ }
+
/* register the driver, return -1 if error */
if (usb_register(&storage_driver) < 0)
return -1;
@@ -1823,15 +1840,10 @@
return 0;
}
-#ifdef MODULE
-int init_module(void)
+void __exit usb_stor_exit(void)
{
- /* MDD: Perhaps we should register the host here */
- return usb_stor_init();
+ usb_deregister(&storage_driver) ;
}
-void cleanup_module(void)
-{
- usb_deregister(&storage_driver);
-}
-#endif
+module_init(usb_stor_init) ;
+module_exit(usb_stor_exit) ;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)