diff options
author | Mark M. Hoffman <mhoffman@lightlink.com> | 2006-03-23 10:50:25 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-04-14 14:18:34 -0400 |
commit | e97b81ddbb8b8c72b85330ac4a454a4513dcba8a (patch) | |
tree | b7be59895ee5cafdd5af5b4237f5b96b2812b180 /drivers/i2c/busses | |
parent | 3cb8e1a92ef7588d3acdecf493ddddd0dd71a709 (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>
Diffstat (limited to 'drivers/i2c/busses')
-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 |
4 files changed, 19 insertions, 6 deletions
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" |