diff options
author | Mark A. Greer <mgreer@mvista.com> | 2006-03-31 16:06:03 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-04-14 14:18:33 -0400 |
commit | 8c750c0bd2fa6f73cd3cd3f1a58d48f94de343b6 (patch) | |
tree | a4cc8b9d803069f755e847c332fc260932fd3647 | |
parent | 524465df2accf54604cb89c04dbaab0c8aaa5bb4 (diff) |
[PATCH] i2c: convert m41t00 to use a workqueue
The m41t00 i2c/rtc driver currently uses a tasklet to schedule
interrupt-level writes to the rtc. This patch causes the driver
to use a workqueue instead.
Signed-off-by: Mark A. Greer <mgreer@mvista.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/i2c/chips/m41t00.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/i2c/chips/m41t00.c b/drivers/i2c/chips/m41t00.c index b5aabe7cf792..27fc9ff2961a 100644 --- a/drivers/i2c/chips/m41t00.c +++ b/drivers/i2c/chips/m41t00.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/rtc.h> | 25 | #include <linux/rtc.h> |
26 | #include <linux/bcd.h> | 26 | #include <linux/bcd.h> |
27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
28 | #include <linux/workqueue.h> | ||
28 | 29 | ||
29 | #include <asm/time.h> | 30 | #include <asm/time.h> |
30 | #include <asm/rtc.h> | 31 | #include <asm/rtc.h> |
@@ -111,7 +112,7 @@ m41t00_get_rtc_time(void) | |||
111 | } | 112 | } |
112 | 113 | ||
113 | static void | 114 | static void |
114 | m41t00_set_tlet(ulong arg) | 115 | m41t00_set(void *arg) |
115 | { | 116 | { |
116 | struct rtc_time tm; | 117 | struct rtc_time tm; |
117 | ulong nowtime = *(ulong *)arg; | 118 | ulong nowtime = *(ulong *)arg; |
@@ -145,9 +146,9 @@ m41t00_set_tlet(ulong arg) | |||
145 | return; | 146 | return; |
146 | } | 147 | } |
147 | 148 | ||
148 | static ulong new_time; | 149 | static ulong new_time; |
149 | 150 | static struct workqueue_struct *m41t00_wq; | |
150 | DECLARE_TASKLET_DISABLED(m41t00_tasklet, m41t00_set_tlet, (ulong)&new_time); | 151 | static DECLARE_WORK(m41t00_work, m41t00_set, &new_time); |
151 | 152 | ||
152 | int | 153 | int |
153 | m41t00_set_rtc_time(ulong nowtime) | 154 | m41t00_set_rtc_time(ulong nowtime) |
@@ -155,9 +156,9 @@ m41t00_set_rtc_time(ulong nowtime) | |||
155 | new_time = nowtime; | 156 | new_time = nowtime; |
156 | 157 | ||
157 | if (in_interrupt()) | 158 | if (in_interrupt()) |
158 | tasklet_schedule(&m41t00_tasklet); | 159 | queue_work(m41t00_wq, &m41t00_work); |
159 | else | 160 | else |
160 | m41t00_set_tlet((ulong)&new_time); | 161 | m41t00_set(&new_time); |
161 | 162 | ||
162 | return 0; | 163 | return 0; |
163 | } | 164 | } |
@@ -189,6 +190,7 @@ m41t00_probe(struct i2c_adapter *adap, int addr, int kind) | |||
189 | return rc; | 190 | return rc; |
190 | } | 191 | } |
191 | 192 | ||
193 | m41t00_wq = create_singlethread_workqueue("m41t00"); | ||
192 | save_client = client; | 194 | save_client = client; |
193 | return 0; | 195 | return 0; |
194 | } | 196 | } |
@@ -206,7 +208,7 @@ m41t00_detach(struct i2c_client *client) | |||
206 | 208 | ||
207 | if ((rc = i2c_detach_client(client)) == 0) { | 209 | if ((rc = i2c_detach_client(client)) == 0) { |
208 | kfree(client); | 210 | kfree(client); |
209 | tasklet_kill(&m41t00_tasklet); | 211 | destroy_workqueue(m41t00_wq); |
210 | } | 212 | } |
211 | return rc; | 213 | return rc; |
212 | } | 214 | } |