diff options
| author | Heiner Kallweit <hkallweit1@gmail.com> | 2016-08-03 15:46:47 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-08-09 09:59:35 -0400 |
| commit | a094760b9a77f81ee3cbeff323ee77c928f41106 (patch) | |
| tree | bb56d7c711598923da6e73c24eb37640a7626681 /drivers/usb/storage | |
| parent | 833415a3e781a26fe480a34d45086bdb4fe1e4c0 (diff) | |
usb: storage: fix runtime pm issue in usb_stor_probe2
Since commit 71723f95463d "PM / runtime: print error when activating a
child to unactive parent" I see the following error message:
scsi host2: usb-storage 1-3:1.0
scsi host2: runtime PM trying to activate child device host2 but parent
(1-3:1.0) is not active
Digging into it it seems to be related to the problem described in the
commit message for cd998ded5c12 "i2c: designware: Prevent runtime
suspend during adapter registration" as scsi_add_host also calls
device_add and after the call to device_add the parent device is
suspended.
Fix this by using the approach from the mentioned commit and getting
the runtime pm reference before calling scsi_add_host.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/storage')
| -rw-r--r-- | drivers/usb/storage/usb.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index ef2d8cde6ef7..8c5f0115166a 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
| @@ -1070,17 +1070,17 @@ int usb_stor_probe2(struct us_data *us) | |||
| 1070 | result = usb_stor_acquire_resources(us); | 1070 | result = usb_stor_acquire_resources(us); |
| 1071 | if (result) | 1071 | if (result) |
| 1072 | goto BadDevice; | 1072 | goto BadDevice; |
| 1073 | usb_autopm_get_interface_no_resume(us->pusb_intf); | ||
| 1073 | snprintf(us->scsi_name, sizeof(us->scsi_name), "usb-storage %s", | 1074 | snprintf(us->scsi_name, sizeof(us->scsi_name), "usb-storage %s", |
| 1074 | dev_name(&us->pusb_intf->dev)); | 1075 | dev_name(&us->pusb_intf->dev)); |
| 1075 | result = scsi_add_host(us_to_host(us), dev); | 1076 | result = scsi_add_host(us_to_host(us), dev); |
| 1076 | if (result) { | 1077 | if (result) { |
| 1077 | dev_warn(dev, | 1078 | dev_warn(dev, |
| 1078 | "Unable to add the scsi host\n"); | 1079 | "Unable to add the scsi host\n"); |
| 1079 | goto BadDevice; | 1080 | goto HostAddErr; |
| 1080 | } | 1081 | } |
| 1081 | 1082 | ||
| 1082 | /* Submit the delayed_work for SCSI-device scanning */ | 1083 | /* Submit the delayed_work for SCSI-device scanning */ |
| 1083 | usb_autopm_get_interface_no_resume(us->pusb_intf); | ||
| 1084 | set_bit(US_FLIDX_SCAN_PENDING, &us->dflags); | 1084 | set_bit(US_FLIDX_SCAN_PENDING, &us->dflags); |
| 1085 | 1085 | ||
| 1086 | if (delay_use > 0) | 1086 | if (delay_use > 0) |
| @@ -1090,6 +1090,8 @@ int usb_stor_probe2(struct us_data *us) | |||
| 1090 | return 0; | 1090 | return 0; |
| 1091 | 1091 | ||
| 1092 | /* We come here if there are any problems */ | 1092 | /* We come here if there are any problems */ |
| 1093 | HostAddErr: | ||
| 1094 | usb_autopm_put_interface_no_suspend(us->pusb_intf); | ||
| 1093 | BadDevice: | 1095 | BadDevice: |
| 1094 | usb_stor_dbg(us, "storage_probe() failed\n"); | 1096 | usb_stor_dbg(us, "storage_probe() failed\n"); |
| 1095 | release_everything(us); | 1097 | release_everything(us); |
