From edaab7ec86235871d8ad219a1d225ce12f67f8af Mon Sep 17 00:00:00 2001 From: Dmitry Baryshkov Date: Wed, 9 Jan 2008 02:13:29 +0300 Subject: [PATCH 46/64] patch tc6393xb-cleanup --- drivers/mfd/tc6393xb.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c index 5d17687..dfae61d 100644 --- a/drivers/mfd/tc6393xb.c +++ b/drivers/mfd/tc6393xb.c @@ -590,16 +590,8 @@ static int tc6393xb_hw_init(struct platform_device *dev, int resume) struct tc6393xb_platform_data *tcpd = dev->dev.platform_data; struct tc6393xb *tc6393xb = platform_get_drvdata(dev); struct tc6393xb_scr __iomem *scr = tc6393xb->scr; - int ret; int i; - if (resume) - ret = tcpd->resume(dev); - else - ret = tcpd->enable(dev); - if (ret) - return ret; - iowrite8(resume ? tc6393xb->suspend_state.fer.raw : 0, &scr->fer); @@ -664,6 +656,10 @@ static int __devinit tc6393xb_probe(struct platform_device *dev) goto err_ioremap; } + retval = tcpd->enable(dev); + if (retval) + goto err_enable; + retval = tc6393xb_hw_init(dev, 0); if (retval) goto err_hw_init; @@ -690,6 +686,8 @@ static int __devinit tc6393xb_probe(struct platform_device *dev) tc6393xb_detach_irq(dev); err_hw_init: + tcpd->disable(dev); +err_enable: iounmap(tc6393xb->scr); err_ioremap: release_resource(rscr); @@ -743,6 +741,12 @@ static int tc6393xb_suspend(struct platform_device *dev, pm_message_t state) static int tc6393xb_resume(struct platform_device *dev) { + struct tc6393xb_platform_data *tcpd = dev->dev.platform_data; + int ret = tcpd->resume(dev); + + if (ret) + return ret; + return tc6393xb_hw_init(dev, 1); } #else -- 1.5.3.8