diff -ura linux-2.6.4-i2c/drivers/i2c/i2c-core.c linux-2.6.4/drivers/i2c/i2c-core.c --- linux-2.6.4-i2c/drivers/i2c/i2c-core.c 2004-03-21 20:01:10.000000000 +0100 +++ linux-2.6.4/drivers/i2c/i2c-core.c 2004-03-21 20:06:52.000000000 +0100 @@ -151,6 +151,13 @@ /* inform drivers of new adapters */ list_for_each(item,&drivers) { driver = list_entry(item, struct i2c_driver, list); + if ((adap->flags & I2C_ADAP_FLAG_CLASS_MATCH) != 0) { + if ((adap->class & driver->class) == 0) { + pr_debug("i2c-core: adapter '%s' enforces strict class type match." + "driver '%s' not probed.\n",adap->name,driver->name); + continue; + } + } if (driver->flags & I2C_DF_NOTIFY) /* We ignore the return code; if it fails, too bad */ driver->attach_adapter(adap); @@ -251,6 +258,13 @@ if (driver->flags & I2C_DF_NOTIFY) { list_for_each(item,&adapters) { adapter = list_entry(item, struct i2c_adapter, list); + if ((adapter->flags & I2C_ADAP_FLAG_CLASS_MATCH) != 0) { + if ((adapter->class & driver->class) == 0) { + pr_debug("i2c-core: adapter '%s' enforces strict class type match." + "driver '%s' not probed.\n",adap->name,driver->name); + continue; + } + } driver->attach_adapter(adapter); } } diff -ura linux-2.6.4-i2c/include/linux/i2c.h linux-2.6.4/include/linux/i2c.h --- linux-2.6.4-i2c/include/linux/i2c.h 2004-03-21 19:58:31.000000000 +0100 +++ linux-2.6.4/include/linux/i2c.h 2004-03-21 20:12:04.000000000 +0100 @@ -114,6 +114,7 @@ char name[32]; int id; unsigned int flags; /* div., see below */ + unsigned int class; /* Notifies the driver that a new bus has appeared. This routine * can be used by the driver to test if the bus meets its conditions @@ -226,7 +227,10 @@ struct module *owner; unsigned int id;/* == is algo->id | hwdep.struct->id, */ /* for registered values see below */ + unsigned int class; + unsigned int flags; /* div., see below */ + struct i2c_algorithm *algo;/* the algorithm to access the bus */ void *algo_data; @@ -237,7 +241,6 @@ /* data fields that are valid for all devices */ struct semaphore bus_lock; struct semaphore clist_lock; - unsigned int flags;/* flags specifying div. data */ int timeout; int retries; @@ -285,10 +288,13 @@ #define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */ /* Must equal I2C_M_TEN below */ +/* i2c adapter flags (bitmask) */ +#define I2C_ADAP_FLAG_CLASS_MATCH (1<<0) /* adapter and driver class must match for device probing */ + /* i2c adapter classes (bitmask) */ #define I2C_ADAP_CLASS_SMBUS (1<<0) /* lm_sensors, ... */ #define I2C_ADAP_CLASS_TV_ANALOG (1<<1) /* bttv + friends */ -#define I2C_ADAP_CLASS_TV_DIGITAL (1<<2) /* dbv cards */ +#define I2C_ADAP_CLASS_TV_DIGITAL (1<<2) /* dvb cards */ #define I2C_ADAP_CLASS_DDC (1<<3) /* i2c-matroxfb ? */ #define I2C_ADAP_CLASS_CAM_ANALOG (1<<4) /* camera with analog CCD */ #define I2C_ADAP_CLASS_CAM_DIGITAL (1<<5) /* most webcams */