]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00231273-02 mmc: sdhci: fix failed to call platform exit on removal
authorRyan QIAN <b32804@freescale.com>
Fri, 26 Oct 2012 02:13:34 +0000 (10:13 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:35:41 +0000 (08:35 +0200)
Since sdhci_pltfm_data is stored in platform_device_id, but in
sdhci_pltfm_remove, it tried to get sdhci_pltfm_data directly from
pdev->dev.platform_data. It will result that it could not get the correct
sdhci_pltfm_data, so that platform exit will not be called on sdhci module's
removal.

Acked-by: Dong Aisheng <b29396@freescale.com>
Signed-off-by: Ryan QIAN <b32804@freescale.com>
drivers/mmc/host/sdhci-pltfm.c

index dbab0407f4b643726fea113d985d48892d849e97..61f3aafca10889c64e1dac7f0720862b7c20540f 100644 (file)
@@ -140,12 +140,18 @@ err:
 
 static int __devexit sdhci_pltfm_remove(struct platform_device *pdev)
 {
-       struct sdhci_pltfm_data *pdata = pdev->dev.platform_data;
+       const struct platform_device_id *platid = platform_get_device_id(pdev);
+       struct sdhci_pltfm_data *pdata;
        struct sdhci_host *host = platform_get_drvdata(pdev);
        struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        int dead;
        u32 scratch;
 
+       if (platid && platid->driver_data)
+               pdata = (void *)platid->driver_data;
+       else
+               pdata = pdev->dev.platform_data;
+
        dead = 0;
        scratch = readl(host->ioaddr + SDHCI_INT_STATUS);
        if (scratch == (u32)-1)