diff options
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r-- | drivers/usb/storage/alauda.c | 1 | ||||
-rw-r--r-- | drivers/usb/storage/isd200.c | 4 | ||||
-rw-r--r-- | drivers/usb/storage/karma.c | 1 | ||||
-rw-r--r-- | drivers/usb/storage/onetouch.c | 12 | ||||
-rw-r--r-- | drivers/usb/storage/option_ms.c | 1 | ||||
-rw-r--r-- | drivers/usb/storage/scsiglue.c | 1 | ||||
-rw-r--r-- | drivers/usb/storage/sierra_ms.c | 1 | ||||
-rw-r--r-- | drivers/usb/storage/transport.c | 4 | ||||
-rw-r--r-- | drivers/usb/storage/unusual_devs.h | 37 | ||||
-rw-r--r-- | drivers/usb/storage/usb.c | 87 | ||||
-rw-r--r-- | drivers/usb/storage/usb.h | 3 |
11 files changed, 77 insertions, 75 deletions
diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c index 67edc65acb8e..42d0eaed4a01 100644 --- a/drivers/usb/storage/alauda.c +++ b/drivers/usb/storage/alauda.c @@ -32,6 +32,7 @@ */ #include <linux/module.h> +#include <linux/slab.h> #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h> diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c index fdba2f69d4c9..e9cbc1467f76 100644 --- a/drivers/usb/storage/isd200.c +++ b/drivers/usb/storage/isd200.c @@ -490,13 +490,13 @@ static int isd200_action( struct us_data *us, int action, void* pointer, int value ) { union ata_cdb ata; - struct scsi_device srb_dev; + /* static to prevent this large struct being placed on the valuable stack */ + static struct scsi_device srb_dev; struct isd200_info *info = (struct isd200_info *)us->extra; struct scsi_cmnd *srb = &info->srb; int status; memset(&ata, 0, sizeof(ata)); - memset(&srb_dev, 0, sizeof(srb_dev)); srb->cmnd = info->cmnd; srb->device = &srb_dev; ++srb->serial_number; diff --git a/drivers/usb/storage/karma.c b/drivers/usb/storage/karma.c index 7953d93a7739..ba1b78906880 100644 --- a/drivers/usb/storage/karma.c +++ b/drivers/usb/storage/karma.c @@ -19,6 +19,7 @@ */ #include <linux/module.h> +#include <linux/slab.h> #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h> diff --git a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c index 198bb3ed95b2..1943be5a2914 100644 --- a/drivers/usb/storage/onetouch.c +++ b/drivers/usb/storage/onetouch.c @@ -201,8 +201,8 @@ static int onetouch_connect_input(struct us_data *ss) if (!onetouch || !input_dev) goto fail1; - onetouch->data = usb_buffer_alloc(udev, ONETOUCH_PKT_LEN, - GFP_KERNEL, &onetouch->data_dma); + onetouch->data = usb_alloc_coherent(udev, ONETOUCH_PKT_LEN, + GFP_KERNEL, &onetouch->data_dma); if (!onetouch->data) goto fail1; @@ -264,8 +264,8 @@ static int onetouch_connect_input(struct us_data *ss) return 0; fail3: usb_free_urb(onetouch->irq); - fail2: usb_buffer_free(udev, ONETOUCH_PKT_LEN, - onetouch->data, onetouch->data_dma); + fail2: usb_free_coherent(udev, ONETOUCH_PKT_LEN, + onetouch->data, onetouch->data_dma); fail1: kfree(onetouch); input_free_device(input_dev); return error; @@ -279,8 +279,8 @@ static void onetouch_release_input(void *onetouch_) usb_kill_urb(onetouch->irq); input_unregister_device(onetouch->dev); usb_free_urb(onetouch->irq); - usb_buffer_free(onetouch->udev, ONETOUCH_PKT_LEN, - onetouch->data, onetouch->data_dma); + usb_free_coherent(onetouch->udev, ONETOUCH_PKT_LEN, + onetouch->data, onetouch->data_dma); } } diff --git a/drivers/usb/storage/option_ms.c b/drivers/usb/storage/option_ms.c index 773a5cd38c5a..89460181d122 100644 --- a/drivers/usb/storage/option_ms.c +++ b/drivers/usb/storage/option_ms.c @@ -21,6 +21,7 @@ */ #include <linux/usb.h> +#include <linux/slab.h> #include "usb.h" #include "transport.h" diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 4cc035562cc2..d8d98cfecada 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -43,7 +43,6 @@ * 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/slab.h> #include <linux/module.h> #include <linux/mutex.h> diff --git a/drivers/usb/storage/sierra_ms.c b/drivers/usb/storage/sierra_ms.c index 4395c4100ec2..57fc2f532cab 100644 --- a/drivers/usb/storage/sierra_ms.c +++ b/drivers/usb/storage/sierra_ms.c @@ -3,6 +3,7 @@ #include <scsi/scsi_cmnd.h> #include <scsi/scsi_device.h> #include <linux/usb.h> +#include <linux/slab.h> #include "usb.h" #include "transport.h" diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 468038126e5e..44716427c51c 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c @@ -44,8 +44,8 @@ */ #include <linux/sched.h> +#include <linux/gfp.h> #include <linux/errno.h> -#include <linux/slab.h> #include <linux/usb/quirks.h> @@ -147,11 +147,9 @@ static int usb_stor_msg_common(struct us_data *us, int timeout) * hasn't been mapped for DMA. Yes, this is clunky, but it's * easier than always having the caller tell us whether the * transfer buffer has already been mapped. */ - us->current_urb->transfer_flags = URB_NO_SETUP_DMA_MAP; if (us->current_urb->transfer_buffer == us->iobuf) us->current_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; us->current_urb->transfer_dma = us->iobuf_dma; - us->current_urb->setup_dma = us->cr_dma; /* submit the URB */ status = usb_submit_urb(us->current_urb, GFP_NOIO); diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 98b549b1cab2..2c897eefadde 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h @@ -365,14 +365,14 @@ UNUSUAL_DEV( 0x04cb, 0x0100, 0x0000, 0x2210, "FinePix 1400Zoom", US_SC_UFI, US_PR_DEVICE, NULL, US_FL_FIX_INQUIRY | US_FL_SINGLE_LUN), -/* Reported by Peter Wächtler <pwaechtler@loewe-komp.de> - * The device needs the flags only. +/* Reported by Ondrej Zary <linux@rainbow-software.org> + * The device reports one sector more and breaks when that sector is accessed */ -UNUSUAL_DEV( 0x04ce, 0x0002, 0x0074, 0x0074, +UNUSUAL_DEV( 0x04ce, 0x0002, 0x026c, 0x026c, "ScanLogic", "SL11R-IDE", US_SC_DEVICE, US_PR_DEVICE, NULL, - US_FL_FIX_INQUIRY), + US_FL_FIX_CAPACITY), /* Reported by Kriston Fincher <kriston@airmail.net> * Patch submitted by Sean Millichamp <sean@bruenor.org> @@ -1380,20 +1380,6 @@ UNUSUAL_DEV( 0x0f19, 0x0105, 0x0100, 0x0100, US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_IGNORE_RESIDUE ), -/* Jeremy Katz <katzj@redhat.com>: - * The Blackberry Pearl can run in two modes; a usb-storage only mode - * and a mode that allows access via mass storage and to its database. - * The berry_charge module will set the device to dual mode and thus we - * should ignore its native mode if that module is built - */ -#ifdef CONFIG_USB_BERRY_CHARGE -UNUSUAL_DEV( 0x0fca, 0x0006, 0x0001, 0x0001, - "RIM", - "Blackberry Pearl", - US_SC_DEVICE, US_PR_DEVICE, NULL, - US_FL_IGNORE_DEVICE ), -#endif - /* Reported by Michael Stattmann <michael@stattmann.com> */ UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, "Sony Ericsson", @@ -1858,6 +1844,21 @@ UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201, US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_IGNORE_RESIDUE ), +/* Reported by Hans de Goede <hdegoede@redhat.com> + * These Appotech controllers are found in Picture Frames, they provide a + * (buggy) emulation of a cdrom drive which contains the windows software + * Uploading of pictures happens over the corresponding /dev/sg device. */ +UNUSUAL_DEV( 0x1908, 0x1315, 0x0000, 0x0000, + "BUILDWIN", + "Photo Frame", + US_SC_DEVICE, US_PR_DEVICE, NULL, + US_FL_BAD_SENSE ), +UNUSUAL_DEV( 0x1908, 0x1320, 0x0000, 0x0000, + "BUILDWIN", + "Photo Frame", + US_SC_DEVICE, US_PR_DEVICE, NULL, + US_FL_BAD_SENSE ), + UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001, "ST", "2A", diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index bbeeb92a2131..a7d0bf9d92a7 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c @@ -407,15 +407,14 @@ static int associate_dev(struct us_data *us, struct usb_interface *intf) /* Store our private data in the interface */ usb_set_intfdata(intf, us); - /* Allocate the device-related DMA-mapped buffers */ - us->cr = usb_buffer_alloc(us->pusb_dev, sizeof(*us->cr), - GFP_KERNEL, &us->cr_dma); + /* Allocate the control/setup and DMA-mapped buffers */ + us->cr = kmalloc(sizeof(*us->cr), GFP_KERNEL); if (!us->cr) { US_DEBUGP("usb_ctrlrequest allocation failed\n"); return -ENOMEM; } - us->iobuf = usb_buffer_alloc(us->pusb_dev, US_IOBUF_SIZE, + us->iobuf = usb_alloc_coherent(us->pusb_dev, US_IOBUF_SIZE, GFP_KERNEL, &us->iobuf_dma); if (!us->iobuf) { US_DEBUGP("I/O buffer allocation failed\n"); @@ -499,9 +498,6 @@ static void adjust_quirks(struct us_data *us) } } us->fflags = (us->fflags & ~mask) | f; - dev_info(&us->pusb_intf->dev, "Quirks match for " - "vid %04x pid %04x: %x\n", - vid, pid, f); } /* Get the unusual_devs entries and the string descriptors */ @@ -511,6 +507,7 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id, struct usb_device *dev = us->pusb_dev; struct usb_interface_descriptor *idesc = &us->pusb_intf->cur_altsetting->desc; + struct device *pdev = &us->pusb_intf->dev; /* Store the entries */ us->unusual_dev = unusual_dev; @@ -524,7 +521,7 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id, adjust_quirks(us); if (us->fflags & US_FL_IGNORE_DEVICE) { - printk(KERN_INFO USB_STORAGE "device ignored\n"); + dev_info(pdev, "device ignored\n"); return -ENODEV; } @@ -535,6 +532,12 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id, if (dev->speed != USB_SPEED_HIGH) us->fflags &= ~US_FL_GO_SLOW; + if (us->fflags) + dev_info(pdev, "Quirks match for vid %04x pid %04x: %lx\n", + le16_to_cpu(dev->descriptor.idVendor), + le16_to_cpu(dev->descriptor.idProduct), + us->fflags); + /* Log a message if a non-generic unusual_dev entry contains an * unnecessary subclass or protocol override. This may stimulate * reports from users that will help us remove unneeded entries @@ -555,20 +558,20 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id, us->protocol == idesc->bInterfaceProtocol) msg += 2; if (msg >= 0 && !(us->fflags & US_FL_NEED_OVERRIDE)) - printk(KERN_NOTICE USB_STORAGE "This device " - "(%04x,%04x,%04x S %02x P %02x)" - " has %s in unusual_devs.h (kernel" - " %s)\n" - " Please send a copy of this message to " - "<linux-usb@vger.kernel.org> and " - "<usb-storage@lists.one-eyed-alien.net>\n", - le16_to_cpu(ddesc->idVendor), - le16_to_cpu(ddesc->idProduct), - le16_to_cpu(ddesc->bcdDevice), - idesc->bInterfaceSubClass, - idesc->bInterfaceProtocol, - msgs[msg], - utsname()->release); + dev_notice(pdev, "This device " + "(%04x,%04x,%04x S %02x P %02x)" + " has %s in unusual_devs.h (kernel" + " %s)\n" + " Please send a copy of this message to " + "<linux-usb@vger.kernel.org> and " + "<usb-storage@lists.one-eyed-alien.net>\n", + le16_to_cpu(ddesc->idVendor), + le16_to_cpu(ddesc->idProduct), + le16_to_cpu(ddesc->bcdDevice), + idesc->bInterfaceSubClass, + idesc->bInterfaceProtocol, + msgs[msg], + utsname()->release); } return 0; @@ -718,8 +721,8 @@ static int usb_stor_acquire_resources(struct us_data *us) /* Start up our control thread */ th = kthread_run(usb_stor_control_thread, us, "usb-storage"); if (IS_ERR(th)) { - printk(KERN_WARNING USB_STORAGE - "Unable to start control thread\n"); + dev_warn(&us->pusb_intf->dev, + "Unable to start control thread\n"); return PTR_ERR(th); } us->ctl_thread = th; @@ -757,13 +760,9 @@ static void dissociate_dev(struct us_data *us) { US_DEBUGP("-- %s\n", __func__); - /* Free the device-related DMA-mapped buffers */ - if (us->cr) - usb_buffer_free(us->pusb_dev, sizeof(*us->cr), us->cr, - us->cr_dma); - if (us->iobuf) - usb_buffer_free(us->pusb_dev, US_IOBUF_SIZE, us->iobuf, - us->iobuf_dma); + /* Free the buffers */ + kfree(us->cr); + usb_free_coherent(us->pusb_dev, US_IOBUF_SIZE, us->iobuf, us->iobuf_dma); /* Remove our private data from the interface */ usb_set_intfdata(us->pusb_intf, NULL); @@ -816,13 +815,14 @@ static void release_everything(struct us_data *us) static int usb_stor_scan_thread(void * __us) { struct us_data *us = (struct us_data *)__us; + struct device *dev = &us->pusb_intf->dev; - dev_dbg(&us->pusb_intf->dev, "device found\n"); + dev_dbg(dev, "device found\n"); set_freezable(); /* Wait for the timeout to expire or for a disconnect */ if (delay_use > 0) { - dev_dbg(&us->pusb_intf->dev, "waiting for device to settle " + dev_dbg(dev, "waiting for device to settle " "before scanning\n"); wait_event_freezable_timeout(us->delay_wait, test_bit(US_FLIDX_DONT_SCAN, &us->dflags), @@ -840,7 +840,7 @@ static int usb_stor_scan_thread(void * __us) mutex_unlock(&us->dev_mutex); } scsi_scan_host(us_to_host(us)); - dev_dbg(&us->pusb_intf->dev, "scan complete\n"); + dev_dbg(dev, "scan complete\n"); /* Should we unbind if no devices were detected? */ } @@ -876,8 +876,8 @@ int usb_stor_probe1(struct us_data **pus, */ host = scsi_host_alloc(&usb_stor_host_template, sizeof(*us)); if (!host) { - printk(KERN_WARNING USB_STORAGE - "Unable to allocate the scsi host\n"); + dev_warn(&intf->dev, + "Unable to allocate the scsi host\n"); return -ENOMEM; } @@ -925,6 +925,7 @@ int usb_stor_probe2(struct us_data *us) { struct task_struct *th; int result; + struct device *dev = &us->pusb_intf->dev; /* Make sure the transport and protocol have both been set */ if (!us->transport || !us->proto_handler) { @@ -949,18 +950,18 @@ int usb_stor_probe2(struct us_data *us) goto BadDevice; snprintf(us->scsi_name, sizeof(us->scsi_name), "usb-storage %s", dev_name(&us->pusb_intf->dev)); - result = scsi_add_host(us_to_host(us), &us->pusb_intf->dev); + result = scsi_add_host(us_to_host(us), dev); if (result) { - printk(KERN_WARNING USB_STORAGE - "Unable to add the scsi host\n"); + dev_warn(dev, + "Unable to add the scsi host\n"); goto BadDevice; } /* Start up the thread for delayed SCSI-device scanning */ th = kthread_create(usb_stor_scan_thread, us, "usb-stor-scan"); if (IS_ERR(th)) { - printk(KERN_WARNING USB_STORAGE - "Unable to start the device-scanning thread\n"); + dev_warn(dev, + "Unable to start the device-scanning thread\n"); complete(&us->scanning_done); quiesce_and_remove_host(us); result = PTR_ERR(th); @@ -1046,12 +1047,12 @@ static int __init usb_stor_init(void) { int retval; - printk(KERN_INFO "Initializing USB Mass Storage driver...\n"); + pr_info("Initializing USB Mass Storage driver...\n"); /* register the driver, return usb_register return code if error */ retval = usb_register(&usb_storage_driver); if (retval == 0) { - printk(KERN_INFO "USB Mass Storage support registered.\n"); + pr_info("USB Mass Storage support registered.\n"); usb_usual_set_present(USB_US_TYPE_STOR); } return retval; diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h index 69717134231b..89d3bfff98df 100644 --- a/drivers/usb/storage/usb.h +++ b/drivers/usb/storage/usb.h @@ -139,8 +139,7 @@ struct us_data { struct usb_ctrlrequest *cr; /* control requests */ struct usb_sg_request current_sg; /* scatter-gather req. */ unsigned char *iobuf; /* I/O buffer */ - dma_addr_t cr_dma; /* buffer DMA addresses */ - dma_addr_t iobuf_dma; + dma_addr_t iobuf_dma; /* buffer DMA addresses */ struct task_struct *ctl_thread; /* the control thread */ /* mutual exclusion and synchronization structures */ |