From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: Akinobu Mita <akinobu.mita@gmail.com>,
Vinayak Holikatti <vinholikatti@gmail.com>,
Dolev Raviv <draviv@codeaurora.org>,
Sujit Reddy Thumma <sthumma@codeaurora.org>,
Subhash Jadavani <subhashj@codeaurora.org>,
Christoph Hellwig <hch@lst.de>,
"James E.J. Bottomley" <JBottomley@parallels.com>
Subject: [PATCH v6 2/4] scsi: ufs: adjust module reference for scsi host
Date: Mon, 4 May 2015 23:46:07 +0900 [thread overview]
Message-ID: <1430750769-11405-3-git-send-email-akinobu.mita@gmail.com> (raw)
In-Reply-To: <1430750769-11405-1-git-send-email-akinobu.mita@gmail.com>
While accessing a UFS device, the module reference count for core driver
(ufshcd) is incremented but not incremented for the actual glue driver
(ufshcd-pci or ufshcd-pltfrm). Because these drivers allocate scsi hosts
with scsi_host_template defined in ufshcd module. So these drivers always
can be unloaded.
This fixes it by adjusting module reference after scsi host allocation.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Vinayak Holikatti <vinholikatti@gmail.com>
Cc: Dolev Raviv <draviv@codeaurora.org>
Cc: Sujit Reddy Thumma <sthumma@codeaurora.org>
Cc: Subhash Jadavani <subhashj@codeaurora.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: linux-scsi@vger.kernel.org
---
drivers/scsi/ufs/ufshcd-pci.c | 1 +
drivers/scsi/ufs/ufshcd-pltfrm.c | 1 +
drivers/scsi/ufs/ufshcd.c | 1 -
3 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c
index d15eaa4..9fe21b4 100644
--- a/drivers/scsi/ufs/ufshcd-pci.c
+++ b/drivers/scsi/ufs/ufshcd-pci.c
@@ -142,6 +142,7 @@ ufshcd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
return err;
}
+ hba->host->module = THIS_MODULE;
INIT_LIST_HEAD(&hba->clk_list_head);
err = ufshcd_init(hba, mmio_base, pdev->irq);
diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c
index e6b29b1..d08e0bb 100644
--- a/drivers/scsi/ufs/ufshcd-pltfrm.c
+++ b/drivers/scsi/ufs/ufshcd-pltfrm.c
@@ -322,6 +322,7 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev)
goto out;
}
+ hba->host->module = THIS_MODULE;
hba->vops = get_variant_ops(&pdev->dev);
err = ufshcd_parse_clock_info(hba);
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 996030b..c499f16 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4237,7 +4237,6 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie)
}
static struct scsi_host_template ufshcd_driver_template = {
- .module = THIS_MODULE,
.name = UFSHCD,
.proc_name = UFSHCD,
.queuecommand = ufshcd_queuecommand,
--
1.9.1
next prev parent reply other threads:[~2015-05-04 14:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-04 14:46 [PATCH v6 0/4] scsi: ufs & ums-* & esp_scsi: fix module reference counting Akinobu Mita
2015-05-04 14:46 ` [PATCH v6 1/4] scsi: add ability to adjust module reference for scsi host Akinobu Mita
2015-05-04 14:46 ` Akinobu Mita [this message]
[not found] ` <1430750769-11405-1-git-send-email-akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-04 14:46 ` [PATCH v6 3/4] usb: storage: " Akinobu Mita
2015-05-04 14:46 ` [PATCH v6 4/4] scsi: esp_scsi: " Akinobu Mita
2015-05-04 15:15 ` [PATCH v6 0/4] scsi: ufs & ums-* & esp_scsi: fix module reference counting James Bottomley
[not found] ` <1430752523.2177.15.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
2015-05-04 15:30 ` Hannes Reinecke
2015-05-04 20:09 ` Alan Stern
2015-05-04 21:41 ` James Bottomley
[not found] ` <1430775664.2177.36.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
2015-05-05 13:39 ` Akinobu Mita
2015-05-05 15:35 ` James Bottomley
2015-05-05 14:25 ` Alan Stern
2015-05-05 18:05 ` James Bottomley
2015-05-05 19:14 ` Alan Stern
2015-05-05 21:42 ` James Bottomley
2015-05-06 9:26 ` Akinobu Mita
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1430750769-11405-3-git-send-email-akinobu.mita@gmail.com \
--to=akinobu.mita@gmail.com \
--cc=JBottomley@parallels.com \
--cc=draviv@codeaurora.org \
--cc=hch@lst.de \
--cc=linux-scsi@vger.kernel.org \
--cc=sthumma@codeaurora.org \
--cc=subhashj@codeaurora.org \
--cc=vinholikatti@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox