[i2c] [PATCH] i2c: add id's to devices

Jean Delvare khali at linux-fr.org
Fri Jan 5 09:06:59 CET 2007


Hi Stephen,

On Thu, 4 Jan 2007 14:18:36 -0800, Stephen Hemminger wrote:
> There are id's available in the adapter data structure but few of the
> drivers were setting them. This patches adds the id initialization to
> several of them.
> 
> Signed-off-by: Stephen Hemminger <shemminger at osdl.org>
> 
> ---
>  drivers/i2c/busses/i2c-ali1535.c |    1 +
>  drivers/i2c/busses/i2c-ali15x3.c |    1 +
>  drivers/i2c/busses/i2c-amd756.c  |    1 +
>  drivers/i2c/busses/i2c-amd8111.c |    1 +
>  drivers/i2c/busses/i2c-i801.c    |    1 +
>  drivers/i2c/busses/i2c-nforce2.c |    1 +
>  drivers/i2c/busses/i2c-piix4.c   |    1 +
>  drivers/i2c/busses/i2c-sis5595.c |    1 +
>  drivers/i2c/busses/i2c-sis630.c  |    1 +
>  drivers/i2c/busses/i2c-sis96x.c  |    1 +
>  drivers/i2c/busses/i2c-via.c     |    1 +
>  drivers/i2c/busses/i2c-voodoo3.c |    1 +
>  12 files changed, 12 insertions(+)
> 
> --- lifebook.orig/drivers/i2c/busses/i2c-ali1535.c	2007-01-04 10:11:23.000000000 -0800
> +++ lifebook/drivers/i2c/busses/i2c-ali1535.c	2007-01-04 12:31:03.000000000 -0800
> @@ -475,6 +475,7 @@
>  
>  static struct i2c_adapter ali1535_adapter = {
>  	.owner		= THIS_MODULE,
> +	.id	        = I2C_HW_SMBUS_ALI1535,
>  	.class          = I2C_CLASS_HWMON,
>  	.algo		= &smbus_algorithm,
>  };
> --- lifebook.orig/drivers/i2c/busses/i2c-ali15x3.c	2007-01-04 10:11:23.000000000 -0800
> +++ lifebook/drivers/i2c/busses/i2c-ali15x3.c	2007-01-04 10:13:02.000000000 -0800
> @@ -470,6 +470,7 @@
>  
>  static struct i2c_adapter ali15x3_adapter = {
>  	.owner		= THIS_MODULE,
> +	.id		= I2C_HW_SMBUS_ALI15X3,
>  	.class          = I2C_CLASS_HWMON,
>  	.algo		= &smbus_algorithm,
>  };
> --- lifebook.orig/drivers/i2c/busses/i2c-amd756.c	2007-01-04 10:11:23.000000000 -0800
> +++ lifebook/drivers/i2c/busses/i2c-amd756.c	2007-01-04 10:14:26.000000000 -0800
> @@ -302,6 +302,7 @@
>  struct i2c_adapter amd756_smbus = {
>  	.owner		= THIS_MODULE,
>  	.class          = I2C_CLASS_HWMON,
> +	.id		= I2C_HW_SMBUS_AMD756,
>  	.algo		= &smbus_algorithm,
>  };
>  
> --- lifebook.orig/drivers/i2c/busses/i2c-amd8111.c	2007-01-04 10:11:23.000000000 -0800
> +++ lifebook/drivers/i2c/busses/i2c-amd8111.c	2007-01-04 12:32:27.000000000 -0800
> @@ -352,6 +352,7 @@
>  	snprintf(smbus->adapter.name, I2C_NAME_SIZE,
>  		"SMBus2 AMD8111 adapter at %04x", smbus->base);
>  	smbus->adapter.class = I2C_CLASS_HWMON;
> +	smbus->adapter.id = I2C_HW_SMBUS_AMD8111;
>  	smbus->adapter.algo = &smbus_algorithm;
>  	smbus->adapter.algo_data = smbus;
>  
> --- lifebook.orig/drivers/i2c/busses/i2c-i801.c	2007-01-04 10:05:20.000000000 -0800
> +++ lifebook/drivers/i2c/busses/i2c-i801.c	2007-01-04 10:10:28.000000000 -0800
> @@ -443,6 +443,7 @@
>  static struct i2c_adapter i801_adapter = {
>  	.owner		= THIS_MODULE,
>  	.class		= I2C_CLASS_HWMON,
> +	.id		= I2C_HW_SMBUS_I801,
>  	.algo		= &smbus_algorithm,
>  };
>  
> --- lifebook.orig/drivers/i2c/busses/i2c-nforce2.c	2007-01-04 10:11:23.000000000 -0800
> +++ lifebook/drivers/i2c/busses/i2c-nforce2.c	2007-01-04 12:33:03.000000000 -0800
> @@ -239,6 +239,7 @@
>  	}
>  	smbus->adapter.owner = THIS_MODULE;
>  	smbus->adapter.class = I2C_CLASS_HWMON;
> +	smbus->adapter.id = I2C_HW_SMBUS_NFORCE2;
>  	smbus->adapter.algo = &smbus_algorithm;
>  	smbus->adapter.algo_data = smbus;
>  	smbus->adapter.dev.parent = &dev->dev;
> --- lifebook.orig/drivers/i2c/busses/i2c-piix4.c	2007-01-04 10:11:24.000000000 -0800
> +++ lifebook/drivers/i2c/busses/i2c-piix4.c	2007-01-04 10:12:24.000000000 -0800
> @@ -383,6 +383,7 @@
>  
>  static struct i2c_adapter piix4_adapter = {
>  	.owner		= THIS_MODULE,
> +	.id		= I2C_HW_SMBUS_PIIX4,
>  	.class		= I2C_CLASS_HWMON,
>  	.algo		= &smbus_algorithm,
>  };
> --- lifebook.orig/drivers/i2c/busses/i2c-sis5595.c	2007-01-04 10:11:24.000000000 -0800
> +++ lifebook/drivers/i2c/busses/i2c-sis5595.c	2007-01-04 12:30:41.000000000 -0800
> @@ -366,6 +366,7 @@
>  static struct i2c_adapter sis5595_adapter = {
>  	.owner		= THIS_MODULE,
>  	.class          = I2C_CLASS_HWMON,
> +	.id	        = I2C_HW_SMBUS_SIS5595,
>  	.algo		= &smbus_algorithm,
>  };
>  
> --- lifebook.orig/drivers/i2c/busses/i2c-sis630.c	2007-01-04 10:11:24.000000000 -0800
> +++ lifebook/drivers/i2c/busses/i2c-sis630.c	2007-01-04 12:31:32.000000000 -0800
> @@ -458,6 +458,7 @@
>  static struct i2c_adapter sis630_adapter = {
>  	.owner		= THIS_MODULE,
>  	.class		= I2C_CLASS_HWMON,
> +	.id	        = I2C_HW_SMBUS_SIS630,
>  	.algo		= &smbus_algorithm,
>  };
>  
> --- lifebook.orig/drivers/i2c/busses/i2c-sis96x.c	2007-01-04 10:11:24.000000000 -0800
> +++ lifebook/drivers/i2c/busses/i2c-sis96x.c	2007-01-04 12:31:53.000000000 -0800
> @@ -250,6 +250,7 @@
>  static struct i2c_adapter sis96x_adapter = {
>  	.owner		= THIS_MODULE,
>  	.class		= I2C_CLASS_HWMON,
> +	.id	        = I2C_HW_SMBUS_SIS96X,
>  	.algo		= &smbus_algorithm,
>  };
>  
> --- lifebook.orig/drivers/i2c/busses/i2c-via.c	2007-01-04 10:11:24.000000000 -0800
> +++ lifebook/drivers/i2c/busses/i2c-via.c	2007-01-04 10:13:28.000000000 -0800
> @@ -87,6 +87,7 @@
>  static struct i2c_adapter vt586b_adapter = {
>  	.owner		= THIS_MODULE,
>  	.class          = I2C_CLASS_HWMON,
> +	.id		= I2C_HW_SMBUS_VIA2,
>  	.name		= "VIA i2c",
>  	.algo_data	= &bit_data,
>  };

Not correct (although you couldn't guess it.) I2C_HW_SMBUS_VIA2 was
originally the ID of the i2c-viapro driver, not i2c-via.

> --- lifebook.orig/drivers/i2c/busses/i2c-voodoo3.c	2007-01-04 10:11:24.000000000 -0800
> +++ lifebook/drivers/i2c/busses/i2c-voodoo3.c	2007-01-04 10:13:52.000000000 -0800
> @@ -166,6 +166,7 @@
>  static struct i2c_adapter voodoo3_i2c_adapter = {
>  	.owner		= THIS_MODULE,
>  	.class		= I2C_CLASS_TV_ANALOG, 
> +	.id		= I2C_HW_SMBUS_VOODOO3,
>  	.name		= "I2C Voodoo3/Banshee adapter",
>  	.algo_data	= &voo_i2c_bit_data,
>  };

Hmm, please back out this one, this bus is not actually an SMBus (it's
bit-banged I2C), I don't think this define should exist at all. I'll
clean it up myself in a different patch.

Otherwise it's OK. I found that these IDs were dropped in 2.6.0-test6
because they were unused... But now we seem to need them again (at
least for the i2c-i801) so I don't think there's any problem adding
them back.

Thanks,
-- 
Jean Delvare



More information about the i2c mailing list