aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2012-03-14 05:18:27 -0400
committerChris Ball <cjb@laptop.org>2012-04-05 20:32:28 -0400
commit927ce944aebdcac0fa757d4e6448a6972184db8c (patch)
treee139b283a6c916b4d9a1614962bd4e9dd5b62db1
parent92a3aebf06bdef849cc53aba99f963a9ae397e9d (diff)
mmc: omap_hsmmc: trivial cleanups
A bunch of non-functional cleanups to the omap_hsmmc driver. It basically decreases indentation level, drop unneded dereferences and drop unneded accesses to the platform_device structure. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Venkatraman S <svenkatr@ti.com> Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r--drivers/mmc/host/omap_hsmmc.c147
1 files changed, 70 insertions, 77 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 4ee1570d18d6..920964ac3214 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2041,30 +2041,28 @@ static int omap_hsmmc_remove(struct platform_device *pdev)
2041 struct omap_hsmmc_host *host = platform_get_drvdata(pdev); 2041 struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
2042 struct resource *res; 2042 struct resource *res;
2043 2043
2044 if (host) { 2044 pm_runtime_get_sync(host->dev);
2045 pm_runtime_get_sync(host->dev); 2045 mmc_remove_host(host->mmc);
2046 mmc_remove_host(host->mmc); 2046 if (host->use_reg)
2047 if (host->use_reg) 2047 omap_hsmmc_reg_put(host);
2048 omap_hsmmc_reg_put(host); 2048 if (host->pdata->cleanup)
2049 if (host->pdata->cleanup) 2049 host->pdata->cleanup(&pdev->dev);
2050 host->pdata->cleanup(&pdev->dev); 2050 free_irq(host->irq, host);
2051 free_irq(host->irq, host); 2051 if (mmc_slot(host).card_detect_irq)
2052 if (mmc_slot(host).card_detect_irq) 2052 free_irq(mmc_slot(host).card_detect_irq, host);
2053 free_irq(mmc_slot(host).card_detect_irq, host);
2054
2055 pm_runtime_put_sync(host->dev);
2056 pm_runtime_disable(host->dev);
2057 clk_put(host->fclk);
2058 if (host->got_dbclk) {
2059 clk_disable(host->dbclk);
2060 clk_put(host->dbclk);
2061 }
2062 2053
2063 mmc_free_host(host->mmc); 2054 pm_runtime_put_sync(host->dev);
2064 iounmap(host->base); 2055 pm_runtime_disable(host->dev);
2065 omap_hsmmc_gpio_free(pdev->dev.platform_data); 2056 clk_put(host->fclk);
2057 if (host->got_dbclk) {
2058 clk_disable(host->dbclk);
2059 clk_put(host->dbclk);
2066 } 2060 }
2067 2061
2062 mmc_free_host(host->mmc);
2063 iounmap(host->base);
2064 omap_hsmmc_gpio_free(pdev->dev.platform_data);
2065
2068 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 2066 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2069 if (res) 2067 if (res)
2070 release_mem_region(res->start, resource_size(res)); 2068 release_mem_region(res->start, resource_size(res));
@@ -2077,49 +2075,45 @@ static int omap_hsmmc_remove(struct platform_device *pdev)
2077static int omap_hsmmc_suspend(struct device *dev) 2075static int omap_hsmmc_suspend(struct device *dev)
2078{ 2076{
2079 int ret = 0; 2077 int ret = 0;
2080 struct platform_device *pdev = to_platform_device(dev); 2078 struct omap_hsmmc_host *host = dev_get_drvdata(dev);
2081 struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
2082 2079
2083 if (host && host->suspended) 2080 if (!host)
2084 return 0; 2081 return 0;
2085 2082
2086 if (host) { 2083 if (host && host->suspended)
2087 pm_runtime_get_sync(host->dev); 2084 return 0;
2088 host->suspended = 1;
2089 if (host->pdata->suspend) {
2090 ret = host->pdata->suspend(&pdev->dev,
2091 host->slot_id);
2092 if (ret) {
2093 dev_dbg(mmc_dev(host->mmc),
2094 "Unable to handle MMC board"
2095 " level suspend\n");
2096 host->suspended = 0;
2097 return ret;
2098 }
2099 }
2100 ret = mmc_suspend_host(host->mmc);
2101 2085
2086 pm_runtime_get_sync(host->dev);
2087 host->suspended = 1;
2088 if (host->pdata->suspend) {
2089 ret = host->pdata->suspend(dev, host->slot_id);
2102 if (ret) { 2090 if (ret) {
2091 dev_dbg(dev, "Unable to handle MMC board"
2092 " level suspend\n");
2103 host->suspended = 0; 2093 host->suspended = 0;
2104 if (host->pdata->resume) { 2094 return ret;
2105 ret = host->pdata->resume(&pdev->dev,
2106 host->slot_id);
2107 if (ret)
2108 dev_dbg(mmc_dev(host->mmc),
2109 "Unmask interrupt failed\n");
2110 }
2111 goto err;
2112 } 2095 }
2096 }
2097 ret = mmc_suspend_host(host->mmc);
2113 2098
2114 if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) { 2099 if (ret) {
2115 omap_hsmmc_disable_irq(host); 2100 host->suspended = 0;
2116 OMAP_HSMMC_WRITE(host->base, HCTL, 2101 if (host->pdata->resume) {
2117 OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP); 2102 ret = host->pdata->resume(dev, host->slot_id);
2103 if (ret)
2104 dev_dbg(dev, "Unmask interrupt failed\n");
2118 } 2105 }
2119 if (host->got_dbclk) 2106 goto err;
2120 clk_disable(host->dbclk); 2107 }
2121 2108
2109 if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) {
2110 omap_hsmmc_disable_irq(host);
2111 OMAP_HSMMC_WRITE(host->base, HCTL,
2112 OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP);
2122 } 2113 }
2114
2115 if (host->got_dbclk)
2116 clk_disable(host->dbclk);
2123err: 2117err:
2124 pm_runtime_put_sync(host->dev); 2118 pm_runtime_put_sync(host->dev);
2125 return ret; 2119 return ret;
@@ -2129,38 +2123,37 @@ err:
2129static int omap_hsmmc_resume(struct device *dev) 2123static int omap_hsmmc_resume(struct device *dev)
2130{ 2124{
2131 int ret = 0; 2125 int ret = 0;
2132 struct platform_device *pdev = to_platform_device(dev); 2126 struct omap_hsmmc_host *host = dev_get_drvdata(dev);
2133 struct omap_hsmmc_host *host = platform_get_drvdata(pdev); 2127
2128 if (!host)
2129 return 0;
2134 2130
2135 if (host && !host->suspended) 2131 if (host && !host->suspended)
2136 return 0; 2132 return 0;
2137 2133
2138 if (host) { 2134 pm_runtime_get_sync(host->dev);
2139 pm_runtime_get_sync(host->dev);
2140 2135
2141 if (host->got_dbclk) 2136 if (host->got_dbclk)
2142 clk_enable(host->dbclk); 2137 clk_enable(host->dbclk);
2143 2138
2144 if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) 2139 if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER))
2145 omap_hsmmc_conf_bus_power(host); 2140 omap_hsmmc_conf_bus_power(host);
2146 2141
2147 if (host->pdata->resume) { 2142 if (host->pdata->resume) {
2148 ret = host->pdata->resume(&pdev->dev, host->slot_id); 2143 ret = host->pdata->resume(dev, host->slot_id);
2149 if (ret) 2144 if (ret)
2150 dev_dbg(mmc_dev(host->mmc), 2145 dev_dbg(dev, "Unmask interrupt failed\n");
2151 "Unmask interrupt failed\n"); 2146 }
2152 }
2153 2147
2154 omap_hsmmc_protect_card(host); 2148 omap_hsmmc_protect_card(host);
2155 2149
2156 /* Notify the core to resume the host */ 2150 /* Notify the core to resume the host */
2157 ret = mmc_resume_host(host->mmc); 2151 ret = mmc_resume_host(host->mmc);
2158 if (ret == 0) 2152 if (ret == 0)
2159 host->suspended = 0; 2153 host->suspended = 0;
2160 2154
2161 pm_runtime_mark_last_busy(host->dev); 2155 pm_runtime_mark_last_busy(host->dev);
2162 pm_runtime_put_autosuspend(host->dev); 2156 pm_runtime_put_autosuspend(host->dev);
2163 }
2164 2157
2165 return ret; 2158 return ret;
2166 2159
@@ -2177,7 +2170,7 @@ static int omap_hsmmc_runtime_suspend(struct device *dev)
2177 2170
2178 host = platform_get_drvdata(to_platform_device(dev)); 2171 host = platform_get_drvdata(to_platform_device(dev));
2179 omap_hsmmc_context_save(host); 2172 omap_hsmmc_context_save(host);
2180 dev_dbg(mmc_dev(host->mmc), "disabled\n"); 2173 dev_dbg(dev, "disabled\n");
2181 2174
2182 return 0; 2175 return 0;
2183} 2176}
@@ -2188,7 +2181,7 @@ static int omap_hsmmc_runtime_resume(struct device *dev)
2188 2181
2189 host = platform_get_drvdata(to_platform_device(dev)); 2182 host = platform_get_drvdata(to_platform_device(dev));
2190 omap_hsmmc_context_restore(host); 2183 omap_hsmmc_context_restore(host);
2191 dev_dbg(mmc_dev(host->mmc), "enabled\n"); 2184 dev_dbg(dev, "enabled\n");
2192 2185
2193 return 0; 2186 return 0;
2194} 2187}