mmc: sdhci-of-esdhc: remove platform_suspend/platform_resume callbacks
authorRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 25 Apr 2014 11:59:46 +0000 (12:59 +0100)
committerChris Ball <chris@printf.net>
Thu, 22 May 2014 12:33:27 +0000 (08:33 -0400)
We don't need these hooks in order to insert code in these paths, we
can just provide our own handlers and call the main sdhci handlers as
appropriate.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-by: Markus Pargmann <mpa@pengutronix.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
drivers/mmc/host/sdhci-of-esdhc.c

index fcaeae5f55b8ff8c24de65a5b8e1da0a4d3853f6..605815e52f5f58b21291691eeaa8c86cf1e77183 100644 (file)
@@ -241,20 +241,6 @@ static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock)
        mdelay(1);
 }
 
-#ifdef CONFIG_PM
-static u32 esdhc_proctl;
-static void esdhc_of_suspend(struct sdhci_host *host)
-{
-       esdhc_proctl = sdhci_be32bs_readl(host, SDHCI_HOST_CONTROL);
-}
-
-static void esdhc_of_resume(struct sdhci_host *host)
-{
-       esdhc_of_enable_dma(host);
-       sdhci_be32bs_writel(host, esdhc_proctl, SDHCI_HOST_CONTROL);
-}
-#endif
-
 static void esdhc_of_platform_init(struct sdhci_host *host)
 {
        u32 vvn;
@@ -302,16 +288,47 @@ static const struct sdhci_ops sdhci_esdhc_ops = {
        .get_max_clock = esdhc_of_get_max_clock,
        .get_min_clock = esdhc_of_get_min_clock,
        .platform_init = esdhc_of_platform_init,
-#ifdef CONFIG_PM
-       .platform_suspend = esdhc_of_suspend,
-       .platform_resume = esdhc_of_resume,
-#endif
        .adma_workaround = esdhci_of_adma_workaround,
        .set_bus_width = esdhc_pltfm_set_bus_width,
        .reset = sdhci_reset,
        .set_uhs_signaling = sdhci_set_uhs_signaling,
 };
 
+#ifdef CONFIG_PM
+
+static u32 esdhc_proctl;
+static int esdhc_of_suspend(struct device *dev)
+{
+       struct sdhci_host *host = dev_get_drvdata(dev);
+
+       esdhc_proctl = sdhci_be32bs_readl(host, SDHCI_HOST_CONTROL);
+
+       return sdhci_suspend_host(host);
+}
+
+static void esdhc_of_resume(device *dev)
+{
+       struct sdhci_host *host = dev_get_drvdata(dev);
+       int ret = sdhci_resume_host(host);
+
+       if (ret == 0) {
+               /* Isn't this already done by sdhci_resume_host() ? --rmk */
+               esdhc_of_enable_dma(host);
+               sdhci_be32bs_writel(host, esdhc_proctl, SDHCI_HOST_CONTROL);
+       }
+
+       return ret;
+}
+
+static const struct dev_pm_ops esdhc_pmops = {
+       .suspend        = esdhci_of_suspend,
+       .resume         = esdhci_of_resume,
+};
+#define ESDHC_PMOPS (&esdhc_pmops)
+#else
+#define ESDHC_PMOPS NULL
+#endif
+
 static const struct sdhci_pltfm_data sdhci_esdhc_pdata = {
        /*
         * card detection could be handled via GPIO
@@ -373,7 +390,7 @@ static struct platform_driver sdhci_esdhc_driver = {
                .name = "sdhci-esdhc",
                .owner = THIS_MODULE,
                .of_match_table = sdhci_esdhc_of_match,
-               .pm = SDHCI_PLTFM_PMOPS,
+               .pm = ESDHC_PMOPS,
        },
        .probe = sdhci_esdhc_probe,
        .remove = sdhci_esdhc_remove,
This page took 0.026217 seconds and 5 git commands to generate.