summaryrefslogtreecommitdiff
path: root/packages/linux/linux-rp-2.6.24/tosa/0046-patch-tc6393xb-cleanup.patch
blob: c4b57cb2d1ccd82d93c8940151b88365e4e5a909 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
From edaab7ec86235871d8ad219a1d225ce12f67f8af Mon Sep 17 00:00:00 2001
From: Dmitry Baryshkov <dbaryshkov@gmail.com>
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