]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
[PATCH] i2c-parport: Make type parameter mandatory
authorMark M. Hoffman <mhoffman@lightlink.com>
Thu, 23 Mar 2006 15:50:25 +0000 (16:50 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 14 Apr 2006 18:18:34 +0000 (11:18 -0700)
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>
Documentation/i2c/busses/i2c-parport
drivers/i2c/busses/Kconfig
drivers/i2c/busses/i2c-parport-light.c
drivers/i2c/busses/i2c-parport.c
drivers/i2c/busses/i2c-parport.h

index d9f23c0763f1c25d1cec80310abe11b09828c76e..77b995dfca22652bc94532a9145047d444b8baec 100644 (file)
@@ -12,18 +12,22 @@ meant as a replacement for the older, individual drivers:
                       teletext adapters)
 
 It currently supports the following devices:
- * Philips adapter
- * home brew teletext adapter
- * Velleman K8000 adapter
- * ELV adapter
- * Analog Devices evaluation boards (ADM1025, ADM1030, ADM1031, ADM1032)
- * Barco LPT->DVI (K5800236) adapter
+ * (type=0) Philips adapter
+ * (type=1) home brew teletext adapter
+ * (type=2) Velleman K8000 adapter
+ * (type=3) ELV adapter
+ * (type=4) Analog Devices ADM1032 evaluation board
+ * (type=5) Analog Devices evaluation boards: ADM1025, ADM1030, ADM1031
+ * (type=6) Barco LPT->DVI (K5800236) adapter
 
 These devices use different pinout configurations, so you have to tell
 the driver what you have, using the type module parameter. There is no
 way to autodetect the devices. Support for different pinout configurations
 can be easily added when needed.
 
+Earlier kernels defaulted to type=0 (Philips).  But now, if the type
+parameter is missing, the driver will simply fail to initialize.
+
 
 Building your own adapter
 -------------------------
index 089c6f5b24dee416a0196122d4f3f1e60fd162e5..d6d44946a283156e6d3829b6b6fca039ad331992 100644 (file)
@@ -286,7 +286,10 @@ config I2C_PARPORT
          This driver is a replacement for (and was inspired by) an older
          driver named i2c-philips-par.  The new driver supports more devices,
          and makes it easier to add support for new devices.
-         
+
+         An adapter type parameter is now mandatory.  Please read the file
+         Documentation/i2c/busses/i2c-parport for details.
+
          Another driver exists, named i2c-parport-light, which doesn't depend
          on the parport driver.  This is meant for embedded systems. Don't say
          Y here if you intend to say Y or M there.
index c63025a4c8613744fb1a6e7706e018188391a5b3..e09ebbb2f9f09dc14dc00129211c82cfd4da95cb 100644 (file)
@@ -121,9 +121,14 @@ static struct i2c_adapter parport_adapter = {
 
 static int __init i2c_parport_init(void)
 {
-       if (type < 0 || type >= ARRAY_SIZE(adapter_parm)) {
+       if (type < 0) {
+               printk(KERN_WARNING "i2c-parport: adapter type unspecified\n");
+               return -ENODEV;
+       }
+
+       if (type >= ARRAY_SIZE(adapter_parm)) {
                printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type);
-               type = 0;
+               return -ENODEV;
        }
 
        if (base == 0) {
index 7e2e8cd1c14a90d0806d382df0e9b726e34768b2..934bd55bae15da1164ca7b14b79a5c7bb2cfcf18 100644 (file)
@@ -241,9 +241,14 @@ static struct parport_driver i2c_parport_driver = {
 
 static int __init i2c_parport_init(void)
 {
-       if (type < 0 || type >= ARRAY_SIZE(adapter_parm)) {
+       if (type < 0) {
+               printk(KERN_WARNING "i2c-parport: adapter type unspecified\n");
+               return -ENODEV;
+       }
+
+       if (type >= ARRAY_SIZE(adapter_parm)) {
                printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type);
-               type = 0;
+               return -ENODEV;
        }
 
        return parport_register_driver(&i2c_parport_driver);
index d702e5e0388d9439c661ef7b8e9a0c1057f123b5..9ddd816d5d0f6609eec3ecddf640f15e2839e24e 100644 (file)
@@ -90,7 +90,7 @@ static struct adapter_parm adapter_parm[] = {
        },
 };
 
-static int type;
+static int type = -1;
 module_param(type, int, 0);
 MODULE_PARM_DESC(type,
        "Type of adapter:\n"