From patchwork Mon May 4 14:46:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 6327221 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C56CABEEE1 for ; Mon, 4 May 2015 14:46:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E36FD20351 for ; Mon, 4 May 2015 14:46:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0B7D2202E6 for ; Mon, 4 May 2015 14:46:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751489AbbEDOqg (ORCPT ); Mon, 4 May 2015 10:46:36 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:35004 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750863AbbEDOqf (ORCPT ); Mon, 4 May 2015 10:46:35 -0400 Received: by pdbqd1 with SMTP id qd1so164998365pdb.2 for ; Mon, 04 May 2015 07:46:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZUwP4l9OlS+8NQT2HoPKolsA3q/2AO+6wjL0iel/XVc=; b=YfsrNEg9cTJqDzqUSgr275aklgSVYzazavroZ1+AyV3MLiw1HD7F+Qy1RS/JHQrTSv Ghz+Xq2FIxb1Wwjo0ugQ3phmsHTpMnwSMsflE3hLDDvZ8PTpgT716xeKGXJ/OjDSIpDc xDTJBx7Zxw6KSmUY+6jnKanFyrrw6NRZY6nuONtYEVBLX7r1Qh3FpVwHXiTcqdZk6UbF P1OHWwG1TufjM/vyErVeXPIi9LHwzICyWdRZwWPbszZLqmMWYFnmGZLtb8K9zd4thNxm kZlcEb1cOvaqP2HBL+CPUvtvljm26f/q2HmevjeaO/ulzj25BdHIrniZqaFu4vJd0p2e bE2w== X-Received: by 10.70.138.70 with SMTP id qo6mr42298045pdb.163.1430750794778; Mon, 04 May 2015 07:46:34 -0700 (PDT) Received: from localhost.localdomain (KD106168100169.ppp-bb.dion.ne.jp. [106.168.100.169]) by mx.google.com with ESMTPSA id om10sm13036162pbb.58.2015.05.04.07.46.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 May 2015 07:46:33 -0700 (PDT) From: Akinobu Mita To: linux-scsi@vger.kernel.org Cc: Akinobu Mita , Vinayak Holikatti , Dolev Raviv , Sujit Reddy Thumma , Subhash Jadavani , Christoph Hellwig , "James E.J. Bottomley" Subject: [PATCH v6 2/4] scsi: ufs: adjust module reference for scsi host Date: Mon, 4 May 2015 23:46:07 +0900 Message-Id: <1430750769-11405-3-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430750769-11405-1-git-send-email-akinobu.mita@gmail.com> References: <1430750769-11405-1-git-send-email-akinobu.mita@gmail.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Vinayak Holikatti Cc: Dolev Raviv Cc: Sujit Reddy Thumma Cc: Subhash Jadavani Cc: Christoph Hellwig Cc: "James E.J. Bottomley" 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,