Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Mark A. Greer and committed by
Greg Kroah-Hartman
8c750c0b 524465df

+9 -7
+9 -7
drivers/i2c/chips/m41t00.c
··· 25 25 #include <linux/rtc.h> 26 26 #include <linux/bcd.h> 27 27 #include <linux/mutex.h> 28 + #include <linux/workqueue.h> 28 29 29 30 #include <asm/time.h> 30 31 #include <asm/rtc.h> ··· 112 111 } 113 112 114 113 static void 115 - m41t00_set_tlet(ulong arg) 114 + m41t00_set(void *arg) 116 115 { 117 116 struct rtc_time tm; 118 117 ulong nowtime = *(ulong *)arg; ··· 146 145 return; 147 146 } 148 147 149 - static ulong new_time; 150 - 151 - DECLARE_TASKLET_DISABLED(m41t00_tasklet, m41t00_set_tlet, (ulong)&new_time); 148 + static ulong new_time; 149 + static struct workqueue_struct *m41t00_wq; 150 + static DECLARE_WORK(m41t00_work, m41t00_set, &new_time); 152 151 153 152 int 154 153 m41t00_set_rtc_time(ulong nowtime) ··· 156 155 new_time = nowtime; 157 156 158 157 if (in_interrupt()) 159 - tasklet_schedule(&m41t00_tasklet); 158 + queue_work(m41t00_wq, &m41t00_work); 160 159 else 161 - m41t00_set_tlet((ulong)&new_time); 160 + m41t00_set(&new_time); 162 161 163 162 return 0; 164 163 } ··· 190 189 return rc; 191 190 } 192 191 192 + m41t00_wq = create_singlethread_workqueue("m41t00"); 193 193 save_client = client; 194 194 return 0; 195 195 } ··· 208 206 209 207 if ((rc = i2c_detach_client(client)) == 0) { 210 208 kfree(client); 211 - tasklet_kill(&m41t00_tasklet); 209 + destroy_workqueue(m41t00_wq); 212 210 } 213 211 return rc; 214 212 }