usb.c (593d0a3e9f813db910dc50574532914db21d09ff) | usb.c (f61870ee6f8cc77a844e22f26c58028078df7167) |
---|---|
1/* Driver for USB Mass Storage compliant devices 2 * 3 * Current development and maintenance by: 4 * (c) 1999-2003 Matthew Dharm (mdharm-usb@one-eyed-alien.net) 5 * 6 * Developed with the assistance of: 7 * (c) 2000 David L. Brown, Jr. (usb-storage@davidb.org) 8 * (c) 2003-2009 Alan Stern (stern@rowland.harvard.edu) --- 100 unchanged lines hidden (view full) --- 109 .productName = product_name, \ 110 .useProtocol = use_protocol, \ 111 .useTransport = use_transport, \ 112 .initFunction = init_function, \ 113} 114 115#define COMPLIANT_DEV UNUSUAL_DEV 116 | 1/* Driver for USB Mass Storage compliant devices 2 * 3 * Current development and maintenance by: 4 * (c) 1999-2003 Matthew Dharm (mdharm-usb@one-eyed-alien.net) 5 * 6 * Developed with the assistance of: 7 * (c) 2000 David L. Brown, Jr. (usb-storage@davidb.org) 8 * (c) 2003-2009 Alan Stern (stern@rowland.harvard.edu) --- 100 unchanged lines hidden (view full) --- 109 .productName = product_name, \ 110 .useProtocol = use_protocol, \ 111 .useTransport = use_transport, \ 112 .initFunction = init_function, \ 113} 114 115#define COMPLIANT_DEV UNUSUAL_DEV 116 |
117#define USUAL_DEV(use_protocol, use_transport, use_type) \ | 117#define USUAL_DEV(use_protocol, use_transport) \ |
118{ \ 119 .useProtocol = use_protocol, \ 120 .useTransport = use_transport, \ 121} 122 123static struct us_unusual_dev us_unusual_dev_list[] = { 124# include "unusual_devs.h" 125 { } /* Terminating entry */ 126}; 127 128static struct us_unusual_dev for_dynamic_ids = | 118{ \ 119 .useProtocol = use_protocol, \ 120 .useTransport = use_transport, \ 121} 122 123static struct us_unusual_dev us_unusual_dev_list[] = { 124# include "unusual_devs.h" 125 { } /* Terminating entry */ 126}; 127 128static struct us_unusual_dev for_dynamic_ids = |
129 USUAL_DEV(USB_SC_SCSI, USB_PR_BULK, 0); | 129 USUAL_DEV(USB_SC_SCSI, USB_PR_BULK); |
130 131#undef UNUSUAL_DEV 132#undef COMPLIANT_DEV 133#undef USUAL_DEV 134 135#ifdef CONFIG_LOCKDEP 136 137static struct lock_class_key us_interface_key[USB_MAXINTERFACES]; --- 421 unchanged lines hidden (view full) --- 559 /* Store the entries */ 560 us->unusual_dev = unusual_dev; 561 us->subclass = (unusual_dev->useProtocol == USB_SC_DEVICE) ? 562 idesc->bInterfaceSubClass : 563 unusual_dev->useProtocol; 564 us->protocol = (unusual_dev->useTransport == USB_PR_DEVICE) ? 565 idesc->bInterfaceProtocol : 566 unusual_dev->useTransport; | 130 131#undef UNUSUAL_DEV 132#undef COMPLIANT_DEV 133#undef USUAL_DEV 134 135#ifdef CONFIG_LOCKDEP 136 137static struct lock_class_key us_interface_key[USB_MAXINTERFACES]; --- 421 unchanged lines hidden (view full) --- 559 /* Store the entries */ 560 us->unusual_dev = unusual_dev; 561 us->subclass = (unusual_dev->useProtocol == USB_SC_DEVICE) ? 562 idesc->bInterfaceSubClass : 563 unusual_dev->useProtocol; 564 us->protocol = (unusual_dev->useTransport == USB_PR_DEVICE) ? 565 idesc->bInterfaceProtocol : 566 unusual_dev->useTransport; |
567 us->fflags = USB_US_ORIG_FLAGS(id->driver_info); | 567 us->fflags = id->driver_info; |
568 adjust_quirks(us); 569 570 if (us->fflags & US_FL_IGNORE_DEVICE) { 571 dev_info(pdev, "device ignored\n"); 572 return -ENODEV; 573 } 574 575 /* --- 460 unchanged lines hidden (view full) --- 1036 const struct usb_device_id *id) 1037{ 1038 struct us_unusual_dev *unusual_dev; 1039 struct us_data *us; 1040 int result; 1041 int size; 1042 1043 /* | 568 adjust_quirks(us); 569 570 if (us->fflags & US_FL_IGNORE_DEVICE) { 571 dev_info(pdev, "device ignored\n"); 572 return -ENODEV; 573 } 574 575 /* --- 460 unchanged lines hidden (view full) --- 1036 const struct usb_device_id *id) 1037{ 1038 struct us_unusual_dev *unusual_dev; 1039 struct us_data *us; 1040 int result; 1041 int size; 1042 1043 /* |
1044 * If libusual is configured, let it decide whether a standard 1045 * device should be handled by usb-storage or by ub. | |
1046 * If the device isn't standard (is handled by a subdriver 1047 * module) then don't accept it. 1048 */ | 1044 * If the device isn't standard (is handled by a subdriver 1045 * module) then don't accept it. 1046 */ |
1049 if (usb_usual_check_type(id, USB_US_TYPE_STOR) || 1050 usb_usual_ignore_device(intf)) | 1047 if (usb_usual_ignore_device(intf)) |
1051 return -ENXIO; 1052 1053 /* 1054 * Call the general probe procedures. 1055 * 1056 * The unusual_dev_list array is parallel to the usb_storage_usb_ids 1057 * table, so we use the index of the id entry to find the 1058 * corresponding unusual_devs entry. --- 41 unchanged lines hidden (view full) --- 1100static int __init usb_stor_init(void) 1101{ 1102 int retval; 1103 1104 pr_info("Initializing USB Mass Storage driver...\n"); 1105 1106 /* register the driver, return usb_register return code if error */ 1107 retval = usb_register(&usb_storage_driver); | 1048 return -ENXIO; 1049 1050 /* 1051 * Call the general probe procedures. 1052 * 1053 * The unusual_dev_list array is parallel to the usb_storage_usb_ids 1054 * table, so we use the index of the id entry to find the 1055 * corresponding unusual_devs entry. --- 41 unchanged lines hidden (view full) --- 1097static int __init usb_stor_init(void) 1098{ 1099 int retval; 1100 1101 pr_info("Initializing USB Mass Storage driver...\n"); 1102 1103 /* register the driver, return usb_register return code if error */ 1104 retval = usb_register(&usb_storage_driver); |
1108 if (retval == 0) { | 1105 if (retval == 0) |
1109 pr_info("USB Mass Storage support registered.\n"); | 1106 pr_info("USB Mass Storage support registered.\n"); |
1110 usb_usual_set_present(USB_US_TYPE_STOR); 1111 } | |
1112 return retval; 1113} 1114 1115static void __exit usb_stor_exit(void) 1116{ 1117 US_DEBUGP("usb_stor_exit() called\n"); 1118 1119 /* Deregister the driver 1120 * This will cause disconnect() to be called for each 1121 * attached unit 1122 */ 1123 US_DEBUGP("-- calling usb_deregister()\n"); 1124 usb_deregister(&usb_storage_driver) ; | 1107 return retval; 1108} 1109 1110static void __exit usb_stor_exit(void) 1111{ 1112 US_DEBUGP("usb_stor_exit() called\n"); 1113 1114 /* Deregister the driver 1115 * This will cause disconnect() to be called for each 1116 * attached unit 1117 */ 1118 US_DEBUGP("-- calling usb_deregister()\n"); 1119 usb_deregister(&usb_storage_driver) ; |
1125 1126 usb_usual_clear_present(USB_US_TYPE_STOR); | |
1127} 1128 1129module_init(usb_stor_init); 1130module_exit(usb_stor_exit); | 1120} 1121 1122module_init(usb_stor_init); 1123module_exit(usb_stor_exit); |