diff options
Diffstat (limited to 'drivers/usb/storage/usb.c')
-rw-r--r-- | drivers/usb/storage/usb.c | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index e2798ef2dd19..55c526b81c7c 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -510,6 +510,7 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id, | |||
510 | struct usb_device *dev = us->pusb_dev; | 510 | struct usb_device *dev = us->pusb_dev; |
511 | struct usb_interface_descriptor *idesc = | 511 | struct usb_interface_descriptor *idesc = |
512 | &us->pusb_intf->cur_altsetting->desc; | 512 | &us->pusb_intf->cur_altsetting->desc; |
513 | struct device *pdev = &us->pusb_intf->dev; | ||
513 | 514 | ||
514 | /* Store the entries */ | 515 | /* Store the entries */ |
515 | us->unusual_dev = unusual_dev; | 516 | 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 | adjust_quirks(us); | 524 | adjust_quirks(us); |
524 | 525 | ||
525 | if (us->fflags & US_FL_IGNORE_DEVICE) { | 526 | if (us->fflags & US_FL_IGNORE_DEVICE) { |
526 | printk(KERN_INFO USB_STORAGE "device ignored\n"); | 527 | dev_info(pdev, "device ignored\n"); |
527 | return -ENODEV; | 528 | return -ENODEV; |
528 | } | 529 | } |
529 | 530 | ||
@@ -554,20 +555,20 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id, | |||
554 | us->protocol == idesc->bInterfaceProtocol) | 555 | us->protocol == idesc->bInterfaceProtocol) |
555 | msg += 2; | 556 | msg += 2; |
556 | if (msg >= 0 && !(us->fflags & US_FL_NEED_OVERRIDE)) | 557 | if (msg >= 0 && !(us->fflags & US_FL_NEED_OVERRIDE)) |
557 | printk(KERN_NOTICE USB_STORAGE "This device " | 558 | dev_notice(pdev, "This device " |
558 | "(%04x,%04x,%04x S %02x P %02x)" | 559 | "(%04x,%04x,%04x S %02x P %02x)" |
559 | " has %s in unusual_devs.h (kernel" | 560 | " has %s in unusual_devs.h (kernel" |
560 | " %s)\n" | 561 | " %s)\n" |
561 | " Please send a copy of this message to " | 562 | " Please send a copy of this message to " |
562 | "<linux-usb@vger.kernel.org> and " | 563 | "<linux-usb@vger.kernel.org> and " |
563 | "<usb-storage@lists.one-eyed-alien.net>\n", | 564 | "<usb-storage@lists.one-eyed-alien.net>\n", |
564 | le16_to_cpu(ddesc->idVendor), | 565 | le16_to_cpu(ddesc->idVendor), |
565 | le16_to_cpu(ddesc->idProduct), | 566 | le16_to_cpu(ddesc->idProduct), |
566 | le16_to_cpu(ddesc->bcdDevice), | 567 | le16_to_cpu(ddesc->bcdDevice), |
567 | idesc->bInterfaceSubClass, | 568 | idesc->bInterfaceSubClass, |
568 | idesc->bInterfaceProtocol, | 569 | idesc->bInterfaceProtocol, |
569 | msgs[msg], | 570 | msgs[msg], |
570 | utsname()->release); | 571 | utsname()->release); |
571 | } | 572 | } |
572 | 573 | ||
573 | return 0; | 574 | return 0; |
@@ -717,8 +718,8 @@ static int usb_stor_acquire_resources(struct us_data *us) | |||
717 | /* Start up our control thread */ | 718 | /* Start up our control thread */ |
718 | th = kthread_run(usb_stor_control_thread, us, "usb-storage"); | 719 | th = kthread_run(usb_stor_control_thread, us, "usb-storage"); |
719 | if (IS_ERR(th)) { | 720 | if (IS_ERR(th)) { |
720 | printk(KERN_WARNING USB_STORAGE | 721 | dev_warn(&us->pusb_intf->dev, |
721 | "Unable to start control thread\n"); | 722 | "Unable to start control thread\n"); |
722 | return PTR_ERR(th); | 723 | return PTR_ERR(th); |
723 | } | 724 | } |
724 | us->ctl_thread = th; | 725 | us->ctl_thread = th; |
@@ -811,13 +812,14 @@ static void release_everything(struct us_data *us) | |||
811 | static int usb_stor_scan_thread(void * __us) | 812 | static int usb_stor_scan_thread(void * __us) |
812 | { | 813 | { |
813 | struct us_data *us = (struct us_data *)__us; | 814 | struct us_data *us = (struct us_data *)__us; |
815 | struct device *dev = &us->pusb_intf->dev; | ||
814 | 816 | ||
815 | dev_dbg(&us->pusb_intf->dev, "device found\n"); | 817 | dev_dbg(dev, "device found\n"); |
816 | 818 | ||
817 | set_freezable(); | 819 | set_freezable(); |
818 | /* Wait for the timeout to expire or for a disconnect */ | 820 | /* Wait for the timeout to expire or for a disconnect */ |
819 | if (delay_use > 0) { | 821 | if (delay_use > 0) { |
820 | dev_dbg(&us->pusb_intf->dev, "waiting for device to settle " | 822 | dev_dbg(dev, "waiting for device to settle " |
821 | "before scanning\n"); | 823 | "before scanning\n"); |
822 | wait_event_freezable_timeout(us->delay_wait, | 824 | wait_event_freezable_timeout(us->delay_wait, |
823 | test_bit(US_FLIDX_DONT_SCAN, &us->dflags), | 825 | test_bit(US_FLIDX_DONT_SCAN, &us->dflags), |
@@ -835,7 +837,7 @@ static int usb_stor_scan_thread(void * __us) | |||
835 | mutex_unlock(&us->dev_mutex); | 837 | mutex_unlock(&us->dev_mutex); |
836 | } | 838 | } |
837 | scsi_scan_host(us_to_host(us)); | 839 | scsi_scan_host(us_to_host(us)); |
838 | dev_dbg(&us->pusb_intf->dev, "scan complete\n"); | 840 | dev_dbg(dev, "scan complete\n"); |
839 | 841 | ||
840 | /* Should we unbind if no devices were detected? */ | 842 | /* Should we unbind if no devices were detected? */ |
841 | } | 843 | } |
@@ -871,8 +873,8 @@ int usb_stor_probe1(struct us_data **pus, | |||
871 | */ | 873 | */ |
872 | host = scsi_host_alloc(&usb_stor_host_template, sizeof(*us)); | 874 | host = scsi_host_alloc(&usb_stor_host_template, sizeof(*us)); |
873 | if (!host) { | 875 | if (!host) { |
874 | printk(KERN_WARNING USB_STORAGE | 876 | dev_warn(&intf->dev, |
875 | "Unable to allocate the scsi host\n"); | 877 | "Unable to allocate the scsi host\n"); |
876 | return -ENOMEM; | 878 | return -ENOMEM; |
877 | } | 879 | } |
878 | 880 | ||
@@ -920,6 +922,7 @@ int usb_stor_probe2(struct us_data *us) | |||
920 | { | 922 | { |
921 | struct task_struct *th; | 923 | struct task_struct *th; |
922 | int result; | 924 | int result; |
925 | struct device *dev = &us->pusb_intf->dev; | ||
923 | 926 | ||
924 | /* Make sure the transport and protocol have both been set */ | 927 | /* Make sure the transport and protocol have both been set */ |
925 | if (!us->transport || !us->proto_handler) { | 928 | if (!us->transport || !us->proto_handler) { |
@@ -944,18 +947,18 @@ int usb_stor_probe2(struct us_data *us) | |||
944 | goto BadDevice; | 947 | goto BadDevice; |
945 | snprintf(us->scsi_name, sizeof(us->scsi_name), "usb-storage %s", | 948 | snprintf(us->scsi_name, sizeof(us->scsi_name), "usb-storage %s", |
946 | dev_name(&us->pusb_intf->dev)); | 949 | dev_name(&us->pusb_intf->dev)); |
947 | result = scsi_add_host(us_to_host(us), &us->pusb_intf->dev); | 950 | result = scsi_add_host(us_to_host(us), dev); |
948 | if (result) { | 951 | if (result) { |
949 | printk(KERN_WARNING USB_STORAGE | 952 | dev_warn(dev, |
950 | "Unable to add the scsi host\n"); | 953 | "Unable to add the scsi host\n"); |
951 | goto BadDevice; | 954 | goto BadDevice; |
952 | } | 955 | } |
953 | 956 | ||
954 | /* Start up the thread for delayed SCSI-device scanning */ | 957 | /* Start up the thread for delayed SCSI-device scanning */ |
955 | th = kthread_create(usb_stor_scan_thread, us, "usb-stor-scan"); | 958 | th = kthread_create(usb_stor_scan_thread, us, "usb-stor-scan"); |
956 | if (IS_ERR(th)) { | 959 | if (IS_ERR(th)) { |
957 | printk(KERN_WARNING USB_STORAGE | 960 | dev_warn(dev, |
958 | "Unable to start the device-scanning thread\n"); | 961 | "Unable to start the device-scanning thread\n"); |
959 | complete(&us->scanning_done); | 962 | complete(&us->scanning_done); |
960 | quiesce_and_remove_host(us); | 963 | quiesce_and_remove_host(us); |
961 | result = PTR_ERR(th); | 964 | result = PTR_ERR(th); |
@@ -1041,12 +1044,12 @@ static int __init usb_stor_init(void) | |||
1041 | { | 1044 | { |
1042 | int retval; | 1045 | int retval; |
1043 | 1046 | ||
1044 | printk(KERN_INFO "Initializing USB Mass Storage driver...\n"); | 1047 | pr_info("Initializing USB Mass Storage driver...\n"); |
1045 | 1048 | ||
1046 | /* register the driver, return usb_register return code if error */ | 1049 | /* register the driver, return usb_register return code if error */ |
1047 | retval = usb_register(&usb_storage_driver); | 1050 | retval = usb_register(&usb_storage_driver); |
1048 | if (retval == 0) { | 1051 | if (retval == 0) { |
1049 | printk(KERN_INFO "USB Mass Storage support registered.\n"); | 1052 | pr_info("USB Mass Storage support registered.\n"); |
1050 | usb_usual_set_present(USB_US_TYPE_STOR); | 1053 | usb_usual_set_present(USB_US_TYPE_STOR); |
1051 | } | 1054 | } |
1052 | return retval; | 1055 | return retval; |