summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
authorSubhash Jadavani <subhashj@codeaurora.org>2014-09-10 07:54:09 -0400
committerChristoph Hellwig <hch@lst.de>2014-09-15 19:02:05 -0400
commit6fe8c1dbefd63ef3988edb745d9eb81fc6d0513c (patch)
tree004e03b101ba8afc0886b9356d62f04bf45cacc9 /drivers/scsi/sd.c
parent50c4e96411a6cd728f04cf70d8d6def57828b320 (diff)
scsi: balance out autopm get/put calls in scsi_sysfs_add_sdev()
SCSI Well-known logical units generally don't have any scsi driver associated with it which means no one will call scsi_autopm_put_device() on these wlun scsi devices and this would result in keeping the corresponding scsi device always active (hence LLD can't be suspended as well). Same exact problem can be seen for other scsi device representing normal logical unit whose driver is yet to be loaded. This patch fixes the above problem with this approach: - make the scsi_autopm_put_device call at the end of scsi_sysfs_add_sdev to make it balance out the get earlier in the function. - let drivers do paired get/put calls in their probe methods. Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org> Signed-off-by: Dolev Raviv <draviv@codeaurora.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c2
1 files changed, 2 insertions, 0 deletions
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