Skip to contentSkip to conversation

mmc: sdhci-bcm-kona: Use sdhci_pltfm_unregister instead of open coded

PATCH In review Axel Lin 4 participants 5 messages Sep 17, 2013 – Sep 26, 2013

Subsystems (4)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/2 mmc: sdhci-bcm-kona: Use sdhci_pltfm_unregister instead of open coded

This avoid duplicated implementation and also fixes missing iounmap() and release_mem_region() calls in sdhci_bcm_kona_remove(). sdhci_pltfm_init() calls request_mem_region() and ioremap(), thus we need to call the corresponding iounmap() and release_mem_region() calls in sdhci_bcm_kona_remove().

---
 drivers/mmc/host/sdhci-bcm-kona.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/mmc/host/sdhci-bcm-kona.c +1 -13
index 85472d3..7a190fe 100644
@@ -316,19 +316,7 @@ err_pltfm_free:
 
 static int __exit sdhci_bcm_kona_remove(struct platform_device *pdev)
 {
-	struct sdhci_host *host = platform_get_drvdata(pdev);
-	int dead;
-	u32 scratch;
-
-	dead = 0;
-	scratch = readl(host->ioaddr + SDHCI_INT_STATUS);
-	if (scratch == (u32)-1)
-		dead = 1;
-	sdhci_remove_host(host, dead);
-
-	sdhci_free_host(host);
-
-	return 0;
+	return sdhci_pltfm_unregister(pdev);
 }
 
 static struct platform_driver sdhci_bcm_kona_driver = {
Signature · 1 line
1.8.1.2
author
#1 lore raw

PATCH 2/2 mmc: sdhci-bcm2835: Use sdhci_pltfm_unregister instead of open coded

This avoid duplicated implementation.

---
 drivers/mmc/host/sdhci-bcm2835.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/mmc/host/sdhci-bcm2835.c +1 -7
index 36fa2df..f6d8d67 100644
@@ -178,13 +178,7 @@ err:
 
 static int bcm2835_sdhci_remove(struct platform_device *pdev)
 {
-	struct sdhci_host *host = platform_get_drvdata(pdev);
-	int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);
-
-	sdhci_remove_host(host, dead);
-	sdhci_pltfm_free(pdev);
-
-	return 0;
+	return sdhci_pltfm_unregister(pdev);
 }
 
 static const struct of_device_id bcm2835_sdhci_of_match[] = {
Signature · 1 line
1.8.1.2
Acked-by on v1 1/2
#3 lore raw
In reply to Axel Lin
Quoted 26 lines · Axel Lin

This avoid duplicated implementation and also fixes missing iounmap() and release_mem_region() calls in sdhci_bcm_kona_remove(). sdhci_pltfm_init() calls request_mem_region() and ioremap(), thus we need to call the corresponding iounmap() and release_mem_region() calls in sdhci_bcm_kona_remove().

---
  drivers/mmc/host/sdhci-bcm-kona.c | 14 +-------------
  1 file changed, 1 insertion(+), 13 deletions(-)
drivers/mmc/host/sdhci-bcm-kona.c +0 -7
index 85472d3..7a190fe 100644
@@ -316,19 +316,7 @@ err_pltfm_free:
 
  static int __exit sdhci_bcm_kona_remove(struct platform_device *pdev)
  {
-	struct sdhci_host *host = platform_get_drvdata(pdev);
-	int dead;
-	u32 scratch;
-
-	dead = 0;
-	scratch = readl(host->ioaddr + SDHCI_INT_STATUS);
-	if (scratch == (u32)-1)

drivers/mmc/host/sdhci-bcm-kona.c err_pltfm_free: · line 322

Quoted 10 lines
drivers/mmc/host/sdhci-bcm-kona.c +1 -6
-		dead = 1;
-	sdhci_remove_host(host, dead);
-
-	sdhci_free_host(host);
-
-	return 0;
+	return sdhci_pltfm_unregister(pdev);
  }
 
  static struct platform_driver sdhci_bcm_kona_driver = {

Thanks !
csd

#4 lore raw
In reply to Axel Lin

Hi Axel,

Quoted 7 lines · Axel Lin

This avoid duplicated implementation and also fixes missing iounmap() and release_mem_region() calls in sdhci_bcm_kona_remove(). sdhci_pltfm_init() calls request_mem_region() and ioremap(), thus we need to call the corresponding iounmap() and release_mem_region() calls in sdhci_bcm_kona_remove().

Thanks, pushed to mmc-next for 3.13.

- Chris.

Signature · 1 line
Chris Ball   <[email protected]>   <http://printf.net/>