aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark M. Hoffman <mhoffman@lightlink.com>2006-03-23 10:50:25 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-04-14 14:18:34 -0400
commite97b81ddbb8b8c72b85330ac4a454a4513dcba8a (patch)
treeb7be59895ee5cafdd5af5b4237f5b96b2812b180
parent3cb8e1a92ef7588d3acdecf493ddddd0dd71a709 (diff)
[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-parport16
-rw-r--r--drivers/i2c/busses/Kconfig5
-rw-r--r--drivers/i2c/busses/i2c-parport-light.c9
-rw-r--r--drivers/i2c/busses/i2c-parport.c9
-rw-r--r--drivers/i2c/busses/i2c-parport.h2
5 files changed, 29 insertions, 12 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
14It currently supports the following devices: 14It 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
22These devices use different pinout configurations, so you have to tell 23These devices use different pinout configurations, so you have to tell
23the driver what you have, using the type module parameter. There is no 24the driver what you have, using the type module parameter. There is no
24way to autodetect the devices. Support for different pinout configurations 25way to autodetect the devices. Support for different pinout configurations
25can be easily added when needed. 26can be easily added when needed.
26 27
28Earlier kernels defaulted to type=0 (Philips). But now, if the type
29parameter is missing, the driver will simply fail to initialize.
30
27 31
28Building your own adapter 32Building your own adapter
29------------------------- 33-------------------------
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
122static int __init i2c_parport_init(void) 122static 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
242static int __init i2c_parport_init(void) 242static 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
93static int type; 93static int type = -1;
94module_param(type, int, 0); 94module_param(type, int, 0);
95MODULE_PARM_DESC(type, 95MODULE_PARM_DESC(type,
96 "Type of adapter:\n" 96 "Type of adapter:\n"