linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Santosh Y <santoshsy@gmail.com>
To: james.bottomley@hansenpartnership.com
Cc: linux-scsi@vger.kernel.org, vinholikatti@gmail.com,
	Akinobu Mita <mita@fixstars.com>,
	Seungwon Jeon <tgih.jun@samsung.com>,
	"James E.J. Bottomley" <JBottomley@parallels.com>,
	Santosh Y <santoshsy@gmail.com>
Subject: [PATCH 5/9] ufshcd-pci: release ioremapped region during removing driver
Date: Tue, 30 Jul 2013 00:36:01 +0530	[thread overview]
Message-ID: <1375124765-4110-6-git-send-email-santoshsy@gmail.com> (raw)
In-Reply-To: <1375124765-4110-1-git-send-email-santoshsy@gmail.com>

From: Akinobu Mita <mita@fixstars.com>

Before commit 2953f850c3b80bdca004967c83733365d8aa0aa2 ("[SCSI] ufs:
use devres functions for ufshcd"), UFSHCI register was ioremapped by
each glue-driver (ufshcd-pltfrm and ufshcd-pci) during probing and it
was iounmapped by core-driver during removing driver.  The commit
converted ufshcd-pltfrm to use devres functions, but it didn't convert
ufshcd-pci.

Therefore, the change causes ufshcd-pci driver not to iounmap UFSHCI
register region during removing driver.  This fixes it by converting
ufshcd-pci to use devres functions.

Signed-off-by: Akinobu Mita <mita@fixstars.com>
Cc: Seungwon Jeon <tgih.jun@samsung.com>
Cc: Vinayak Holikatti <vinholikatti@gmail.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Santosh Y <santoshsy@gmail.com>

diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c
index 57ea9dd..24d6ba7 100644
--- a/drivers/scsi/ufs/ufshcd-pci.c
+++ b/drivers/scsi/ufs/ufshcd-pci.c
@@ -134,10 +134,7 @@ static void ufshcd_pci_remove(struct pci_dev *pdev)
 
 	disable_irq(pdev->irq);
 	ufshcd_remove(hba);
-	pci_release_regions(pdev);
 	pci_set_drvdata(pdev, NULL);
-	pci_clear_master(pdev);
-	pci_disable_device(pdev);
 }
 
 /**
@@ -174,38 +171,32 @@ ufshcd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	void __iomem *mmio_base;
 	int err;
 
-	err = pci_enable_device(pdev);
+	err = pcim_enable_device(pdev);
 	if (err) {
-		dev_err(&pdev->dev, "pci_enable_device failed\n");
-		goto out_error;
+		dev_err(&pdev->dev, "pcim_enable_device failed\n");
+		return err;
 	}
 
 	pci_set_master(pdev);
 
-
-	err = pci_request_regions(pdev, UFSHCD);
+	err = pcim_iomap_regions(pdev, 1 << 0, UFSHCD);
 	if (err < 0) {
-		dev_err(&pdev->dev, "request regions failed\n");
-		goto out_disable;
+		dev_err(&pdev->dev, "request and iomap failed\n");
+		return err;
 	}
 
-	mmio_base = pci_ioremap_bar(pdev, 0);
-	if (!mmio_base) {
-		dev_err(&pdev->dev, "memory map failed\n");
-		err = -ENOMEM;
-		goto out_release_regions;
-	}
+	mmio_base = pcim_iomap_table(pdev)[0];
 
 	err = ufshcd_set_dma_mask(pdev);
 	if (err) {
 		dev_err(&pdev->dev, "set dma mask failed\n");
-		goto out_iounmap;
+		return err;
 	}
 
 	err = ufshcd_init(&pdev->dev, &hba, mmio_base, pdev->irq);
 	if (err) {
 		dev_err(&pdev->dev, "Initialization failed\n");
-		goto out_iounmap;
+		return err;
 	}
 
 	pci_set_drvdata(pdev, hba);
@@ -213,16 +204,6 @@ ufshcd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	pm_runtime_allow(&pdev->dev);
 
 	return 0;
-
-out_iounmap:
-	iounmap(mmio_base);
-out_release_regions:
-	pci_release_regions(pdev);
-out_disable:
-	pci_clear_master(pdev);
-	pci_disable_device(pdev);
-out_error:
-	return err;
 }
 
 static const struct dev_pm_ops ufshcd_pci_pm_ops = {
-- 
1.8.3.1


  parent reply	other threads:[~2013-07-29 19:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-29 19:05 [PATCH 0/9] scsi:ufs: query, bkops support and other fixes Santosh Y
2013-07-29 19:05 ` [PATCH 1/9] scsi: ufs: Add support for sending NOP OUT UPIU Santosh Y
2013-08-23 18:17   ` James Bottomley
2013-08-26  3:11     ` Sujit Reddy Thumma
2013-08-26  8:55       ` James Bottomley
2013-07-29 19:05 ` [PATCH 2/9] scsi: ufs: Set fDeviceInit flag to initiate device initialization Santosh Y
2013-07-29 19:05 ` [PATCH 3/9] scsi: ufs: Add support for host assisted background operations Santosh Y
2013-07-29 19:06 ` [PATCH 4/9] scsi: ufs: Add runtime PM support for UFS host controller driver Santosh Y
2013-07-29 19:06 ` Santosh Y [this message]
2013-07-29 19:06 ` [PATCH 6/9] ufs: don't disable_irq() if the IRQ can be shared among devices Santosh Y
2013-07-29 19:06 ` [PATCH 7/9] ufs: don't stop controller before scsi_remove_host() Santosh Y
2013-07-29 19:06 ` [PATCH 8/9] ufshcd-pltfrm: remove redundant dev_err call in ufshcd_pltfrm_probe() Santosh Y
2013-07-29 19:06 ` [PATCH 9/9] drivers/scsi/ufs: don't check resource with devm_ioremap_resource Santosh Y
  -- strict thread matches above, loose matches on Subject: below --
2013-07-28 17:10 [PATCH 0/9] scsi:ufs: query, bkops support and other fixes Santosh Y
2013-07-28 17:10 ` [PATCH 5/9] ufshcd-pci: release ioremapped region during removing driver Santosh Y

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=1375124765-4110-6-git-send-email-santoshsy@gmail.com \
    --to=santoshsy@gmail.com \
    --cc=JBottomley@parallels.com \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mita@fixstars.com \
    --cc=tgih.jun@samsung.com \
    --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;
as well as URLs for NNTP newsgroup(s).