diff options
| -rw-r--r-- | drivers/scsi/scsi_sysfs.c | 5 | ||||
| -rw-r--r-- | drivers/scsi/sd.c | 2 | ||||
| -rw-r--r-- | drivers/scsi/sr.c | 2 | ||||
| -rw-r--r-- | drivers/scsi/st.c | 2 |
4 files changed, 7 insertions, 4 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 85e36f3a5585..f4cb7b3e9e23 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
| @@ -1044,10 +1044,6 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) | |||
| 1044 | pm_runtime_enable(&sdev->sdev_gendev); | 1044 | pm_runtime_enable(&sdev->sdev_gendev); |
| 1045 | scsi_autopm_put_target(starget); | 1045 | scsi_autopm_put_target(starget); |
| 1046 | 1046 | ||
| 1047 | /* The following call will keep sdev active indefinitely, until | ||
| 1048 | * its driver does a corresponding scsi_autopm_pm_device(). Only | ||
| 1049 | * drivers supporting autosuspend will do this. | ||
| 1050 | */ | ||
| 1051 | scsi_autopm_get_device(sdev); | 1047 | scsi_autopm_get_device(sdev); |
| 1052 | 1048 | ||
| 1053 | error = device_add(&sdev->sdev_gendev); | 1049 | error = device_add(&sdev->sdev_gendev); |
| @@ -1085,6 +1081,7 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) | |||
| 1085 | } | 1081 | } |
| 1086 | } | 1082 | } |
| 1087 | 1083 | ||
| 1084 | scsi_autopm_put_device(sdev); | ||
| 1088 | return error; | 1085 | return error; |
| 1089 | } | 1086 | } |
| 1090 | 1087 | ||
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index aa43496b7b93..0cb5c9f0c743 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
| @@ -2965,6 +2965,7 @@ static int sd_probe(struct device *dev) | |||
| 2965 | int index; | 2965 | int index; |
| 2966 | int error; | 2966 | int error; |
| 2967 | 2967 | ||
| 2968 | scsi_autopm_get_device(sdp); | ||
| 2968 | error = -ENODEV; | 2969 | error = -ENODEV; |
| 2969 | if (sdp->type != TYPE_DISK && sdp->type != TYPE_MOD && sdp->type != TYPE_RBC) | 2970 | if (sdp->type != TYPE_DISK && sdp->type != TYPE_MOD && sdp->type != TYPE_RBC) |
| 2970 | goto out; | 2971 | goto out; |
| @@ -3041,6 +3042,7 @@ static int sd_probe(struct device *dev) | |||
| 3041 | out_free: | 3042 | out_free: |
| 3042 | kfree(sdkp); | 3043 | kfree(sdkp); |
| 3043 | out: | 3044 | out: |
| 3045 | scsi_autopm_put_device(sdp); | ||
| 3044 | return error; | 3046 | return error; |
| 3045 | } | 3047 | } |
| 3046 | 3048 | ||
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 7eeb93627beb..2de44cc58b1a 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c | |||
| @@ -657,6 +657,7 @@ static int sr_probe(struct device *dev) | |||
| 657 | struct scsi_cd *cd; | 657 | struct scsi_cd *cd; |
| 658 | int minor, error; | 658 | int minor, error; |
| 659 | 659 | ||
| 660 | scsi_autopm_get_device(sdev); | ||
| 660 | error = -ENODEV; | 661 | error = -ENODEV; |
| 661 | if (sdev->type != TYPE_ROM && sdev->type != TYPE_WORM) | 662 | if (sdev->type != TYPE_ROM && sdev->type != TYPE_WORM) |
| 662 | goto fail; | 663 | goto fail; |
| @@ -744,6 +745,7 @@ fail_put: | |||
| 744 | fail_free: | 745 | fail_free: |
| 745 | kfree(cd); | 746 | kfree(cd); |
| 746 | fail: | 747 | fail: |
| 748 | scsi_autopm_put_device(sdev); | ||
| 747 | return error; | 749 | return error; |
| 748 | } | 750 | } |
| 749 | 751 | ||
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index aff9689de0f7..d3fd6e8fb378 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
| @@ -4105,6 +4105,7 @@ static int st_probe(struct device *dev) | |||
| 4105 | return -ENODEV; | 4105 | return -ENODEV; |
| 4106 | } | 4106 | } |
| 4107 | 4107 | ||
| 4108 | scsi_autopm_get_device(SDp); | ||
| 4108 | i = queue_max_segments(SDp->request_queue); | 4109 | i = queue_max_segments(SDp->request_queue); |
| 4109 | if (st_max_sg_segs < i) | 4110 | if (st_max_sg_segs < i) |
| 4110 | i = st_max_sg_segs; | 4111 | i = st_max_sg_segs; |
| @@ -4244,6 +4245,7 @@ out_put_disk: | |||
| 4244 | out_buffer_free: | 4245 | out_buffer_free: |
| 4245 | kfree(buffer); | 4246 | kfree(buffer); |
| 4246 | out: | 4247 | out: |
| 4248 | scsi_autopm_put_device(SDp); | ||
| 4247 | return -ENODEV; | 4249 | return -ENODEV; |
| 4248 | }; | 4250 | }; |
| 4249 | 4251 | ||
