diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-14 20:08:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-14 20:08:41 -0400 |
commit | 11f16971ceeb0f442e58f318b0cfde8eb35296bb (patch) | |
tree | 857d0975f65dcc81f7e0fe8ceabad183cd97e763 | |
parent | bcdc084257352902103aca85c65ddbbba8f74732 (diff) | |
parent | e97b81ddbb8b8c72b85330ac4a454a4513dcba8a (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/i2c-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/i2c-2.6: (78 commits)
commit e97b81ddbb8b8c72b85330ac4a454a4513dcba8a
Author: Mark M. Hoffman <mhoffman@lightlink.com>
Date: Thu Mar 23 16:50:25 2006 +0100
[PATCH] i2c-parport: Make type parameter mandatory
This patch forces the user to specify what type of adapter is present when
loading i2c-parport or i2c-parport-light. If none is specified, the driver
init simply fails - instead of assuming adapter type 0.
This alleviates the sometimes lengthy boot time delays which can be caused
by accidentally building one of these into a kernel along with several i2c
slave drivers that have lengthy probe routines (e.g. hwmon drivers).
Kconfig and documentation updated accordingly.
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
...
-rw-r--r-- | Documentation/i2c/busses/i2c-parport | 16 | ||||
-rw-r--r-- | drivers/hwmon/w83792d.c | 5 | ||||
-rw-r--r-- | drivers/i2c/busses/Kconfig | 5 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-parport-light.c | 9 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-parport.c | 9 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-parport.h | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-sis96x.c | 8 | ||||
-rw-r--r-- | drivers/i2c/chips/ds1374.c | 16 | ||||
-rw-r--r-- | drivers/i2c/chips/m41t00.c | 16 |
9 files changed, 51 insertions, 35 deletions
diff --git a/Documentation/i2c/busses/i2c-parport b/Documentation/i2c/busses/i2c-parport index d9f23c0763f1..77b995dfca22 100644 --- a/Documentation/i2c/busses/i2c-parport +++ b/Documentation/i2c/busses/i2c-parport | |||
@@ -12,18 +12,22 @@ meant as a replacement for the older, individual drivers: | |||
12 | teletext adapters) | 12 | teletext adapters) |
13 | 13 | ||
14 | It currently supports the following devices: | 14 | It currently supports the following devices: |
15 | * Philips adapter | 15 | * (type=0) Philips adapter |
16 | * home brew teletext adapter | 16 | * (type=1) home brew teletext adapter |
17 | * Velleman K8000 adapter | 17 | * (type=2) Velleman K8000 adapter |
18 | * ELV adapter | 18 | * (type=3) ELV adapter |
19 | * Analog Devices evaluation boards (ADM1025, ADM1030, ADM1031, ADM1032) | 19 | * (type=4) Analog Devices ADM1032 evaluation board |
20 | * Barco LPT->DVI (K5800236) adapter | 20 | * (type=5) Analog Devices evaluation boards: ADM1025, ADM1030, ADM1031 |
21 | * (type=6) Barco LPT->DVI (K5800236) adapter | ||
21 | 22 | ||
22 | These devices use different pinout configurations, so you have to tell | 23 | These devices use different pinout configurations, so you have to tell |
23 | the driver what you have, using the type module parameter. There is no | 24 | the driver what you have, using the type module parameter. There is no |
24 | way to autodetect the devices. Support for different pinout configurations | 25 | way to autodetect the devices. Support for different pinout configurations |
25 | can be easily added when needed. | 26 | can be easily added when needed. |
26 | 27 | ||
28 | Earlier kernels defaulted to type=0 (Philips). But now, if the type | ||
29 | parameter is missing, the driver will simply fail to initialize. | ||
30 | |||
27 | 31 | ||
28 | Building your own adapter | 32 | Building your own adapter |
29 | ------------------------- | 33 | ------------------------- |
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c index 6865c64d8a51..958602e28412 100644 --- a/drivers/hwmon/w83792d.c +++ b/drivers/hwmon/w83792d.c | |||
@@ -1161,7 +1161,7 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind) | |||
1161 | bank. */ | 1161 | bank. */ |
1162 | if (kind < 0) { | 1162 | if (kind < 0) { |
1163 | if (w83792d_read_value(client, W83792D_REG_CONFIG) & 0x80) { | 1163 | if (w83792d_read_value(client, W83792D_REG_CONFIG) & 0x80) { |
1164 | dev_warn(dev, "Detection failed at step 3\n"); | 1164 | dev_dbg(dev, "Detection failed at step 1\n"); |
1165 | goto ERROR1; | 1165 | goto ERROR1; |
1166 | } | 1166 | } |
1167 | val1 = w83792d_read_value(client, W83792D_REG_BANK); | 1167 | val1 = w83792d_read_value(client, W83792D_REG_BANK); |
@@ -1170,6 +1170,7 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind) | |||
1170 | if (!(val1 & 0x07)) { /* is Bank0 */ | 1170 | if (!(val1 & 0x07)) { /* is Bank0 */ |
1171 | if (((!(val1 & 0x80)) && (val2 != 0xa3)) || | 1171 | if (((!(val1 & 0x80)) && (val2 != 0xa3)) || |
1172 | ((val1 & 0x80) && (val2 != 0x5c))) { | 1172 | ((val1 & 0x80) && (val2 != 0x5c))) { |
1173 | dev_dbg(dev, "Detection failed at step 2\n"); | ||
1173 | goto ERROR1; | 1174 | goto ERROR1; |
1174 | } | 1175 | } |
1175 | } | 1176 | } |
@@ -1177,7 +1178,7 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind) | |||
1177 | should match */ | 1178 | should match */ |
1178 | if (w83792d_read_value(client, | 1179 | if (w83792d_read_value(client, |
1179 | W83792D_REG_I2C_ADDR) != address) { | 1180 | W83792D_REG_I2C_ADDR) != address) { |
1180 | dev_warn(dev, "Detection failed at step 5\n"); | 1181 | dev_dbg(dev, "Detection failed at step 3\n"); |
1181 | goto ERROR1; | 1182 | goto ERROR1; |
1182 | } | 1183 | } |
1183 | } | 1184 | } |
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 089c6f5b24de..d6d44946a283 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -286,7 +286,10 @@ config I2C_PARPORT | |||
286 | This driver is a replacement for (and was inspired by) an older | 286 | This driver is a replacement for (and was inspired by) an older |
287 | driver named i2c-philips-par. The new driver supports more devices, | 287 | driver named i2c-philips-par. The new driver supports more devices, |
288 | and makes it easier to add support for new devices. | 288 | and makes it easier to add support for new devices. |
289 | 289 | ||
290 | An adapter type parameter is now mandatory. Please read the file | ||
291 | Documentation/i2c/busses/i2c-parport for details. | ||
292 | |||
290 | Another driver exists, named i2c-parport-light, which doesn't depend | 293 | Another driver exists, named i2c-parport-light, which doesn't depend |
291 | on the parport driver. This is meant for embedded systems. Don't say | 294 | on the parport driver. This is meant for embedded systems. Don't say |
292 | Y here if you intend to say Y or M there. | 295 | Y here if you intend to say Y or M there. |
diff --git a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c index c63025a4c861..e09ebbb2f9f0 100644 --- a/drivers/i2c/busses/i2c-parport-light.c +++ b/drivers/i2c/busses/i2c-parport-light.c | |||
@@ -121,9 +121,14 @@ static struct i2c_adapter parport_adapter = { | |||
121 | 121 | ||
122 | static int __init i2c_parport_init(void) | 122 | static int __init i2c_parport_init(void) |
123 | { | 123 | { |
124 | if (type < 0 || type >= ARRAY_SIZE(adapter_parm)) { | 124 | if (type < 0) { |
125 | printk(KERN_WARNING "i2c-parport: adapter type unspecified\n"); | ||
126 | return -ENODEV; | ||
127 | } | ||
128 | |||
129 | if (type >= ARRAY_SIZE(adapter_parm)) { | ||
125 | printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type); | 130 | printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type); |
126 | type = 0; | 131 | return -ENODEV; |
127 | } | 132 | } |
128 | 133 | ||
129 | if (base == 0) { | 134 | if (base == 0) { |
diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c index 7e2e8cd1c14a..934bd55bae15 100644 --- a/drivers/i2c/busses/i2c-parport.c +++ b/drivers/i2c/busses/i2c-parport.c | |||
@@ -241,9 +241,14 @@ static struct parport_driver i2c_parport_driver = { | |||
241 | 241 | ||
242 | static int __init i2c_parport_init(void) | 242 | static int __init i2c_parport_init(void) |
243 | { | 243 | { |
244 | if (type < 0 || type >= ARRAY_SIZE(adapter_parm)) { | 244 | if (type < 0) { |
245 | printk(KERN_WARNING "i2c-parport: adapter type unspecified\n"); | ||
246 | return -ENODEV; | ||
247 | } | ||
248 | |||
249 | if (type >= ARRAY_SIZE(adapter_parm)) { | ||
245 | printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type); | 250 | printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type); |
246 | type = 0; | 251 | return -ENODEV; |
247 | } | 252 | } |
248 | 253 | ||
249 | return parport_register_driver(&i2c_parport_driver); | 254 | return parport_register_driver(&i2c_parport_driver); |
diff --git a/drivers/i2c/busses/i2c-parport.h b/drivers/i2c/busses/i2c-parport.h index d702e5e0388d..9ddd816d5d0f 100644 --- a/drivers/i2c/busses/i2c-parport.h +++ b/drivers/i2c/busses/i2c-parport.h | |||
@@ -90,7 +90,7 @@ static struct adapter_parm adapter_parm[] = { | |||
90 | }, | 90 | }, |
91 | }; | 91 | }; |
92 | 92 | ||
93 | static int type; | 93 | static int type = -1; |
94 | module_param(type, int, 0); | 94 | module_param(type, int, 0); |
95 | MODULE_PARM_DESC(type, | 95 | MODULE_PARM_DESC(type, |
96 | "Type of adapter:\n" | 96 | "Type of adapter:\n" |
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c index 3024907cdafe..1a73c0532fc7 100644 --- a/drivers/i2c/busses/i2c-sis96x.c +++ b/drivers/i2c/busses/i2c-sis96x.c | |||
@@ -43,13 +43,6 @@ | |||
43 | #include <linux/init.h> | 43 | #include <linux/init.h> |
44 | #include <asm/io.h> | 44 | #include <asm/io.h> |
45 | 45 | ||
46 | /* | ||
47 | HISTORY: | ||
48 | 2003-05-11 1.0.0 Updated from lm_sensors project for kernel 2.5 | ||
49 | (was i2c-sis645.c from lm_sensors 2.7.0) | ||
50 | */ | ||
51 | #define SIS96x_VERSION "1.0.0" | ||
52 | |||
53 | /* base address register in PCI config space */ | 46 | /* base address register in PCI config space */ |
54 | #define SIS96x_BAR 0x04 | 47 | #define SIS96x_BAR 0x04 |
55 | 48 | ||
@@ -337,7 +330,6 @@ static struct pci_driver sis96x_driver = { | |||
337 | 330 | ||
338 | static int __init i2c_sis96x_init(void) | 331 | static int __init i2c_sis96x_init(void) |
339 | { | 332 | { |
340 | printk(KERN_INFO "i2c-sis96x version %s\n", SIS96x_VERSION); | ||
341 | return pci_register_driver(&sis96x_driver); | 333 | return pci_register_driver(&sis96x_driver); |
342 | } | 334 | } |
343 | 335 | ||
diff --git a/drivers/i2c/chips/ds1374.c b/drivers/i2c/chips/ds1374.c index 03d09ed5ec2c..4630f1969a09 100644 --- a/drivers/i2c/chips/ds1374.c +++ b/drivers/i2c/chips/ds1374.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/rtc.h> | 27 | #include <linux/rtc.h> |
28 | #include <linux/bcd.h> | 28 | #include <linux/bcd.h> |
29 | #include <linux/mutex.h> | 29 | #include <linux/mutex.h> |
30 | #include <linux/workqueue.h> | ||
30 | 31 | ||
31 | #define DS1374_REG_TOD0 0x00 | 32 | #define DS1374_REG_TOD0 0x00 |
32 | #define DS1374_REG_TOD1 0x01 | 33 | #define DS1374_REG_TOD1 0x01 |
@@ -139,7 +140,7 @@ ulong ds1374_get_rtc_time(void) | |||
139 | return t1; | 140 | return t1; |
140 | } | 141 | } |
141 | 142 | ||
142 | static void ds1374_set_tlet(ulong arg) | 143 | static void ds1374_set_work(void *arg) |
143 | { | 144 | { |
144 | ulong t1, t2; | 145 | ulong t1, t2; |
145 | int limit = 10; /* arbitrary retry limit */ | 146 | int limit = 10; /* arbitrary retry limit */ |
@@ -168,17 +169,18 @@ static void ds1374_set_tlet(ulong arg) | |||
168 | 169 | ||
169 | static ulong new_time; | 170 | static ulong new_time; |
170 | 171 | ||
171 | static DECLARE_TASKLET_DISABLED(ds1374_tasklet, ds1374_set_tlet, | 172 | static struct workqueue_struct *ds1374_workqueue; |
172 | (ulong) & new_time); | 173 | |
174 | static DECLARE_WORK(ds1374_work, ds1374_set_work, &new_time); | ||
173 | 175 | ||
174 | int ds1374_set_rtc_time(ulong nowtime) | 176 | int ds1374_set_rtc_time(ulong nowtime) |
175 | { | 177 | { |
176 | new_time = nowtime; | 178 | new_time = nowtime; |
177 | 179 | ||
178 | if (in_interrupt()) | 180 | if (in_interrupt()) |
179 | tasklet_schedule(&ds1374_tasklet); | 181 | queue_work(ds1374_workqueue, &ds1374_work); |
180 | else | 182 | else |
181 | ds1374_set_tlet((ulong) & new_time); | 183 | ds1374_set_work(&new_time); |
182 | 184 | ||
183 | return 0; | 185 | return 0; |
184 | } | 186 | } |
@@ -204,6 +206,8 @@ static int ds1374_probe(struct i2c_adapter *adap, int addr, int kind) | |||
204 | client->adapter = adap; | 206 | client->adapter = adap; |
205 | client->driver = &ds1374_driver; | 207 | client->driver = &ds1374_driver; |
206 | 208 | ||
209 | ds1374_workqueue = create_singlethread_workqueue("ds1374"); | ||
210 | |||
207 | if ((rc = i2c_attach_client(client)) != 0) { | 211 | if ((rc = i2c_attach_client(client)) != 0) { |
208 | kfree(client); | 212 | kfree(client); |
209 | return rc; | 213 | return rc; |
@@ -227,7 +231,7 @@ static int ds1374_detach(struct i2c_client *client) | |||
227 | 231 | ||
228 | if ((rc = i2c_detach_client(client)) == 0) { | 232 | if ((rc = i2c_detach_client(client)) == 0) { |
229 | kfree(i2c_get_clientdata(client)); | 233 | kfree(i2c_get_clientdata(client)); |
230 | tasklet_kill(&ds1374_tasklet); | 234 | destroy_workqueue(ds1374_workqueue); |
231 | } | 235 | } |
232 | return rc; | 236 | return rc; |
233 | } | 237 | } |
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 | } |