Commit cbd3af54 authored by Felipe Contreras's avatar Felipe Contreras Committed by Greg Kroah-Hartman

USB: usb-storage: trivial debug improvements

Use pr_foo and dev_foo instead of printk. Maybe US_DEBUG* should be
replaced too.
Signed-off-by: default avatarFelipe Contreras <felipe.contreras@gmail.com>
Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 28f27dcb
...@@ -510,6 +510,7 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id, ...@@ -510,6 +510,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_device *dev = us->pusb_dev;
struct usb_interface_descriptor *idesc = struct usb_interface_descriptor *idesc =
&us->pusb_intf->cur_altsetting->desc; &us->pusb_intf->cur_altsetting->desc;
struct device *pdev = &us->pusb_intf->dev;
/* Store the entries */ /* Store the entries */
us->unusual_dev = unusual_dev; us->unusual_dev = unusual_dev;
...@@ -523,7 +524,7 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id, ...@@ -523,7 +524,7 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id,
adjust_quirks(us); adjust_quirks(us);
if (us->fflags & US_FL_IGNORE_DEVICE) { if (us->fflags & US_FL_IGNORE_DEVICE) {
printk(KERN_INFO USB_STORAGE "device ignored\n"); dev_info(pdev, "device ignored\n");
return -ENODEV; return -ENODEV;
} }
...@@ -554,20 +555,20 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id, ...@@ -554,20 +555,20 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id,
us->protocol == idesc->bInterfaceProtocol) us->protocol == idesc->bInterfaceProtocol)
msg += 2; msg += 2;
if (msg >= 0 && !(us->fflags & US_FL_NEED_OVERRIDE)) if (msg >= 0 && !(us->fflags & US_FL_NEED_OVERRIDE))
printk(KERN_NOTICE USB_STORAGE "This device " dev_notice(pdev, "This device "
"(%04x,%04x,%04x S %02x P %02x)" "(%04x,%04x,%04x S %02x P %02x)"
" has %s in unusual_devs.h (kernel" " has %s in unusual_devs.h (kernel"
" %s)\n" " %s)\n"
" Please send a copy of this message to " " Please send a copy of this message to "
"<linux-usb@vger.kernel.org> and " "<linux-usb@vger.kernel.org> and "
"<usb-storage@lists.one-eyed-alien.net>\n", "<usb-storage@lists.one-eyed-alien.net>\n",
le16_to_cpu(ddesc->idVendor), le16_to_cpu(ddesc->idVendor),
le16_to_cpu(ddesc->idProduct), le16_to_cpu(ddesc->idProduct),
le16_to_cpu(ddesc->bcdDevice), le16_to_cpu(ddesc->bcdDevice),
idesc->bInterfaceSubClass, idesc->bInterfaceSubClass,
idesc->bInterfaceProtocol, idesc->bInterfaceProtocol,
msgs[msg], msgs[msg],
utsname()->release); utsname()->release);
} }
return 0; return 0;
...@@ -717,8 +718,8 @@ static int usb_stor_acquire_resources(struct us_data *us) ...@@ -717,8 +718,8 @@ static int usb_stor_acquire_resources(struct us_data *us)
/* Start up our control thread */ /* Start up our control thread */
th = kthread_run(usb_stor_control_thread, us, "usb-storage"); th = kthread_run(usb_stor_control_thread, us, "usb-storage");
if (IS_ERR(th)) { if (IS_ERR(th)) {
printk(KERN_WARNING USB_STORAGE dev_warn(&us->pusb_intf->dev,
"Unable to start control thread\n"); "Unable to start control thread\n");
return PTR_ERR(th); return PTR_ERR(th);
} }
us->ctl_thread = th; us->ctl_thread = th;
...@@ -811,13 +812,14 @@ static void release_everything(struct us_data *us) ...@@ -811,13 +812,14 @@ static void release_everything(struct us_data *us)
static int usb_stor_scan_thread(void * __us) static int usb_stor_scan_thread(void * __us)
{ {
struct us_data *us = (struct us_data *)__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(); set_freezable();
/* Wait for the timeout to expire or for a disconnect */ /* Wait for the timeout to expire or for a disconnect */
if (delay_use > 0) { 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"); "before scanning\n");
wait_event_freezable_timeout(us->delay_wait, wait_event_freezable_timeout(us->delay_wait,
test_bit(US_FLIDX_DONT_SCAN, &us->dflags), test_bit(US_FLIDX_DONT_SCAN, &us->dflags),
...@@ -835,7 +837,7 @@ static int usb_stor_scan_thread(void * __us) ...@@ -835,7 +837,7 @@ static int usb_stor_scan_thread(void * __us)
mutex_unlock(&us->dev_mutex); mutex_unlock(&us->dev_mutex);
} }
scsi_scan_host(us_to_host(us)); 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? */ /* Should we unbind if no devices were detected? */
} }
...@@ -871,8 +873,8 @@ int usb_stor_probe1(struct us_data **pus, ...@@ -871,8 +873,8 @@ int usb_stor_probe1(struct us_data **pus,
*/ */
host = scsi_host_alloc(&usb_stor_host_template, sizeof(*us)); host = scsi_host_alloc(&usb_stor_host_template, sizeof(*us));
if (!host) { if (!host) {
printk(KERN_WARNING USB_STORAGE dev_warn(&intf->dev,
"Unable to allocate the scsi host\n"); "Unable to allocate the scsi host\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -920,6 +922,7 @@ int usb_stor_probe2(struct us_data *us) ...@@ -920,6 +922,7 @@ int usb_stor_probe2(struct us_data *us)
{ {
struct task_struct *th; struct task_struct *th;
int result; int result;
struct device *dev = &us->pusb_intf->dev;
/* Make sure the transport and protocol have both been set */ /* Make sure the transport and protocol have both been set */
if (!us->transport || !us->proto_handler) { if (!us->transport || !us->proto_handler) {
...@@ -944,18 +947,18 @@ int usb_stor_probe2(struct us_data *us) ...@@ -944,18 +947,18 @@ int usb_stor_probe2(struct us_data *us)
goto BadDevice; goto BadDevice;
snprintf(us->scsi_name, sizeof(us->scsi_name), "usb-storage %s", snprintf(us->scsi_name, sizeof(us->scsi_name), "usb-storage %s",
dev_name(&us->pusb_intf->dev)); 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) { if (result) {
printk(KERN_WARNING USB_STORAGE dev_warn(dev,
"Unable to add the scsi host\n"); "Unable to add the scsi host\n");
goto BadDevice; goto BadDevice;
} }
/* Start up the thread for delayed SCSI-device scanning */ /* Start up the thread for delayed SCSI-device scanning */
th = kthread_create(usb_stor_scan_thread, us, "usb-stor-scan"); th = kthread_create(usb_stor_scan_thread, us, "usb-stor-scan");
if (IS_ERR(th)) { if (IS_ERR(th)) {
printk(KERN_WARNING USB_STORAGE dev_warn(dev,
"Unable to start the device-scanning thread\n"); "Unable to start the device-scanning thread\n");
complete(&us->scanning_done); complete(&us->scanning_done);
quiesce_and_remove_host(us); quiesce_and_remove_host(us);
result = PTR_ERR(th); result = PTR_ERR(th);
...@@ -1041,12 +1044,12 @@ static int __init usb_stor_init(void) ...@@ -1041,12 +1044,12 @@ static int __init usb_stor_init(void)
{ {
int retval; 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 */ /* register the driver, return usb_register return code if error */
retval = usb_register(&usb_storage_driver); retval = usb_register(&usb_storage_driver);
if (retval == 0) { 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); usb_usual_set_present(USB_US_TYPE_STOR);
} }
return retval; return retval;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment