]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: balance out autopm get/put calls in scsi_sysfs_add_sdev()
authorSubhash Jadavani <subhashj@codeaurora.org>
Wed, 10 Sep 2014 11:54:09 +0000 (14:54 +0300)
committerChristoph Hellwig <hch@lst.de>
Mon, 15 Sep 2014 23:02:05 +0000 (16:02 -0700)
commit4ec2255c2fee41ac5deb9d9e4e839c5e86b3f47e
tree004e03b101ba8afc0886b9356d62f04bf45cacc9
parentba840c682de56773c158b519a373722dec816d54
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>
drivers/scsi/scsi_sysfs.c
drivers/scsi/sd.c
drivers/scsi/sr.c
drivers/scsi/st.c