Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Add .class entry to i2c adapter



Part 2
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/acorn/char/i2c.c linux-2.6-6-rc3-mm2/drivers/acorn/char/i2c.c
--- xx-linux-2.6-6-rc3-mm2/drivers/acorn/char/i2c.c	2004-05-09 11:03:40.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/acorn/char/i2c.c	2004-05-09 16:31:58.000000000 +0200
@@ -345,6 +345,7 @@
 static struct i2c_adapter ioc_ops = {
 	.id			= I2C_HW_B_IOC,
 	.algo_data		= &ioc_data,
+	.class			= I2C_CLASS_ALL,
 	.client_register	= ioc_client_reg,
 	.client_unregister	= ioc_client_unreg,
 };
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/acorn/char/pcf8583.c linux-2.6-6-rc3-mm2/drivers/acorn/char/pcf8583.c
--- xx-linux-2.6-6-rc3-mm2/drivers/acorn/char/pcf8583.c	2004-05-09 11:03:40.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/acorn/char/pcf8583.c	2004-05-09 16:33:20.000000000 +0200
@@ -227,6 +227,7 @@
 	.name		= "PCF8583",
 	.id		= I2C_DRIVERID_PCF8583,
 	.flags		= I2C_DF_NOTIFY,
+	.class		= I2C_CLASS_ALL, /* fixme: add another I2C_CLASS_xxx entry for Acorn? */
 	.attach_adapter	= pcf8583_probe,
 	.detach_client	= pcf8583_detach,
 	.command	= pcf8583_command
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-keywest.c linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-keywest.c
--- xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-keywest.c	2004-05-09 11:03:02.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-keywest.c	2004-05-09 16:37:41.000000000 +0200
@@ -619,6 +619,7 @@
 		chan->iface = iface;
 		chan->chan_no = i;
 		chan->adapter.id = I2C_ALGO_SMBUS;
+		chan->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_SOUND;
 		chan->adapter.algo = &keywest_algorithm;
 		chan->adapter.algo_data = NULL;
 		chan->adapter.client_register = NULL;
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/ieee1394/pcilynx.c linux-2.6-6-rc3-mm2/drivers/ieee1394/pcilynx.c
--- xx-linux-2.6-6-rc3-mm2/drivers/ieee1394/pcilynx.c	2004-05-09 11:05:30.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/ieee1394/pcilynx.c	2004-05-09 16:42:30.000000000 +0200
@@ -1799,6 +1799,7 @@
                 i2c_adapter = bit_ops;
                 i2c_adapter_data = bit_data;
                 i2c_adapter.algo_data = &i2c_adapter_data;
+		i2c_adapter.class = I2C_CLASS_NONE;
                 i2c_adapter_data.data = lynx;
 
 		PRINTD(KERN_DEBUG, lynx->id,"original eeprom control: %d",
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/macintosh/therm_adt746x.c linux-2.6-6-rc3-mm2/drivers/macintosh/therm_adt746x.c
--- xx-linux-2.6-6-rc3-mm2/drivers/macintosh/therm_adt746x.c	2004-05-09 11:03:40.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/macintosh/therm_adt746x.c	2004-05-09 16:30:02.000000000 +0200
@@ -164,6 +164,7 @@
 	.name		="Apple Thermostat ADT746x",
 	.id		=0xDEAD7467,
 	.flags		=I2C_DF_NOTIFY,
+	.class		=I2C_CLASS_HWMON,
 	.attach_adapter	=&attach_thermostat,
 	.detach_adapter	=&detach_thermostat,
 };
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/macintosh/therm_pm72.c linux-2.6-6-rc3-mm2/drivers/macintosh/therm_pm72.c
--- xx-linux-2.6-6-rc3-mm2/drivers/macintosh/therm_pm72.c	2004-05-09 11:03:40.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/macintosh/therm_pm72.c	2004-05-09 16:29:32.000000000 +0200
@@ -142,6 +142,7 @@
 	.name		= "therm_pm72",
 	.id		= 0xDEADBEEF,
 	.flags		= I2C_DF_NOTIFY,
+	.class		= I2C_CLASS_HWMON,
 	.attach_adapter	= therm_pm72_attach,
 	.detach_adapter	= therm_pm72_detach,
 };
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/macintosh/therm_windtunnel.c linux-2.6-6-rc3-mm2/drivers/macintosh/therm_windtunnel.c
--- xx-linux-2.6-6-rc3-mm2/drivers/macintosh/therm_windtunnel.c	2004-05-09 11:03:40.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/macintosh/therm_windtunnel.c	2004-05-09 16:29:13.000000000 +0200
@@ -357,6 +357,7 @@
 	.name		= "Apple G4 Thermostat/Fan",
 	.id		= I2C_DRIVERID_G4FAN,
 	.flags		= I2C_DF_NOTIFY,
+	.class		= I2C_CLASS_HWMON,
 	.attach_adapter = &do_attach,
 	.detach_client	= &do_detach,
 	.command	= NULL,
diff -ura xx-linux-2.6-6-rc3-mm2/include/linux/i2c.h linux-2.6-6-rc3-mm2/include/linux/i2c.h
--- xx-linux-2.6-6-rc3-mm2/include/linux/i2c.h	2004-05-09 11:11:11.000000000 +0200
+++ linux-2.6-6-rc3-mm2/include/linux/i2c.h	2004-05-09 16:42:13.000000000 +0200
@@ -285,7 +285,8 @@
 #define I2C_CLIENT_TEN	0x10			/* we have a ten bit chip address	*/
 						/* Must equal I2C_M_TEN below */
 
-/* i2c adapter classes (bitmask) */
+/* i2c classes (bitmask) */
+#define I2C_CLASS_NONE		0	/* none, don't use */
 #define I2C_CLASS_HWMON		(1<<0)	/* lm_sensors, ... */
 #define I2C_CLASS_TV_ANALOG	(1<<1)	/* bttv + friends */
 #define I2C_CLASS_TV_DIGITAL	(1<<2)	/* dvb cards */
diff -ura xx-linux-2.6-6-rc3-mm2/sound/oss/dmasound/dac3550a.c linux-2.6-6-rc3-mm2/sound/oss/dmasound/dac3550a.c
--- xx-linux-2.6-6-rc3-mm2/sound/oss/dmasound/dac3550a.c	2004-05-09 11:04:50.000000000 +0200
+++ linux-2.6-6-rc3-mm2/sound/oss/dmasound/dac3550a.c	2004-05-09 16:38:47.000000000 +0200
@@ -47,6 +47,7 @@
 	.name			= "DAC3550A driver  V " DACA_VERSION,
 	.id			= I2C_DRIVERID_DACA,
 	.flags			= I2C_DF_NOTIFY,
+	.class			= I2C_CLASS_SOUND,
 	.attach_adapter		= daca_attach_adapter,
 	.detach_client		= daca_detach_client,
 };
diff -ura xx-linux-2.6-6-rc3-mm2/sound/oss/dmasound/tas_common.c linux-2.6-6-rc3-mm2/sound/oss/dmasound/tas_common.c
--- xx-linux-2.6-6-rc3-mm2/sound/oss/dmasound/tas_common.c	2004-05-09 11:04:50.000000000 +0200
+++ linux-2.6-6-rc3-mm2/sound/oss/dmasound/tas_common.c	2004-05-09 16:39:01.000000000 +0200
@@ -50,6 +50,7 @@
 	.owner		= THIS_MODULE,
 	.name		= "tas",
 	.flags		= I2C_DF_NOTIFY,
+	.class		= I2C_CLASS_SOUND,
 	.attach_adapter	= tas_attach_adapter,
 	.detach_client	= tas_detach_client,
 };
diff -ura xx-linux-2.6-6-rc3-mm2/sound/ppc/keywest.c linux-2.6-6-rc3-mm2/sound/ppc/keywest.c
--- xx-linux-2.6-6-rc3-mm2/sound/ppc/keywest.c	2004-05-09 11:06:53.000000000 +0200
+++ linux-2.6-6-rc3-mm2/sound/ppc/keywest.c	2004-05-09 16:38:03.000000000 +0200
@@ -44,6 +44,7 @@
 	.name = "PMac Keywest Audio",
 	.id = I2C_DRIVERID_KEYWEST,
 	.flags = I2C_DF_NOTIFY,
+	.class = I2C_CLASS_SOUND,
 	.attach_adapter = &keywest_attach_adapter,
 	.detach_client = &keywest_detach_client,
 };

diff -ura xx-linux-2.6-6-rc3-mm2/drivers/i2c/algos/i2c-algo-pcf.c linux-2.6-6-rc3-mm2/drivers/i2c/algos/i2c-algo-pcf.c
--- xx-linux-2.6-6-rc3-mm2/drivers/i2c/algos/i2c-algo-pcf.c	2004-05-09 11:03:03.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/i2c/algos/i2c-algo-pcf.c	2004-05-09 18:00:47.000000000 +0200
@@ -449,7 +449,8 @@
 
 	adap->id |= pcf_algo.id;
 	adap->algo = &pcf_algo;
-
+	adap->class = I2C_CLASS_ALL;
+	
 	adap->timeout = 100;		/* default values, should	*/
 	adap->retries = 3;		/* be replaced by defines	*/
 
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-elektor.c linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-elektor.c
--- xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-elektor.c	2004-05-09 11:03:02.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-elektor.c	2004-05-09 17:57:16.000000000 +0200
@@ -171,6 +171,7 @@
 	.owner		= THIS_MODULE,
 	.id		= I2C_HW_P_ELEK,
 	.algo_data	= &pcf_isa_data,
+	.class		= I2C_CLASS_ALL,
 	.name		= "PCF8584 ISA adapter",
 };
 
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/media/dvb/bt8xx/dvb-bt8xx.c linux-2.6-6-rc3-mm2/drivers/media/dvb/bt8xx/dvb-bt8xx.c
--- xx-linux-2.6-6-rc3-mm2/drivers/media/dvb/bt8xx/dvb-bt8xx.c	2004-05-09 11:05:31.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/media/dvb/bt8xx/dvb-bt8xx.c	2004-05-09 17:38:16.000000000 +0200
@@ -261,6 +261,11 @@
 	.name            = "dvb_bt8xx",
         .id              = I2C_DRIVERID_DVB_BT878A,
 	.flags           = I2C_DF_NOTIFY,
+	/* ugly, but necessary: bt8x8 based budget dvb cards are handled by bttv on the
+	   lowest level and we fake a i2c client to get to know all bt8x8 based
+	   cards when they have been registered by bttv.
+	   we do a check for adap->id in order to find the right cards */
+	.class		 = I2C_CLASS_ALL,
         .attach_adapter  = dvb_bt8xx_attach,
         .detach_adapter  = dvb_bt8xx_detach,
 };
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/media/video/ir-kbd-i2c.c linux-2.6-6-rc3-mm2/drivers/media/video/ir-kbd-i2c.c
--- xx-linux-2.6-6-rc3-mm2/drivers/media/video/ir-kbd-i2c.c	2004-05-09 11:05:31.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/media/video/ir-kbd-i2c.c	2004-05-09 17:39:18.000000000 +0200
@@ -247,6 +247,7 @@
         .name           = "ir remote kbd driver",
         .id             = I2C_DRIVERID_EXP3, /* FIXME */
         .flags          = I2C_DF_NOTIFY,
+	.class		= I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL;
         .attach_adapter = ir_probe,
         .detach_client  = ir_detach,
 };
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/media/video/zoran_card.c linux-2.6-6-rc3-mm2/drivers/media/video/zoran_card.c
--- xx-linux-2.6-6-rc3-mm2/drivers/media/video/zoran_card.c	2004-05-09 11:03:03.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/media/video/zoran_card.c	2004-05-09 17:40:38.000000000 +0200
@@ -740,6 +740,7 @@
 	I2C_DEVNAME("zr36057"),
 	.id = I2C_HW_B_ZR36067,
 	.algo = NULL,
+	.class = I2C_CLASS_TV_ANALOG,
 	.client_register = zoran_i2c_client_register,
 	.client_unregister = zoran_i2c_client_unregister,
 };
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/video/aty/radeon_i2c.c linux-2.6-6-rc3-mm2/drivers/video/aty/radeon_i2c.c
--- xx-linux-2.6-6-rc3-mm2/drivers/video/aty/radeon_i2c.c	2004-05-09 11:03:09.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/video/aty/radeon_i2c.c	2004-05-09 17:55:49.000000000 +0200
@@ -78,6 +78,7 @@
 	chan->adapter.id		= I2C_ALGO_ATI;
 	chan->adapter.algo_data		= &chan->algo;
 	chan->adapter.dev.parent	= &chan->rinfo->pdev->dev;
+	chan->adapter.class		= I2C_CLASS_NONE;
 	chan->algo.setsda		= radeon_gpio_setsda;
 	chan->algo.setscl		= radeon_gpio_setscl;
 	chan->algo.getsda		= radeon_gpio_getsda;
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/video/matrox/i2c-matroxfb.c linux-2.6-6-rc3-mm2/drivers/video/matrox/i2c-matroxfb.c
--- xx-linux-2.6-6-rc3-mm2/drivers/video/matrox/i2c-matroxfb.c	2004-05-09 11:03:09.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/video/matrox/i2c-matroxfb.c	2004-05-09 17:50:36.000000000 +0200
@@ -104,13 +104,14 @@
 };
 
 static int i2c_bus_reg(struct i2c_bit_adapter* b, struct matrox_fb_info* minfo, 
-		unsigned int data, unsigned int clock, const char* name) {
+		unsigned int data, unsigned int clock, const char* name, unsigned int class) {
 	int err;
 
 	b->minfo = minfo;
 	b->mask.data = data;
 	b->mask.clock = clock;
 	b->adapter = matrox_i2c_adapter_template;
+	b->class = class;
 	snprintf(b->adapter.name, I2C_NAME_SIZE, name,
 		minfo->fbcon.node);
 	i2c_set_adapdata(&b->adapter, b);
@@ -160,22 +161,22 @@
 	switch (ACCESS_FBINFO(chip)) {
 		case MGA_2064:
 		case MGA_2164:
-			err = i2c_bus_reg(&m2info->ddc1, minfo, DDC1B_DATA, DDC1B_CLK, "DDC:fb%u #0");
+			err = i2c_bus_reg(&m2info->ddc1, minfo, DDC1B_DATA, DDC1B_CLK, "DDC:fb%u #0", I2C_CLASS_DDC);
 			break;
 		default:
-			err = i2c_bus_reg(&m2info->ddc1, minfo, DDC1_DATA, DDC1_CLK, "DDC:fb%u #0");
+			err = i2c_bus_reg(&m2info->ddc1, minfo, DDC1_DATA, DDC1_CLK, "DDC:fb%u #0", I2C_CLASS_DDC);
 			break;
 	}
 	if (err)
 		goto fail_ddc1;
 	if (ACCESS_FBINFO(devflags.dualhead)) {
-		err = i2c_bus_reg(&m2info->ddc2, minfo, DDC2_DATA, DDC2_CLK, "DDC:fb%u #1");
+		err = i2c_bus_reg(&m2info->ddc2, minfo, DDC2_DATA, DDC2_CLK, "DDC:fb%u #1", I2C_CLASS_DDC);
 		if (err == -ENODEV) {
 			printk(KERN_INFO "i2c-matroxfb: VGA->TV plug detected, DDC unavailable.\n");
 		} else if (err)
 			printk(KERN_INFO "i2c-matroxfb: Could not register secondary output i2c bus. Continuing anyway.\n");
 		/* Register maven bus even on G450/G550 */
-		err = i2c_bus_reg(&m2info->maven, minfo, MAT_DATA, MAT_CLK, "MAVEN:fb%u");
+		err = i2c_bus_reg(&m2info->maven, minfo, MAT_DATA, MAT_CLK, "MAVEN:fb%u", I2C_CLASS_TV_ANALOG);
 		if (err)
 			printk(KERN_INFO "i2c-matroxfb: Could not register Maven i2c bus. Continuing anyway.\n");
 	}
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/video/matrox/matroxfb_maven.c linux-2.6-6-rc3-mm2/drivers/video/matrox/matroxfb_maven.c
--- xx-linux-2.6-6-rc3-mm2/drivers/video/matrox/matroxfb_maven.c	2004-05-09 11:03:09.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/video/matrox/matroxfb_maven.c	2004-05-09 17:46:07.000000000 +0200
@@ -1297,6 +1297,7 @@
 	.name		= "maven",
 	.id		= I2C_DRIVERID_MGATVO,
 	.flags		= I2C_DF_NOTIFY,
+	.class		= I2C_CLASS_TV_ANALOG,
 	.attach_adapter	= maven_attach_adapter,
 	.detach_client	= maven_detach_client,
 	.command	= maven_command,

diff -ura xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-ibm_iic.c linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-ibm_iic.c
--- xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-ibm_iic.c	2004-05-09 11:03:03.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-ibm_iic.c	2004-05-09 18:19:44.000000000 +0200
@@ -607,6 +607,7 @@
 	i2c_set_adapdata(adap, dev);
 	adap->id = I2C_HW_OCP | iic_algo.id;
 	adap->algo = &iic_algo;
+	adap->class = I2C_CLASS_ALL;
 	adap->client_register = NULL;
 	adap->client_unregister = NULL;
 	adap->timeout = 1;
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-iop3xx.c linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-iop3xx.c
--- xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-iop3xx.c	2004-05-09 11:03:02.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-iop3xx.c	2004-05-09 18:17:57.000000000 +0200
@@ -507,18 +507,31 @@
 	.name			= ADAPTER_NAME_ROOT "0",
 	.id			= I2C_HW_IOP321,
 	.algo_data		= &algo_iop3xx_data0,
+	.class			= I2C_CLASS_ALL,
 };
 static struct i2c_adapter iop3xx_ops1 = {
 	.owner			= THIS_MODULE,
 	.name			= ADAPTER_NAME_ROOT "1",
 	.id			= I2C_HW_IOP321,
 	.algo_data		= &algo_iop3xx_data1,
+	.class			= I2C_CLASS_ALL,
 };
 
 static int __init i2c_iop3xx_init (void)
 {
-	return i2c_iop3xx_add_bus(&iop3xx_ops0) ||
-		i2c_iop3xx_add_bus(&iop3xx_ops1);
+	int ret;
+	
+	ret = i2c_iop3xx_add_bus(&iop3xx_ops0);
+	if (ret)
+		return ret;
+		
+	ret = i2c_iop3xx_add_bus(&iop3xx_ops1);
+	if (ret) {
+		i2c_iop3xx_del_bus(&iop3xx_ops0);
+		return ret;
+	}
+
+	return 0;
 }
 
 static void __exit i2c_iop3xx_exit (void)
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-ite.c linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-ite.c
--- xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-ite.c	2004-05-09 11:03:02.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-ite.c	2004-05-09 18:13:22.000000000 +0200
@@ -192,6 +192,7 @@
 	.owner		= THIS_MODULE,
 	.id		= I2C_HW_I_IIC,
 	.algo_data	= &iic_ite_data,
+	.class		= I2C_CLASS_ALL,
 	.dev		= {
 		.name	= "ITE IIC adapter",
 	},
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/scx200_i2c.c linux-2.6-6-rc3-mm2/drivers/i2c/busses/scx200_i2c.c
--- xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/scx200_i2c.c	2004-05-09 11:03:02.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/i2c/busses/scx200_i2c.c	2004-05-09 18:13:55.000000000 +0200
@@ -84,6 +84,7 @@
 static struct i2c_adapter scx200_i2c_ops = {
 	.owner		   = THIS_MODULE,
 	.algo_data	   = &scx200_i2c_data,
+	.class		   = I2C_CLASS_ALL,
 	.name	= "NatSemi SCx200 I2C",
 };
 

diff -ura xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-frodo.c linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-frodo.c
--- xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-frodo.c	2004-05-09 11:03:02.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-frodo.c	2004-05-09 19:56:30.000000000 +0200
@@ -62,6 +62,7 @@
 	.owner			= THIS_MODULE,
 	.id			= I2C_HW_B_FRODO,
 	.algo_data		= &bit_frodo_data,
+	.class			= I2C_CLASS_ALL,
 	.dev			= {
 		.name		= "Frodo adapter driver",
 	},
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-hydra.c linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-hydra.c
--- xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-hydra.c	2004-05-09 11:03:03.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-hydra.c	2004-05-09 20:04:50.000000000 +0200
@@ -107,6 +107,7 @@
 	.owner		= THIS_MODULE,
 	.name		= "Hydra i2c",
 	.id		= I2C_HW_B_HYDRA,
+	.class		= I2C_CLASS_HWMON,
 	.algo_data	= &hydra_bit_data,
 };
 
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-i810.c linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-i810.c
--- xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-i810.c	2004-05-09 11:03:02.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-i810.c	2004-05-09 19:58:12.000000000 +0200
@@ -173,6 +173,7 @@
 static struct i2c_adapter i810_i2c_adapter = {
 	.owner		= THIS_MODULE,
 	.name		= "I810/I815 I2C Adapter",
+	.class		= I2C_CLASS_ALL, /* fixme, what's the correct class? */
 	.algo_data	= &i810_i2c_bit_data,
 };
 
@@ -189,6 +190,7 @@
 static struct i2c_adapter i810_ddc_adapter = {
 	.owner		= THIS_MODULE,
 	.name		= "I810/I815 DDC Adapter",
+	.class		= I2C_CLASS_DDC,
 	.algo_data	= &i810_ddc_bit_data,
 };
 
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-ixp4xx.c linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-ixp4xx.c
--- xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-ixp4xx.c	2004-05-09 11:06:43.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-ixp4xx.c	2004-05-09 20:04:01.000000000 +0200
@@ -133,8 +133,9 @@
 	drv_data->algo_data.mdelay = 10;
 	drv_data->algo_data.timeout = 100;
 
-	drv_data->adapter.id = I2C_HW_B_IXP4XX,
-	drv_data->adapter.algo_data = &drv_data->algo_data,
+	drv_data->adapter.id = I2C_HW_B_IXP4XX;
+	drv_data->adapter.algo_data = &drv_data->algo_data;
+	drv_data->adapter.class = I2C_CLASS_ALL;
 
 	drv_data->adapter.dev.parent = &plat_dev->dev;
 
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-prosavage.c linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-prosavage.c
--- xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-prosavage.c	2004-05-09 11:03:02.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-prosavage.c	2004-05-09 20:00:12.000000000 +0200
@@ -181,12 +181,13 @@
 /*
  * adapter initialisation
  */
-static int i2c_register_bus(struct pci_dev *dev, struct s_i2c_bus *p, u8 *mmvga, u32 i2c_reg)
+static int i2c_register_bus(struct pci_dev *dev, struct s_i2c_bus *p, u8 *mmvga, u32 i2c_reg, unsigned int class)
 {
 	int ret;
 	p->adap.owner	  = THIS_MODULE;
 	p->adap.id	  = I2C_HW_B_S3VIA;
 	p->adap.algo_data = &p->algo;
+	p->adap.class	  = class;
 	p->adap.dev.parent = &dev->dev;
 	p->algo.setsda	  = bit_s3via_setsda;
 	p->algo.setscl	  = bit_s3via_setscl;
@@ -281,7 +282,7 @@
 	snprintf(bus->adap.name, sizeof(bus->adap.name),
 		"ProSavage I2C bus at %02x:%02x.%x",
 		dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
-	ret = i2c_register_bus(dev, bus, chip->mmio + 0x8000, CR_SERIAL1);
+	ret = i2c_register_bus(dev, bus, chip->mmio + 0x8000, CR_SERIAL1, I2C_CLASS_ALL);
 	if (ret) {
 		goto err_adap;
 	}
@@ -292,7 +293,7 @@
 	snprintf(bus->adap.name, sizeof(bus->adap.name),
 		"ProSavage DDC bus at %02x:%02x.%x",
 		dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
-	ret = i2c_register_bus(dev, bus, chip->mmio + 0x8000, CR_SERIAL2);
+	ret = i2c_register_bus(dev, bus, chip->mmio + 0x8000, CR_SERIAL2, I2C_CLASS_DDC);
 	if (ret) {
 		goto err_adap;
 	}
diff -ura xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-savage4.c linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-savage4.c
--- xx-linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-savage4.c	2004-05-09 11:03:02.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/i2c/busses/i2c-savage4.c	2004-05-09 20:01:31.000000000 +0200
@@ -149,6 +149,7 @@
 	.owner		= THIS_MODULE,
 	.name		= "I2C Savage4 adapter",
 	.algo_data	= &sav_i2c_bit_data,
+	.class		= I2C_CLASS_ALL, /* fixme: correct class entry? */
 };
 
 static struct pci_device_id savage4_ids[] __devinitdata = {

diff -ura xx-linux-2.6-6-rc3-mm2/drivers/i2c/i2c-core.c linux-2.6-6-rc3-mm2/drivers/i2c/i2c-core.c
--- xx-linux-2.6-6-rc3-mm2/drivers/i2c/i2c-core.c	2004-05-09 11:03:03.000000000 +0200
+++ linux-2.6-6-rc3-mm2/drivers/i2c/i2c-core.c	2004-05-09 21:18:35.000000000 +0200
@@ -148,8 +148,11 @@
 	list_for_each(item,&drivers) {
 		driver = list_entry(item, struct i2c_driver, list);
 		if (driver->flags & I2C_DF_NOTIFY)
-			/* We ignore the return code; if it fails, too bad */
-			driver->attach_adapter(adap);
+			if (adap->class & driver->class)
+				/* We ignore the return code; if it fails, too bad */
+				driver->attach_adapter(adap);
+			else
+				printk("i2c-core: skipping driver '%s' on adapter '%s' (class mismatch)\n",driver->name, adap->name); 
 	}
 	up(&core_lists);
 
@@ -247,7 +250,10 @@
 	if (driver->flags & I2C_DF_NOTIFY) {
 		list_for_each(item,&adapters) {
 			adapter = list_entry(item, struct i2c_adapter, list);
-			driver->attach_adapter(adapter);
+			if (adapter->class & driver->class)
+				driver->attach_adapter(adapter);
+			else
+				printk("i2c-core: skipping driver '%s' on adapter '%s' (class mismatch)\n",driver->name, adap->name); 
 		}
 	}
 


Home | Main Index | Thread Index