ufs: fix reference counting of W-LUs
authorAkinobu Mita <akinobu.mita@gmail.com>
Thu, 23 Oct 2014 10:25:12 +0000 (13:25 +0300)
committerChristoph Hellwig <hch@lst.de>
Thu, 20 Nov 2014 16:01:31 +0000 (17:01 +0100)
commit7c48bfd038e570cd12b33d6ab13316f3a0b0d1a7
tree13ceab3cb6c1d3c607168d82ce5c5b235c5d8b7e
parent1899045510ff109980d9cc34e330fd8ca3631871
ufs: fix reference counting of W-LUs

UFS driver adds three well known LUs in the initialization, but those
reference counts are not decremented, so it makes ufshcd module
impossible to unload.

This fixes it by putting scsi_device_put() in the initalization, and in
order to protect concurrent access to hba->sdev_ufs_device (UFS Device
W-LU) from manual delete, increment the reference count while requesting
device power mode setting.

The rest of W-LUs (hba->sdev_boot and hba->sdev_rpmb) are not directly
used from driver, so these references in struct ufs_hba are removed.

Signed-off-by: Akinobu Mita <mita@fixstars.com>
Reviewed-by: Maya Erez <merez@codeaurora.org>
Reviewed-by: Dolev Raviv <draviv@codeaurora.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/ufs/ufshcd.c
drivers/scsi/ufs/ufshcd.h