diff options
author | José Pekkarinen <jose.pekkarinen@nokia.com> | 2016-04-11 10:41:07 +0300 |
---|---|---|
committer | José Pekkarinen <jose.pekkarinen@nokia.com> | 2016-04-13 08:17:18 +0300 |
commit | e09b41010ba33a20a87472ee821fa407a5b8da36 (patch) | |
tree | d10dc367189862e7ca5c592f033dc3726e1df4e3 /kernel/drivers/usb/storage | |
parent | f93b97fd65072de626c074dbe099a1fff05ce060 (diff) |
These changes are the raw update to linux-4.4.6-rt14. Kernel sources
are taken from kernel.org, and rt patch from the rt wiki download page.
During the rebasing, the following patch collided:
Force tick interrupt and get rid of softirq magic(I70131fb85).
Collisions have been removed because its logic was found on the
source already.
Change-Id: I7f57a4081d9deaa0d9ccfc41a6c8daccdee3b769
Signed-off-by: José Pekkarinen <jose.pekkarinen@nokia.com>
Diffstat (limited to 'kernel/drivers/usb/storage')
21 files changed, 196 insertions, 93 deletions
diff --git a/kernel/drivers/usb/storage/alauda.c b/kernel/drivers/usb/storage/alauda.c index 4b55ab66a..171fa7d79 100644 --- a/kernel/drivers/usb/storage/alauda.c +++ b/kernel/drivers/usb/storage/alauda.c @@ -42,6 +42,9 @@ #include "transport.h" #include "protocol.h" #include "debug.h" +#include "scsiglue.h" + +#define DRV_NAME "ums-alauda" MODULE_DESCRIPTION("Driver for Alauda-based card readers"); MODULE_AUTHOR("Daniel Drake <dsd@gentoo.org>"); @@ -1232,6 +1235,8 @@ static int alauda_transport(struct scsi_cmnd *srb, struct us_data *us) return USB_STOR_TRANSPORT_FAILED; } +static struct scsi_host_template alauda_host_template; + static int alauda_probe(struct usb_interface *intf, const struct usb_device_id *id) { @@ -1239,7 +1244,8 @@ static int alauda_probe(struct usb_interface *intf, int result; result = usb_stor_probe1(&us, intf, id, - (id - alauda_usb_ids) + alauda_unusual_dev_list); + (id - alauda_usb_ids) + alauda_unusual_dev_list, + &alauda_host_template); if (result) return result; @@ -1253,7 +1259,7 @@ static int alauda_probe(struct usb_interface *intf, } static struct usb_driver alauda_driver = { - .name = "ums-alauda", + .name = DRV_NAME, .probe = alauda_probe, .disconnect = usb_stor_disconnect, .suspend = usb_stor_suspend, @@ -1266,4 +1272,4 @@ static struct usb_driver alauda_driver = { .no_dynamic_id = 1, }; -module_usb_driver(alauda_driver); +module_usb_stor_driver(alauda_driver, alauda_host_template, DRV_NAME); diff --git a/kernel/drivers/usb/storage/cypress_atacb.c b/kernel/drivers/usb/storage/cypress_atacb.c index b3466d139..c80d3dec9 100644 --- a/kernel/drivers/usb/storage/cypress_atacb.c +++ b/kernel/drivers/usb/storage/cypress_atacb.c @@ -30,6 +30,8 @@ #include "scsiglue.h" #include "debug.h" +#define DRV_NAME "ums-cypress" + MODULE_DESCRIPTION("SAT support for Cypress USB/ATA bridges with ATACB"); MODULE_AUTHOR("Matthieu Castet <castet.matthieu@free.fr>"); MODULE_LICENSE("GPL"); @@ -241,6 +243,7 @@ end: srb->cmd_len = 12; } +static struct scsi_host_template cypress_host_template; static int cypress_probe(struct usb_interface *intf, const struct usb_device_id *id) @@ -250,7 +253,8 @@ static int cypress_probe(struct usb_interface *intf, struct usb_device *device; result = usb_stor_probe1(&us, intf, id, - (id - cypress_usb_ids) + cypress_unusual_dev_list); + (id - cypress_usb_ids) + cypress_unusual_dev_list, + &cypress_host_template); if (result) return result; @@ -273,7 +277,7 @@ static int cypress_probe(struct usb_interface *intf, } static struct usb_driver cypress_driver = { - .name = "ums-cypress", + .name = DRV_NAME, .probe = cypress_probe, .disconnect = usb_stor_disconnect, .suspend = usb_stor_suspend, @@ -286,4 +290,4 @@ static struct usb_driver cypress_driver = { .no_dynamic_id = 1, }; -module_usb_driver(cypress_driver); +module_usb_stor_driver(cypress_driver, cypress_host_template, DRV_NAME); diff --git a/kernel/drivers/usb/storage/datafab.c b/kernel/drivers/usb/storage/datafab.c index 7b17c2169..aa4f51944 100644 --- a/kernel/drivers/usb/storage/datafab.c +++ b/kernel/drivers/usb/storage/datafab.c @@ -59,6 +59,9 @@ #include "transport.h" #include "protocol.h" #include "debug.h" +#include "scsiglue.h" + +#define DRV_NAME "ums-datafab" MODULE_DESCRIPTION("Driver for Datafab USB Compact Flash reader"); MODULE_AUTHOR("Jimmie Mayfield <mayfield+datafab@sackheads.org>"); @@ -721,6 +724,8 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) return USB_STOR_TRANSPORT_FAILED; } +static struct scsi_host_template datafab_host_template; + static int datafab_probe(struct usb_interface *intf, const struct usb_device_id *id) { @@ -728,7 +733,8 @@ static int datafab_probe(struct usb_interface *intf, int result; result = usb_stor_probe1(&us, intf, id, - (id - datafab_usb_ids) + datafab_unusual_dev_list); + (id - datafab_usb_ids) + datafab_unusual_dev_list, + &datafab_host_template); if (result) return result; @@ -742,7 +748,7 @@ static int datafab_probe(struct usb_interface *intf, } static struct usb_driver datafab_driver = { - .name = "ums-datafab", + .name = DRV_NAME, .probe = datafab_probe, .disconnect = usb_stor_disconnect, .suspend = usb_stor_suspend, @@ -755,4 +761,4 @@ static struct usb_driver datafab_driver = { .no_dynamic_id = 1, }; -module_usb_driver(datafab_driver); +module_usb_stor_driver(datafab_driver, datafab_host_template, DRV_NAME); diff --git a/kernel/drivers/usb/storage/ene_ub6250.c b/kernel/drivers/usb/storage/ene_ub6250.c index 56f782bef..f3cf4cecd 100644 --- a/kernel/drivers/usb/storage/ene_ub6250.c +++ b/kernel/drivers/usb/storage/ene_ub6250.c @@ -28,6 +28,7 @@ #include "transport.h" #include "protocol.h" #include "debug.h" +#include "scsiglue.h" #define SD_INIT1_FIRMWARE "ene-ub6250/sd_init1.bin" #define SD_INIT2_FIRMWARE "ene-ub6250/sd_init2.bin" @@ -36,6 +37,8 @@ #define MSP_RW_FIRMWARE "ene-ub6250/msp_rdwr.bin" #define MS_RW_FIRMWARE "ene-ub6250/ms_rdwr.bin" +#define DRV_NAME "ums_eneub6250" + MODULE_DESCRIPTION("Driver for ENE UB6250 reader"); MODULE_LICENSE("GPL"); MODULE_FIRMWARE(SD_INIT1_FIRMWARE); @@ -2307,6 +2310,7 @@ static int ene_transport(struct scsi_cmnd *srb, struct us_data *us) return 0; } +static struct scsi_host_template ene_ub6250_host_template; static int ene_ub6250_probe(struct usb_interface *intf, const struct usb_device_id *id) @@ -2316,7 +2320,8 @@ static int ene_ub6250_probe(struct usb_interface *intf, struct us_data *us; result = usb_stor_probe1(&us, intf, id, - (id - ene_ub6250_usb_ids) + ene_ub6250_unusual_dev_list); + (id - ene_ub6250_usb_ids) + ene_ub6250_unusual_dev_list, + &ene_ub6250_host_template); if (result) return result; @@ -2404,7 +2409,7 @@ static int ene_ub6250_reset_resume(struct usb_interface *iface) #endif static struct usb_driver ene_ub6250_driver = { - .name = "ums_eneub6250", + .name = DRV_NAME, .probe = ene_ub6250_probe, .disconnect = usb_stor_disconnect, .suspend = usb_stor_suspend, @@ -2417,4 +2422,4 @@ static struct usb_driver ene_ub6250_driver = { .no_dynamic_id = 1, }; -module_usb_driver(ene_ub6250_driver); +module_usb_stor_driver(ene_ub6250_driver, ene_ub6250_host_template, DRV_NAME); diff --git a/kernel/drivers/usb/storage/freecom.c b/kernel/drivers/usb/storage/freecom.c index ef16068b7..3f2b08966 100644 --- a/kernel/drivers/usb/storage/freecom.c +++ b/kernel/drivers/usb/storage/freecom.c @@ -34,6 +34,9 @@ #include "transport.h" #include "protocol.h" #include "debug.h" +#include "scsiglue.h" + +#define DRV_NAME "ums-freecom" MODULE_DESCRIPTION("Driver for Freecom USB/IDE adaptor"); MODULE_AUTHOR("David Brown <usb-storage@davidb.org>"); @@ -523,6 +526,8 @@ static void pdump(struct us_data *us, void *ibuffer, int length) } #endif +static struct scsi_host_template freecom_host_template; + static int freecom_probe(struct usb_interface *intf, const struct usb_device_id *id) { @@ -530,7 +535,8 @@ static int freecom_probe(struct usb_interface *intf, int result; result = usb_stor_probe1(&us, intf, id, - (id - freecom_usb_ids) + freecom_unusual_dev_list); + (id - freecom_usb_ids) + freecom_unusual_dev_list, + &freecom_host_template); if (result) return result; @@ -544,7 +550,7 @@ static int freecom_probe(struct usb_interface *intf, } static struct usb_driver freecom_driver = { - .name = "ums-freecom", + .name = DRV_NAME, .probe = freecom_probe, .disconnect = usb_stor_disconnect, .suspend = usb_stor_suspend, @@ -557,4 +563,4 @@ static struct usb_driver freecom_driver = { .no_dynamic_id = 1, }; -module_usb_driver(freecom_driver); +module_usb_stor_driver(freecom_driver, freecom_host_template, DRV_NAME); diff --git a/kernel/drivers/usb/storage/isd200.c b/kernel/drivers/usb/storage/isd200.c index 076178645..39afd7045 100644 --- a/kernel/drivers/usb/storage/isd200.c +++ b/kernel/drivers/usb/storage/isd200.c @@ -60,6 +60,8 @@ #include "debug.h" #include "scsiglue.h" +#define DRV_NAME "ums-isd200" + MODULE_DESCRIPTION("Driver for In-System Design, Inc. ISD200 ASIC"); MODULE_AUTHOR("Björn Stenberg <bjorn@haxx.se>"); MODULE_LICENSE("GPL"); @@ -1454,30 +1456,26 @@ static void isd200_free_info_ptrs(void *info_) */ static int isd200_init_info(struct us_data *us) { - int retStatus = ISD200_GOOD; struct isd200_info *info; info = kzalloc(sizeof(struct isd200_info), GFP_KERNEL); if (!info) - retStatus = ISD200_ERROR; - else { - info->id = kzalloc(ATA_ID_WORDS * 2, GFP_KERNEL); - info->RegsBuf = kmalloc(sizeof(info->ATARegs), GFP_KERNEL); - info->srb.sense_buffer = - kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL); - if (!info->id || !info->RegsBuf || !info->srb.sense_buffer) { - isd200_free_info_ptrs(info); - kfree(info); - retStatus = ISD200_ERROR; - } - } + return ISD200_ERROR; - if (retStatus == ISD200_GOOD) { - us->extra = info; - us->extra_destructor = isd200_free_info_ptrs; + info->id = kzalloc(ATA_ID_WORDS * 2, GFP_KERNEL); + info->RegsBuf = kmalloc(sizeof(info->ATARegs), GFP_KERNEL); + info->srb.sense_buffer = kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL); + + if (!info->id || !info->RegsBuf || !info->srb.sense_buffer) { + isd200_free_info_ptrs(info); + kfree(info); + return ISD200_ERROR; } - return retStatus; + us->extra = info; + us->extra_destructor = isd200_free_info_ptrs; + + return ISD200_GOOD; } /************************************************************************** @@ -1537,6 +1535,8 @@ static void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us) isd200_srb_set_bufflen(srb, orig_bufflen); } +static struct scsi_host_template isd200_host_template; + static int isd200_probe(struct usb_interface *intf, const struct usb_device_id *id) { @@ -1544,7 +1544,8 @@ static int isd200_probe(struct usb_interface *intf, int result; result = usb_stor_probe1(&us, intf, id, - (id - isd200_usb_ids) + isd200_unusual_dev_list); + (id - isd200_usb_ids) + isd200_unusual_dev_list, + &isd200_host_template); if (result) return result; @@ -1556,7 +1557,7 @@ static int isd200_probe(struct usb_interface *intf, } static struct usb_driver isd200_driver = { - .name = "ums-isd200", + .name = DRV_NAME, .probe = isd200_probe, .disconnect = usb_stor_disconnect, .suspend = usb_stor_suspend, @@ -1569,4 +1570,4 @@ static struct usb_driver isd200_driver = { .no_dynamic_id = 1, }; -module_usb_driver(isd200_driver); +module_usb_stor_driver(isd200_driver, isd200_host_template, DRV_NAME); diff --git a/kernel/drivers/usb/storage/jumpshot.c b/kernel/drivers/usb/storage/jumpshot.c index 563078be6..ee613e258 100644 --- a/kernel/drivers/usb/storage/jumpshot.c +++ b/kernel/drivers/usb/storage/jumpshot.c @@ -56,7 +56,9 @@ #include "transport.h" #include "protocol.h" #include "debug.h" +#include "scsiglue.h" +#define DRV_NAME "ums-jumpshot" MODULE_DESCRIPTION("Driver for Lexar \"Jumpshot\" Compact Flash reader"); MODULE_AUTHOR("Jimmie Mayfield <mayfield+usb@sackheads.org>"); @@ -647,6 +649,8 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us) return USB_STOR_TRANSPORT_FAILED; } +static struct scsi_host_template jumpshot_host_template; + static int jumpshot_probe(struct usb_interface *intf, const struct usb_device_id *id) { @@ -654,7 +658,8 @@ static int jumpshot_probe(struct usb_interface *intf, int result; result = usb_stor_probe1(&us, intf, id, - (id - jumpshot_usb_ids) + jumpshot_unusual_dev_list); + (id - jumpshot_usb_ids) + jumpshot_unusual_dev_list, + &jumpshot_host_template); if (result) return result; @@ -668,7 +673,7 @@ static int jumpshot_probe(struct usb_interface *intf, } static struct usb_driver jumpshot_driver = { - .name = "ums-jumpshot", + .name = DRV_NAME, .probe = jumpshot_probe, .disconnect = usb_stor_disconnect, .suspend = usb_stor_suspend, @@ -681,4 +686,4 @@ static struct usb_driver jumpshot_driver = { .no_dynamic_id = 1, }; -module_usb_driver(jumpshot_driver); +module_usb_stor_driver(jumpshot_driver, jumpshot_host_template, DRV_NAME); diff --git a/kernel/drivers/usb/storage/karma.c b/kernel/drivers/usb/storage/karma.c index 94d16ee5e..ae201e694 100644 --- a/kernel/drivers/usb/storage/karma.c +++ b/kernel/drivers/usb/storage/karma.c @@ -28,6 +28,9 @@ #include "usb.h" #include "transport.h" #include "debug.h" +#include "scsiglue.h" + +#define DRV_NAME "ums-karma" MODULE_DESCRIPTION("Driver for Rio Karma"); MODULE_AUTHOR("Bob Copeland <me@bobcopeland.com>, Keith Bennett <keith@mcs.st-and.ac.uk>"); @@ -200,6 +203,8 @@ out: return ret; } +static struct scsi_host_template karma_host_template; + static int karma_probe(struct usb_interface *intf, const struct usb_device_id *id) { @@ -207,7 +212,8 @@ static int karma_probe(struct usb_interface *intf, int result; result = usb_stor_probe1(&us, intf, id, - (id - karma_usb_ids) + karma_unusual_dev_list); + (id - karma_usb_ids) + karma_unusual_dev_list, + &karma_host_template); if (result) return result; @@ -220,7 +226,7 @@ static int karma_probe(struct usb_interface *intf, } static struct usb_driver karma_driver = { - .name = "ums-karma", + .name = DRV_NAME, .probe = karma_probe, .disconnect = usb_stor_disconnect, .suspend = usb_stor_suspend, @@ -233,4 +239,4 @@ static struct usb_driver karma_driver = { .no_dynamic_id = 1, }; -module_usb_driver(karma_driver); +module_usb_stor_driver(karma_driver, karma_host_template, DRV_NAME); diff --git a/kernel/drivers/usb/storage/onetouch.c b/kernel/drivers/usb/storage/onetouch.c index 74e2aa23b..acc3d03d8 100644 --- a/kernel/drivers/usb/storage/onetouch.c +++ b/kernel/drivers/usb/storage/onetouch.c @@ -35,6 +35,9 @@ #include <linux/usb/input.h> #include "usb.h" #include "debug.h" +#include "scsiglue.h" + +#define DRV_NAME "ums-onetouch" MODULE_DESCRIPTION("Maxtor USB OneTouch hard drive button driver"); MODULE_AUTHOR("Nick Sillik <n.sillik@temple.edu>"); @@ -283,6 +286,8 @@ static void onetouch_release_input(void *onetouch_) } } +static struct scsi_host_template onetouch_host_template; + static int onetouch_probe(struct usb_interface *intf, const struct usb_device_id *id) { @@ -290,7 +295,8 @@ static int onetouch_probe(struct usb_interface *intf, int result; result = usb_stor_probe1(&us, intf, id, - (id - onetouch_usb_ids) + onetouch_unusual_dev_list); + (id - onetouch_usb_ids) + onetouch_unusual_dev_list, + &onetouch_host_template); if (result) return result; @@ -301,7 +307,7 @@ static int onetouch_probe(struct usb_interface *intf, } static struct usb_driver onetouch_driver = { - .name = "ums-onetouch", + .name = DRV_NAME, .probe = onetouch_probe, .disconnect = usb_stor_disconnect, .suspend = usb_stor_suspend, @@ -314,4 +320,4 @@ static struct usb_driver onetouch_driver = { .no_dynamic_id = 1, }; -module_usb_driver(onetouch_driver); +module_usb_stor_driver(onetouch_driver, onetouch_host_template, DRV_NAME); diff --git a/kernel/drivers/usb/storage/realtek_cr.c b/kernel/drivers/usb/storage/realtek_cr.c index 27e4a580d..20433563a 100644 --- a/kernel/drivers/usb/storage/realtek_cr.c +++ b/kernel/drivers/usb/storage/realtek_cr.c @@ -39,6 +39,9 @@ #include "transport.h" #include "protocol.h" #include "debug.h" +#include "scsiglue.h" + +#define DRV_NAME "ums-realtek" MODULE_DESCRIPTION("Driver for Realtek USB Card Reader"); MODULE_AUTHOR("wwang <wei_wang@realsil.com.cn>"); @@ -1034,6 +1037,8 @@ INIT_FAIL: return -EIO; } +static struct scsi_host_template realtek_cr_host_template; + static int realtek_cr_probe(struct usb_interface *intf, const struct usb_device_id *id) { @@ -1044,7 +1049,8 @@ static int realtek_cr_probe(struct usb_interface *intf, result = usb_stor_probe1(&us, intf, id, (id - realtek_cr_ids) + - realtek_cr_unusual_dev_list); + realtek_cr_unusual_dev_list, + &realtek_cr_host_template); if (result) return result; @@ -1054,7 +1060,7 @@ static int realtek_cr_probe(struct usb_interface *intf, } static struct usb_driver realtek_cr_driver = { - .name = "ums-realtek", + .name = DRV_NAME, .probe = realtek_cr_probe, .disconnect = usb_stor_disconnect, /* .suspend = usb_stor_suspend, */ @@ -1070,4 +1076,4 @@ static struct usb_driver realtek_cr_driver = { .no_dynamic_id = 1, }; -module_usb_driver(realtek_cr_driver); +module_usb_stor_driver(realtek_cr_driver, realtek_cr_host_template, DRV_NAME); diff --git a/kernel/drivers/usb/storage/scsiglue.c b/kernel/drivers/usb/storage/scsiglue.c index 0e400f382..dba51362d 100644 --- a/kernel/drivers/usb/storage/scsiglue.c +++ b/kernel/drivers/usb/storage/scsiglue.c @@ -456,17 +456,13 @@ static int write_info(struct Scsi_Host *host, char *buffer, int length) return length; } -/* we use this macro to help us write into the buffer */ -#undef SPRINTF -#define SPRINTF(args...) seq_printf(m, ## args) - static int show_info (struct seq_file *m, struct Scsi_Host *host) { struct us_data *us = host_to_us(host); const char *string; /* print the controller name */ - SPRINTF(" Host scsi%d: usb-storage\n", host->host_no); + seq_printf(m, " Host scsi%d: usb-storage\n", host->host_no); /* print product, vendor, and serial number strings */ if (us->pusb_dev->manufacturer) @@ -475,26 +471,26 @@ static int show_info (struct seq_file *m, struct Scsi_Host *host) string = us->unusual_dev->vendorName; else string = "Unknown"; - SPRINTF(" Vendor: %s\n", string); + seq_printf(m, " Vendor: %s\n", string); if (us->pusb_dev->product) string = us->pusb_dev->product; else if (us->unusual_dev->productName) string = us->unusual_dev->productName; else string = "Unknown"; - SPRINTF(" Product: %s\n", string); + seq_printf(m, " Product: %s\n", string); if (us->pusb_dev->serial) string = us->pusb_dev->serial; else string = "None"; - SPRINTF("Serial Number: %s\n", string); + seq_printf(m, "Serial Number: %s\n", string); /* show the protocol and transport */ - SPRINTF(" Protocol: %s\n", us->protocol_name); - SPRINTF(" Transport: %s\n", us->transport_name); + seq_printf(m, " Protocol: %s\n", us->protocol_name); + seq_printf(m, " Transport: %s\n", us->transport_name); /* show the device flags */ - SPRINTF(" Quirks:"); + seq_printf(m, " Quirks:"); #define US_FLAG(name, value) \ if (us->fflags & value) seq_printf(m, " " #name); @@ -540,7 +536,7 @@ static struct device_attribute *sysfs_device_attr_list[] = { * this defines our host template, with which we'll allocate hosts */ -struct scsi_host_template usb_stor_host_template = { +static const struct scsi_host_template usb_stor_host_template = { /* basic userland interface stuff */ .name = "usb-storage", .proc_name = "usb-storage", @@ -558,7 +554,6 @@ struct scsi_host_template usb_stor_host_template = { /* queue commands only, only one command per LUN */ .can_queue = 1, - .cmd_per_lun = 1, /* unknown initiator id */ .this_id = -1, @@ -592,6 +587,16 @@ struct scsi_host_template usb_stor_host_template = { .module = THIS_MODULE }; +void usb_stor_host_template_init(struct scsi_host_template *sht, + const char *name, struct module *owner) +{ + *sht = usb_stor_host_template; + sht->name = name; + sht->proc_name = name; + sht->module = owner; +} +EXPORT_SYMBOL_GPL(usb_stor_host_template_init); + /* To Report "Illegal Request: Invalid Field in CDB */ unsigned char usb_stor_sense_invalidCDB[18] = { [0] = 0x70, /* current error */ diff --git a/kernel/drivers/usb/storage/scsiglue.h b/kernel/drivers/usb/storage/scsiglue.h index ffa1cca93..5494d8760 100644 --- a/kernel/drivers/usb/storage/scsiglue.h +++ b/kernel/drivers/usb/storage/scsiglue.h @@ -41,8 +41,9 @@ extern void usb_stor_report_device_reset(struct us_data *us); extern void usb_stor_report_bus_reset(struct us_data *us); +extern void usb_stor_host_template_init(struct scsi_host_template *sht, + const char *name, struct module *owner); extern unsigned char usb_stor_sense_invalidCDB[18]; -extern struct scsi_host_template usb_stor_host_template; #endif diff --git a/kernel/drivers/usb/storage/sddr09.c b/kernel/drivers/usb/storage/sddr09.c index 3847053d7..b74603689 100644 --- a/kernel/drivers/usb/storage/sddr09.c +++ b/kernel/drivers/usb/storage/sddr09.c @@ -52,6 +52,9 @@ #include "transport.h" #include "protocol.h" #include "debug.h" +#include "scsiglue.h" + +#define DRV_NAME "ums-sddr09" MODULE_DESCRIPTION("Driver for SanDisk SDDR-09 SmartMedia reader"); MODULE_AUTHOR("Andries Brouwer <aeb@cwi.nl>, Robert Baruch <autophile@starband.net>"); @@ -1738,6 +1741,8 @@ usb_stor_sddr09_init(struct us_data *us) { return sddr09_common_init(us); } +static struct scsi_host_template sddr09_host_template; + static int sddr09_probe(struct usb_interface *intf, const struct usb_device_id *id) { @@ -1745,7 +1750,8 @@ static int sddr09_probe(struct usb_interface *intf, int result; result = usb_stor_probe1(&us, intf, id, - (id - sddr09_usb_ids) + sddr09_unusual_dev_list); + (id - sddr09_usb_ids) + sddr09_unusual_dev_list, + &sddr09_host_template); if (result) return result; @@ -1766,7 +1772,7 @@ static int sddr09_probe(struct usb_interface *intf, } static struct usb_driver sddr09_driver = { - .name = "ums-sddr09", + .name = DRV_NAME, .probe = sddr09_probe, .disconnect = usb_stor_disconnect, .suspend = usb_stor_suspend, @@ -1779,4 +1785,4 @@ static struct usb_driver sddr09_driver = { .no_dynamic_id = 1, }; -module_usb_driver(sddr09_driver); +module_usb_stor_driver(sddr09_driver, sddr09_host_template, DRV_NAME); diff --git a/kernel/drivers/usb/storage/sddr55.c b/kernel/drivers/usb/storage/sddr55.c index aacedef96..e5e0a25ec 100644 --- a/kernel/drivers/usb/storage/sddr55.c +++ b/kernel/drivers/usb/storage/sddr55.c @@ -34,6 +34,9 @@ #include "transport.h" #include "protocol.h" #include "debug.h" +#include "scsiglue.h" + +#define DRV_NAME "ums-sddr55" MODULE_DESCRIPTION("Driver for SanDisk SDDR-55 SmartMedia reader"); MODULE_AUTHOR("Simon Munton"); @@ -968,6 +971,7 @@ static int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us) return USB_STOR_TRANSPORT_FAILED; // FIXME: sense buffer? } +static struct scsi_host_template sddr55_host_template; static int sddr55_probe(struct usb_interface *intf, const struct usb_device_id *id) @@ -976,7 +980,8 @@ static int sddr55_probe(struct usb_interface *intf, int result; result = usb_stor_probe1(&us, intf, id, - (id - sddr55_usb_ids) + sddr55_unusual_dev_list); + (id - sddr55_usb_ids) + sddr55_unusual_dev_list, + &sddr55_host_template); if (result) return result; @@ -990,7 +995,7 @@ static int sddr55_probe(struct usb_interface *intf, } static struct usb_driver sddr55_driver = { - .name = "ums-sddr55", + .name = DRV_NAME, .probe = sddr55_probe, .disconnect = usb_stor_disconnect, .suspend = usb_stor_suspend, @@ -1003,4 +1008,4 @@ static struct usb_driver sddr55_driver = { .no_dynamic_id = 1, }; -module_usb_driver(sddr55_driver); +module_usb_stor_driver(sddr55_driver, sddr55_host_template, DRV_NAME); diff --git a/kernel/drivers/usb/storage/shuttle_usbat.c b/kernel/drivers/usb/storage/shuttle_usbat.c index 008d805c3..a3ec86b91 100644 --- a/kernel/drivers/usb/storage/shuttle_usbat.c +++ b/kernel/drivers/usb/storage/shuttle_usbat.c @@ -53,6 +53,9 @@ #include "transport.h" #include "protocol.h" #include "debug.h" +#include "scsiglue.h" + +#define DRV_NAME "ums-usbat" MODULE_DESCRIPTION("Driver for SCM Microsystems (a.k.a. Shuttle) USB-ATAPI cable"); MODULE_AUTHOR("Daniel Drake <dsd@gentoo.org>, Robert Baruch <autophile@starband.net>"); @@ -1834,6 +1837,8 @@ static int init_usbat_flash(struct us_data *us) return init_usbat(us, USBAT_DEV_FLASH); } +static struct scsi_host_template usbat_host_template; + static int usbat_probe(struct usb_interface *intf, const struct usb_device_id *id) { @@ -1841,7 +1846,8 @@ static int usbat_probe(struct usb_interface *intf, int result; result = usb_stor_probe1(&us, intf, id, - (id - usbat_usb_ids) + usbat_unusual_dev_list); + (id - usbat_usb_ids) + usbat_unusual_dev_list, + &usbat_host_template); if (result) return result; @@ -1858,7 +1864,7 @@ static int usbat_probe(struct usb_interface *intf, } static struct usb_driver usbat_driver = { - .name = "ums-usbat", + .name = DRV_NAME, .probe = usbat_probe, .disconnect = usb_stor_disconnect, .suspend = usb_stor_suspend, @@ -1871,4 +1877,4 @@ static struct usb_driver usbat_driver = { .no_dynamic_id = 1, }; -module_usb_driver(usbat_driver); +module_usb_stor_driver(usbat_driver, usbat_host_template, DRV_NAME); diff --git a/kernel/drivers/usb/storage/transport.c b/kernel/drivers/usb/storage/transport.c index 540add24a..5e67f63b2 100644 --- a/kernel/drivers/usb/storage/transport.c +++ b/kernel/drivers/usb/storage/transport.c @@ -1111,7 +1111,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) * command phase and the data phase. Some devices need a little * more than that, probably because of clock rate inaccuracies. */ if (unlikely(us->fflags & US_FL_GO_SLOW)) - udelay(125); + usleep_range(125, 150); if (transfer_length) { unsigned int pipe = srb->sc_data_direction == DMA_FROM_DEVICE ? diff --git a/kernel/drivers/usb/storage/uas.c b/kernel/drivers/usb/storage/uas.c index 6d3122afe..5c66d3f7a 100644 --- a/kernel/drivers/usb/storage/uas.c +++ b/kernel/drivers/usb/storage/uas.c @@ -257,17 +257,16 @@ static void uas_stat_cmplt(struct urb *urb) struct uas_cmd_info *cmdinfo; unsigned long flags; unsigned int idx; + int status = urb->status; spin_lock_irqsave(&devinfo->lock, flags); if (devinfo->resetting) goto out; - if (urb->status) { - if (urb->status != -ENOENT && urb->status != -ECONNRESET) { - dev_err(&urb->dev->dev, "stat urb: status %d\n", - urb->status); - } + if (status) { + if (status != -ENOENT && status != -ECONNRESET && status != -ESHUTDOWN) + dev_err(&urb->dev->dev, "stat urb: status %d\n", status); goto out; } @@ -348,6 +347,7 @@ static void uas_data_cmplt(struct urb *urb) struct uas_dev_info *devinfo = (void *)cmnd->device->hostdata; struct scsi_data_buffer *sdb = NULL; unsigned long flags; + int status = urb->status; spin_lock_irqsave(&devinfo->lock, flags); @@ -374,9 +374,9 @@ static void uas_data_cmplt(struct urb *urb) goto out; } - if (urb->status) { - if (urb->status != -ENOENT && urb->status != -ECONNRESET) - uas_log_cmd_state(cmnd, "data cmplt err", urb->status); + if (status) { + if (status != -ENOENT && status != -ECONNRESET && status != -ESHUTDOWN) + uas_log_cmd_state(cmnd, "data cmplt err", status); /* error: no data transfered */ sdb->resid = sdb->length; } else { @@ -796,6 +796,10 @@ static int uas_slave_configure(struct scsi_device *sdev) if (devinfo->flags & US_FL_NO_REPORT_OPCODES) sdev->no_report_opcodes = 1; + /* A few buggy USB-ATA bridges don't understand FUA */ + if (devinfo->flags & US_FL_BROKEN_FUA) + sdev->broken_fua = 1; + scsi_change_queue_depth(sdev, devinfo->qdepth - 2); return 0; } @@ -811,9 +815,7 @@ static struct scsi_host_template uas_host_template = { .can_queue = 65536, /* Is there a limit on the _host_ ? */ .this_id = -1, .sg_tablesize = SG_NONE, - .cmd_per_lun = 1, /* until we override it */ .skip_settle_delay = 1, - .use_blk_tags = 1, }; #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ @@ -930,10 +932,6 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id) if (result) goto set_alt0; - result = scsi_init_shared_tag_map(shost, devinfo->qdepth - 2); - if (result) - goto free_streams; - usb_set_intfdata(intf, shost); result = scsi_add_host(shost, &intf->dev); if (result) diff --git a/kernel/drivers/usb/storage/unusual_devs.h b/kernel/drivers/usb/storage/unusual_devs.h index 87898ca2e..7ffe42090 100644 --- a/kernel/drivers/usb/storage/unusual_devs.h +++ b/kernel/drivers/usb/storage/unusual_devs.h @@ -1987,7 +1987,7 @@ UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x0201, US_FL_IGNORE_RESIDUE ), /* Reported by Michael Büsch <m@bues.ch> */ -UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0114, +UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0116, "JMicron", "USB to ATA/ATAPI Bridge", USB_SC_DEVICE, USB_PR_DEVICE, NULL, @@ -2086,6 +2086,17 @@ UNUSUAL_DEV( 0x1b1c, 0x1ab5, 0x0200, 0x0200, USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_INITIAL_READ10 ), +/* Reported by Hans de Goede <hdegoede@redhat.com> + * These are mini projectors using USB for both power and video data transport + * The usb-storage interface is a virtual windows driver CD, which the gm12u320 + * driver automatically converts into framebuffer & kms dri device nodes. + */ +UNUSUAL_DEV( 0x1de1, 0xc102, 0x0000, 0xffff, + "Grain-media Technology Corp.", + "USB3.0 Device GM12U320", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_IGNORE_DEVICE ), + /* Patch by Richard Schütz <r.schtz@t-online.de> * This external hard drive enclosure uses a JMicron chip which * needs the US_FL_IGNORE_RESIDUE flag to work properly. */ diff --git a/kernel/drivers/usb/storage/unusual_uas.h b/kernel/drivers/usb/storage/unusual_uas.h index c85ea5300..ccc113e83 100644 --- a/kernel/drivers/usb/storage/unusual_uas.h +++ b/kernel/drivers/usb/storage/unusual_uas.h @@ -132,7 +132,7 @@ UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999, "JMicron", "JMS567", USB_SC_DEVICE, USB_PR_DEVICE, NULL, - US_FL_NO_REPORT_OPCODES), + US_FL_BROKEN_FUA | US_FL_NO_REPORT_OPCODES), /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, diff --git a/kernel/drivers/usb/storage/usb.c b/kernel/drivers/usb/storage/usb.c index 6c10c888f..43576ed31 100644 --- a/kernel/drivers/usb/storage/usb.c +++ b/kernel/drivers/usb/storage/usb.c @@ -76,6 +76,8 @@ #include "uas-detect.h" #endif +#define DRV_NAME "usb-storage" + /* Some informational data */ MODULE_AUTHOR("Matthew Dharm <mdharm-usb@one-eyed-alien.net>"); MODULE_DESCRIPTION("USB Mass Storage driver for Linux"); @@ -924,7 +926,8 @@ static unsigned int usb_stor_sg_tablesize(struct usb_interface *intf) int usb_stor_probe1(struct us_data **pus, struct usb_interface *intf, const struct usb_device_id *id, - struct us_unusual_dev *unusual_dev) + struct us_unusual_dev *unusual_dev, + struct scsi_host_template *sht) { struct Scsi_Host *host; struct us_data *us; @@ -936,7 +939,7 @@ int usb_stor_probe1(struct us_data **pus, * Ask the SCSI layer to allocate a host structure, with extra * space at the end for our private us_data structure. */ - host = scsi_host_alloc(&usb_stor_host_template, sizeof(*us)); + host = scsi_host_alloc(sht, sizeof(*us)); if (!host) { dev_warn(&intf->dev, "Unable to allocate the scsi host\n"); return -ENOMEM; @@ -1073,6 +1076,8 @@ void usb_stor_disconnect(struct usb_interface *intf) } EXPORT_SYMBOL_GPL(usb_stor_disconnect); +static struct scsi_host_template usb_stor_host_template; + /* The main probe routine for standard devices */ static int storage_probe(struct usb_interface *intf, const struct usb_device_id *id) @@ -1113,7 +1118,8 @@ static int storage_probe(struct usb_interface *intf, id->idVendor, id->idProduct); } - result = usb_stor_probe1(&us, intf, id, unusual_dev); + result = usb_stor_probe1(&us, intf, id, unusual_dev, + &usb_stor_host_template); if (result) return result; @@ -1124,7 +1130,7 @@ static int storage_probe(struct usb_interface *intf, } static struct usb_driver usb_storage_driver = { - .name = "usb-storage", + .name = DRV_NAME, .probe = storage_probe, .disconnect = usb_stor_disconnect, .suspend = usb_stor_suspend, @@ -1137,4 +1143,4 @@ static struct usb_driver usb_storage_driver = { .soft_unbind = 1, }; -module_usb_driver(usb_storage_driver); +module_usb_stor_driver(usb_storage_driver, usb_stor_host_template, DRV_NAME); diff --git a/kernel/drivers/usb/storage/usb.h b/kernel/drivers/usb/storage/usb.h index 307e339a9..da0ad3241 100644 --- a/kernel/drivers/usb/storage/usb.h +++ b/kernel/drivers/usb/storage/usb.h @@ -197,11 +197,25 @@ extern int usb_stor_post_reset(struct usb_interface *iface); extern int usb_stor_probe1(struct us_data **pus, struct usb_interface *intf, const struct usb_device_id *id, - struct us_unusual_dev *unusual_dev); + struct us_unusual_dev *unusual_dev, + struct scsi_host_template *sht); extern int usb_stor_probe2(struct us_data *us); extern void usb_stor_disconnect(struct usb_interface *intf); extern void usb_stor_adjust_quirks(struct usb_device *dev, unsigned long *fflags); +#define module_usb_stor_driver(__driver, __sht, __name) \ +static int __init __driver##_init(void) \ +{ \ + usb_stor_host_template_init(&(__sht), __name, THIS_MODULE); \ + return usb_register(&(__driver)); \ +} \ +module_init(__driver##_init); \ +static void __exit __driver##_exit(void) \ +{ \ + usb_deregister(&(__driver)); \ +} \ +module_exit(__driver##_exit) + #endif |