mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
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>
This commit is contained in:
parent
92a3aebf06
commit
927ce944ae
1 changed files with 75 additions and 82 deletions
|
@ -2041,30 +2041,28 @@ static int omap_hsmmc_remove(struct platform_device *pdev)
|
||||||
struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
|
struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
|
|
||||||
if (host) {
|
pm_runtime_get_sync(host->dev);
|
||||||
pm_runtime_get_sync(host->dev);
|
mmc_remove_host(host->mmc);
|
||||||
mmc_remove_host(host->mmc);
|
if (host->use_reg)
|
||||||
if (host->use_reg)
|
omap_hsmmc_reg_put(host);
|
||||||
omap_hsmmc_reg_put(host);
|
if (host->pdata->cleanup)
|
||||||
if (host->pdata->cleanup)
|
host->pdata->cleanup(&pdev->dev);
|
||||||
host->pdata->cleanup(&pdev->dev);
|
free_irq(host->irq, host);
|
||||||
free_irq(host->irq, host);
|
if (mmc_slot(host).card_detect_irq)
|
||||||
if (mmc_slot(host).card_detect_irq)
|
free_irq(mmc_slot(host).card_detect_irq, host);
|
||||||
free_irq(mmc_slot(host).card_detect_irq, host);
|
|
||||||
|
|
||||||
pm_runtime_put_sync(host->dev);
|
pm_runtime_put_sync(host->dev);
|
||||||
pm_runtime_disable(host->dev);
|
pm_runtime_disable(host->dev);
|
||||||
clk_put(host->fclk);
|
clk_put(host->fclk);
|
||||||
if (host->got_dbclk) {
|
if (host->got_dbclk) {
|
||||||
clk_disable(host->dbclk);
|
clk_disable(host->dbclk);
|
||||||
clk_put(host->dbclk);
|
clk_put(host->dbclk);
|
||||||
}
|
|
||||||
|
|
||||||
mmc_free_host(host->mmc);
|
|
||||||
iounmap(host->base);
|
|
||||||
omap_hsmmc_gpio_free(pdev->dev.platform_data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mmc_free_host(host->mmc);
|
||||||
|
iounmap(host->base);
|
||||||
|
omap_hsmmc_gpio_free(pdev->dev.platform_data);
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
if (res)
|
if (res)
|
||||||
release_mem_region(res->start, resource_size(res));
|
release_mem_region(res->start, resource_size(res));
|
||||||
|
@ -2077,49 +2075,45 @@ static int omap_hsmmc_remove(struct platform_device *pdev)
|
||||||
static int omap_hsmmc_suspend(struct device *dev)
|
static int omap_hsmmc_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct platform_device *pdev = to_platform_device(dev);
|
struct omap_hsmmc_host *host = dev_get_drvdata(dev);
|
||||||
struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
|
|
||||||
|
if (!host)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (host && host->suspended)
|
if (host && host->suspended)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (host) {
|
pm_runtime_get_sync(host->dev);
|
||||||
pm_runtime_get_sync(host->dev);
|
host->suspended = 1;
|
||||||
host->suspended = 1;
|
if (host->pdata->suspend) {
|
||||||
if (host->pdata->suspend) {
|
ret = host->pdata->suspend(dev, host->slot_id);
|
||||||
ret = host->pdata->suspend(&pdev->dev,
|
|
||||||
host->slot_id);
|
|
||||||
if (ret) {
|
|
||||||
dev_dbg(mmc_dev(host->mmc),
|
|
||||||
"Unable to handle MMC board"
|
|
||||||
" level suspend\n");
|
|
||||||
host->suspended = 0;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ret = mmc_suspend_host(host->mmc);
|
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
dev_dbg(dev, "Unable to handle MMC board"
|
||||||
|
" level suspend\n");
|
||||||
host->suspended = 0;
|
host->suspended = 0;
|
||||||
if (host->pdata->resume) {
|
return ret;
|
||||||
ret = host->pdata->resume(&pdev->dev,
|
|
||||||
host->slot_id);
|
|
||||||
if (ret)
|
|
||||||
dev_dbg(mmc_dev(host->mmc),
|
|
||||||
"Unmask interrupt failed\n");
|
|
||||||
}
|
|
||||||
goto err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) {
|
|
||||||
omap_hsmmc_disable_irq(host);
|
|
||||||
OMAP_HSMMC_WRITE(host->base, HCTL,
|
|
||||||
OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP);
|
|
||||||
}
|
|
||||||
if (host->got_dbclk)
|
|
||||||
clk_disable(host->dbclk);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
ret = mmc_suspend_host(host->mmc);
|
||||||
|
|
||||||
|
if (ret) {
|
||||||
|
host->suspended = 0;
|
||||||
|
if (host->pdata->resume) {
|
||||||
|
ret = host->pdata->resume(dev, host->slot_id);
|
||||||
|
if (ret)
|
||||||
|
dev_dbg(dev, "Unmask interrupt failed\n");
|
||||||
|
}
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) {
|
||||||
|
omap_hsmmc_disable_irq(host);
|
||||||
|
OMAP_HSMMC_WRITE(host->base, HCTL,
|
||||||
|
OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (host->got_dbclk)
|
||||||
|
clk_disable(host->dbclk);
|
||||||
err:
|
err:
|
||||||
pm_runtime_put_sync(host->dev);
|
pm_runtime_put_sync(host->dev);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -2129,39 +2123,38 @@ err:
|
||||||
static int omap_hsmmc_resume(struct device *dev)
|
static int omap_hsmmc_resume(struct device *dev)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct platform_device *pdev = to_platform_device(dev);
|
struct omap_hsmmc_host *host = dev_get_drvdata(dev);
|
||||||
struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
|
|
||||||
|
if (!host)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (host && !host->suspended)
|
if (host && !host->suspended)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (host) {
|
pm_runtime_get_sync(host->dev);
|
||||||
pm_runtime_get_sync(host->dev);
|
|
||||||
|
|
||||||
if (host->got_dbclk)
|
if (host->got_dbclk)
|
||||||
clk_enable(host->dbclk);
|
clk_enable(host->dbclk);
|
||||||
|
|
||||||
if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER))
|
if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER))
|
||||||
omap_hsmmc_conf_bus_power(host);
|
omap_hsmmc_conf_bus_power(host);
|
||||||
|
|
||||||
if (host->pdata->resume) {
|
if (host->pdata->resume) {
|
||||||
ret = host->pdata->resume(&pdev->dev, host->slot_id);
|
ret = host->pdata->resume(dev, host->slot_id);
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_dbg(mmc_dev(host->mmc),
|
dev_dbg(dev, "Unmask interrupt failed\n");
|
||||||
"Unmask interrupt failed\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
omap_hsmmc_protect_card(host);
|
|
||||||
|
|
||||||
/* Notify the core to resume the host */
|
|
||||||
ret = mmc_resume_host(host->mmc);
|
|
||||||
if (ret == 0)
|
|
||||||
host->suspended = 0;
|
|
||||||
|
|
||||||
pm_runtime_mark_last_busy(host->dev);
|
|
||||||
pm_runtime_put_autosuspend(host->dev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
omap_hsmmc_protect_card(host);
|
||||||
|
|
||||||
|
/* Notify the core to resume the host */
|
||||||
|
ret = mmc_resume_host(host->mmc);
|
||||||
|
if (ret == 0)
|
||||||
|
host->suspended = 0;
|
||||||
|
|
||||||
|
pm_runtime_mark_last_busy(host->dev);
|
||||||
|
pm_runtime_put_autosuspend(host->dev);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2177,7 +2170,7 @@ static int omap_hsmmc_runtime_suspend(struct device *dev)
|
||||||
|
|
||||||
host = platform_get_drvdata(to_platform_device(dev));
|
host = platform_get_drvdata(to_platform_device(dev));
|
||||||
omap_hsmmc_context_save(host);
|
omap_hsmmc_context_save(host);
|
||||||
dev_dbg(mmc_dev(host->mmc), "disabled\n");
|
dev_dbg(dev, "disabled\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2188,7 +2181,7 @@ static int omap_hsmmc_runtime_resume(struct device *dev)
|
||||||
|
|
||||||
host = platform_get_drvdata(to_platform_device(dev));
|
host = platform_get_drvdata(to_platform_device(dev));
|
||||||
omap_hsmmc_context_restore(host);
|
omap_hsmmc_context_restore(host);
|
||||||
dev_dbg(mmc_dev(host->mmc), "enabled\n");
|
dev_dbg(dev, "enabled\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue