[i2c] [patch 2.6.19-rc6 3/11] i2c adapters don't use i2c_adapter.dev

Jean Delvare khali at linux-fr.org
Fri Dec 15 18:16:27 CET 2006


David,

On Sat, 25 Nov 2006 14:58:05 -0800, David Brownell wrote:
> I2C adapter driver cleanup:  stop using "i2c_adapter.dev" now that
> it's finally gone; use "i2c_adapter.class_dev.dev" instead.  Most
> of the change (by volume) relates to driver model messages.
> 
> Signed-off-by: David Brownell <dbrownell at users.sourceforge.net>
> 
> ----
> Yes, this is a huge patch ... but it's essentially the same cosmetic
> change, repeated on a few dozen files.  The PCI based ones have been
> compile-tested on x86, and in one case run-tested.  Likewise with
> the ones for ARM based SOCs.
> 
>  drivers/i2c/busses/i2c-ali1535.c      |   28 ++++++++---------
>  drivers/i2c/busses/i2c-ali1563.c      |   30 +++++++++---------
>  drivers/i2c/busses/i2c-ali15x3.c      |   26 ++++++++--------
>  drivers/i2c/busses/i2c-amd756-s4882.c |    8 ++---
>  drivers/i2c/busses/i2c-amd756.c       |   28 ++++++++---------
>  drivers/i2c/busses/i2c-amd8111.c      |    6 +--
>  drivers/i2c/busses/i2c-hydra.c        |    2 -
>  drivers/i2c/busses/i2c-i801.c         |    4 +-
>  drivers/i2c/busses/i2c-i810.c         |    6 +--
>  drivers/i2c/busses/i2c-ibm_iic.c      |    3 +
>  drivers/i2c/busses/i2c-iop3xx.c       |    2 -
>  drivers/i2c/busses/i2c-ixp2000.c      |    2 -
>  drivers/i2c/busses/i2c-ixp4xx.c       |    2 -
>  drivers/i2c/busses/i2c-mpc.c          |    2 -
>  drivers/i2c/busses/i2c-mv64xxx.c      |    1 
>  drivers/i2c/busses/i2c-nforce2.c      |   17 +++++-----
>  drivers/i2c/busses/i2c-ocores.c       |    2 -
>  drivers/i2c/busses/i2c-omap.c         |    2 -
>  drivers/i2c/busses/i2c-piix4.c        |   26 ++++++++--------
>  drivers/i2c/busses/i2c-powermac.c     |    2 -
>  drivers/i2c/busses/i2c-prosavage.c    |    4 +-
>  drivers/i2c/busses/i2c-pxa.c          |   54 +++++++++++++++++-----------------
>  drivers/i2c/busses/i2c-s3c2410.c      |   10 +++---
>  drivers/i2c/busses/i2c-savage4.c      |    4 +-
>  drivers/i2c/busses/i2c-sis5595.c      |   18 +++++------
>  drivers/i2c/busses/i2c-sis630.c       |   40 ++++++++++++-------------
>  drivers/i2c/busses/i2c-sis96x.c       |   24 +++++++--------
>  drivers/i2c/busses/i2c-stub.c         |   16 +++++-----
>  drivers/i2c/busses/i2c-via.c          |    4 +-
>  drivers/i2c/busses/i2c-viapro.c       |   22 ++++++-------
>  drivers/i2c/busses/i2c-voodoo3.c      |    6 +--
>  31 files changed, 202 insertions(+), 199 deletions(-)
> 
> Index: g26/drivers/i2c/busses/i2c-nforce2.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-nforce2.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-nforce2.c	2006-11-25 14:24:50.000000000 -0800

Note that the i2c-nforce2 driver was updated in 2.6.20-rc1 so this part
of the patch needs to be updated.

> @@ -129,6 +129,7 @@ static s32 nforce2_access(struct i2c_ada
>  	unsigned char protocol, pec, temp;
>  	unsigned char len = 0; /* to keep the compiler quiet */
>  	int i;
> +	struct device *dev = adap->class_dev.dev;

That's a good idea to improve readbility and reduce the need for line
wrapping. Maybe you could do that for other drivers as well, just not
when there are only debug messages, otherwise you'll get an annoying
compiler warning.

>  
>  	protocol = (read_write == I2C_SMBUS_READ) ? NVIDIA_SMB_PRTCL_READ :
>  		NVIDIA_SMB_PRTCL_WRITE;
> @@ -185,15 +186,15 @@ static s32 nforce2_access(struct i2c_ada
>  			break;
>  
>  		case I2C_SMBUS_PROC_CALL:
> -			dev_err(&adap->dev, "I2C_SMBUS_PROC_CALL not supported!\n");
> +			dev_err(dev, "I2C_SMBUS_PROC_CALL not supported!\n");
>  			return -1;
>  
>  		case I2C_SMBUS_BLOCK_PROC_CALL:
> -			dev_err(&adap->dev, "I2C_SMBUS_BLOCK_PROC_CALL not supported!\n");
> +			dev_err(dev, "I2C_SMBUS_BLOCK_PROC_CALL not supported!\n");
>  			return -1;
>  
>  		default:
> -			dev_err(&adap->dev, "Unsupported transaction %d\n", size);
> +			dev_err(dev, "Unsupported transaction %d\n", size);
>  			return -1;
>  	}
>  
> @@ -212,7 +213,7 @@ static s32 nforce2_access(struct i2c_ada
>  	}
>  
>  	if ((~temp & NVIDIA_SMB_STS_DONE) || (temp & NVIDIA_SMB_STS_STATUS)) {
> -		dev_dbg(&adap->dev, "SMBus Timeout! (0x%02x)\n", temp);
> +		dev_dbg(dev, "SMBus Timeout! (0x%02x)\n", temp);
>  		return -1;
>  	}
>  
> @@ -296,23 +297,24 @@ static int __devinit nforce2_probe_smb (
>  	smbus->dev = dev;
>  
>  	if (!request_region(smbus->base, smbus->size, nforce2_driver.name)) {
> -		dev_err(&smbus->adapter.dev, "Error requesting region %02x .. %02X for %s\n",
> +		dev_err(&dev->dev, "Error requesting region %02x .. %02X for %s\n",
>  			smbus->base, smbus->base+smbus->size-1, name);
>  		return -1;
>  	}
>  	smbus->adapter = nforce2_adapter;
>  	smbus->adapter.algo_data = smbus;
> -	smbus->adapter.dev.parent = &dev->dev;
> +	smbus->adapter.class_dev.dev = &dev->dev;

As mentioned earlier, this one change belongs to the patch changing
i2c-core. Same for all other drivers below, so I won't repeat it each
time.

>  	snprintf(smbus->adapter.name, I2C_NAME_SIZE,
> -		"SMBus nForce2 adapter at %04x", smbus->base);
> +		"SMBus nForce2 adapter %s at %04x", name, smbus->base);

I can't see how this patch fits in this patchset. And there are
user-space tools out there which rely on the adapter name strings, so
we are not going to change them without a very good reason.

>  
>  	error = i2c_add_adapter(&smbus->adapter);
>  	if (error) {
> -		dev_err(&smbus->adapter.dev, "Failed to register adapter.\n");
> +		dev_err(&dev->dev, "Failed to register adapter.\n");
>  		release_region(smbus->base, smbus->size);
>  		return -1;
>  	}
> -	dev_info(&smbus->adapter.dev, "nForce2 SMBus adapter at %#x\n", smbus->base);
> +	dev_info(&dev->dev, "%s - %s\n", smbus->adapter.class_dev.class_id,
> +		smbus->adapter.name);

I'm a bit curious about this change too. What's the idea?

>  	return 0;
>  }
>  
> Index: g26/drivers/i2c/busses/i2c-mv64xxx.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-mv64xxx.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-mv64xxx.c	2006-11-25 14:12:32.000000000 -0800
> @@ -520,6 +520,7 @@ mv64xxx_i2c_probe(struct platform_device
>  		rc = -ENXIO;
>  		goto exit_unmap_regs;
>  	}
> +	drv_data->adapter.class_dev.dev = &pd->dev;
>  	drv_data->adapter.id = I2C_HW_MV64XXX;
>  	drv_data->adapter.algo = &mv64xxx_i2c_algo;
>  	drv_data->adapter.owner = THIS_MODULE;
> Index: g26/drivers/i2c/busses/i2c-via.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-via.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-via.c	2006-11-25 14:12:32.000000000 -0800
> @@ -137,8 +137,8 @@ static int __devinit vt586b_probe(struct
>  	outb(inb(I2C_DIR) & ~(I2C_SDA | I2C_SCL), I2C_DIR);
>  	outb(inb(I2C_OUT) & ~(I2C_SDA | I2C_SCL), I2C_OUT);
>  
> -	/* set up the driverfs linkage to our parent device */
> -	vt586b_adapter.dev.parent = &dev->dev;
> +	/* set up the driver model linkage to our parent device */
> +	vt586b_adapter.class_dev.dev = &dev->dev;
>  
>  	res = i2c_bit_add_bus(&vt586b_adapter);
>  	if ( res < 0 ) {
> Index: g26/drivers/i2c/busses/i2c-prosavage.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-prosavage.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-prosavage.c	2006-11-25 14:12:32.000000000 -0800
> @@ -174,7 +174,7 @@ static int i2c_register_bus(struct pci_d
>  	p->adap.owner	  = THIS_MODULE;
>  	p->adap.id	  = I2C_HW_B_S3VIA;
>  	p->adap.algo_data = &p->algo;
> -	p->adap.dev.parent = &dev->dev;
> +	p->adap.class_dev.dev = &dev->dev;
>  	p->algo.setsda	  = bit_s3via_setsda;
>  	p->algo.setscl	  = bit_s3via_setscl;
>  	p->algo.getsda	  = bit_s3via_getsda;
> @@ -184,7 +184,7 @@ static int i2c_register_bus(struct pci_d
>  	p->algo.data	  = p;
>  	p->mmvga	  = mmvga;
>  	p->i2c_reg	  = i2c_reg;
> -    
> +
>  	ret = i2c_bit_add_bus(&p->adap);
>  	if (ret) {
>  		return ret;

Again, please don't include random whitespace changes in your patches.

> Index: g26/drivers/i2c/busses/i2c-powermac.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-powermac.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-powermac.c	2006-11-25 14:12:32.000000000 -0800
> @@ -250,7 +250,7 @@ static int __devexit i2c_powermac_probe(
>  	strcpy(adapter->name, name);
>  	adapter->algo = &i2c_powermac_algorithm;
>  	i2c_set_adapdata(adapter, bus);
> -	adapter->dev.parent = &dev->dev;
> +	adapter->class_dev.dev = &dev->dev;
>  	pmac_i2c_attach_adapter(bus, adapter);
>  	rc = i2c_add_adapter(adapter);
>  	if (rc) {
> Index: g26/drivers/i2c/busses/i2c-amd8111.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-amd8111.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-amd8111.c	2006-11-25 14:12:32.000000000 -0800
> @@ -254,7 +254,7 @@ static s32 amd8111_access(struct i2c_ada
>  			break;
>  
>  		default:
> -			dev_warn(&adap->dev, "Unsupported transaction %d\n", size);
> +			dev_warn(adap->class_dev.dev, "Unsupported transaction %d\n", size);
>  			return -1;
>  	}
>  

Care to wrap that long line to fit in 80 columns while you're there?

> @@ -355,8 +355,8 @@ static int __devinit amd8111_probe(struc
>  	smbus->adapter.algo = &smbus_algorithm;
>  	smbus->adapter.algo_data = smbus;
>  
> -	/* set up the driverfs linkage to our parent device */
> -	smbus->adapter.dev.parent = &dev->dev;
> +	/* set up the driver model linkage to our parent device */
> +	smbus->adapter.class_dev.dev = &dev->dev;
>  
>  	error = i2c_add_adapter(&smbus->adapter);
>  	if (error)
> Index: g26/drivers/i2c/busses/i2c-ocores.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-ocores.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-ocores.c	2006-11-25 14:12:32.000000000 -0800
> @@ -262,7 +262,7 @@ static int __devinit ocores_i2c_probe(st
>  	platform_set_drvdata(pdev, i2c);
>  	i2c->adap = ocores_adapter;
>  	i2c_set_adapdata(&i2c->adap, i2c);
> -	i2c->adap.dev.parent = &pdev->dev;
> +	i2c->adap.class_dev.dev = &pdev->dev;
>  
>  	/* add i2c adapter to i2c tree */
>  	ret = i2c_add_adapter(&i2c->adap);
> Index: g26/drivers/i2c/busses/i2c-sis630.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-sis630.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-sis630.c	2006-11-25 14:12:32.000000000 -0800
> @@ -128,22 +128,22 @@ static int sis630_transaction_start(stru
>  
>  	/* Make sure the SMBus host is ready to start transmitting. */
>  	if ((temp = sis630_read(SMB_CNT) & 0x03) != 0x00) {
> -		dev_dbg(&adap->dev, "SMBus busy (%02x).Resetting...\n",temp);
> +		dev_dbg(adap->class_dev.dev, "SMBus busy (%02x).Resetting...\n",temp);

Same here, line too long.

>  		/* kill smbus transaction */
>  		sis630_write(SMBHOST_CNT, 0x20);
>  
>  		if ((temp = sis630_read(SMB_CNT) & 0x03) != 0x00) {
> -			dev_dbg(&adap->dev, "Failed! (%02x)\n", temp);
> +			dev_dbg(adap->class_dev.dev, "Failed! (%02x)\n", temp);
>  			return -1;
>                  } else {
> -			dev_dbg(&adap->dev, "Successfull!\n");
> +			dev_dbg(adap->class_dev.dev, "Successfull!\n");
>  		}
>          }
>  
>  	/* save old clock, so we can prevent machine for hung */
>  	*oldclock = sis630_read(SMB_CNT);
>  
> -	dev_dbg(&adap->dev, "saved clock 0x%02x\n", *oldclock);
> +	dev_dbg(adap->class_dev.dev, "saved clock 0x%02x\n", *oldclock);
>  
>  	/* disable timeout interrupt , set Host Master Clock to 56KHz if requested */
>  	if (high_clock)
> @@ -176,17 +176,17 @@ static int sis630_transaction_wait(struc
>  
>  	/* If the SMBus is still busy, we give up */
>  	if (timeout >= MAX_TIMEOUT) {
> -		dev_dbg(&adap->dev, "SMBus Timeout!\n");
> +		dev_dbg(adap->class_dev.dev, "SMBus Timeout!\n");
>  		result = -1;
>  	}
>  
>  	if (temp & 0x02) {
> -		dev_dbg(&adap->dev, "Error: Failed bus transaction\n");
> +		dev_dbg(adap->class_dev.dev, "Error: Failed bus transaction\n");
>  		result = -1;
>  	}
>  
>  	if (temp & 0x04) {
> -		dev_err(&adap->dev, "Bus collision!\n");
> +		dev_err(adap->class_dev.dev, "Bus collision!\n");
>  		result = -1;
>  		/*
>  		  TBD: Datasheet say:
> @@ -205,7 +205,7 @@ static void sis630_transaction_end(struc
>  	/* clear all status "sticky" bits */
>  	sis630_write(SMB_STS, temp);
>  
> -	dev_dbg(&adap->dev, "SMB_CNT before clock restore 0x%02x\n", sis630_read(SMB_CNT));
> +	dev_dbg(adap->class_dev.dev, "SMB_CNT before clock restore 0x%02x\n", sis630_read(SMB_CNT));

Wrap.

>  
>  	/*
>  	 * restore old Host Master Clock if high_clock is set
> @@ -214,7 +214,7 @@ static void sis630_transaction_end(struc
>  	if (high_clock && !(oldclock & 0x20))
>  		sis630_write(SMB_CNT,(sis630_read(SMB_CNT) & ~0x20));
>  
> -	dev_dbg(&adap->dev, "SMB_CNT after clock restore 0x%02x\n", sis630_read(SMB_CNT));
> +	dev_dbg(adap->class_dev.dev, "SMB_CNT after clock restore 0x%02x\n", sis630_read(SMB_CNT));

Wrap. Each time it's needed, in fact.

>  }
>  
>  static int sis630_transaction(struct i2c_adapter *adap, int size)
> @@ -244,19 +244,19 @@ static int sis630_block_data(struct i2c_
>  			len = 32;
>  		sis630_write(SMB_COUNT, len);
>  		for (i=1; i <= len; i++) {
> -			dev_dbg(&adap->dev, "set data 0x%02x\n", data->block[i]);
> +			dev_dbg(adap->class_dev.dev, "set data 0x%02x\n", data->block[i]);
>  			/* set data */
>  			sis630_write(SMB_BYTE+(i-1)%8, data->block[i]);
>  			if (i==8 || (len<8 && i==len)) {
> -				dev_dbg(&adap->dev, "start trans len=%d i=%d\n",len ,i);
> +				dev_dbg(adap->class_dev.dev, "start trans len=%d i=%d\n",len ,i);
>  				/* first transaction */
>  				if (sis630_transaction_start(adap, SIS630_BLOCK_DATA, &oldclock))
>  					return -1;
>  			}
>  			else if ((i-1)%8 == 7 || i==len) {
> -				dev_dbg(&adap->dev, "trans_wait len=%d i=%d\n",len,i);
> +				dev_dbg(adap->class_dev.dev, "trans_wait len=%d i=%d\n",len,i);
>  				if (i>8) {
> -					dev_dbg(&adap->dev, "clear smbary_sts len=%d i=%d\n",len,i);
> +					dev_dbg(adap->class_dev.dev, "clear smbary_sts len=%d i=%d\n",len,i);
>  					/*
>  					   If this is not first transaction,
>  					   we must clear sticky bit.
> @@ -265,7 +265,7 @@ static int sis630_block_data(struct i2c_
>  					sis630_write(SMB_STS,0x10);
>  				}
>  				if (sis630_transaction_wait(adap, SIS630_BLOCK_DATA)) {
> -					dev_dbg(&adap->dev, "trans_wait failed\n");
> +					dev_dbg(adap->class_dev.dev, "trans_wait failed\n");
>  					rc = -1;
>  					break;
>  				}
> @@ -280,7 +280,7 @@ static int sis630_block_data(struct i2c_
>  		}
>  		do {
>  			if (sis630_transaction_wait(adap, SIS630_BLOCK_DATA)) {
> -				dev_dbg(&adap->dev, "trans_wait failed\n");
> +				dev_dbg(adap->class_dev.dev, "trans_wait failed\n");
>  				rc = -1;
>  				break;
>  			}
> @@ -292,14 +292,14 @@ static int sis630_block_data(struct i2c_
>  			if (data->block[0] > 32)
>  				data->block[0] = 32;
>  
> -			dev_dbg(&adap->dev, "block data read len=0x%x\n", data->block[0]);
> +			dev_dbg(adap->class_dev.dev, "block data read len=0x%x\n", data->block[0]);
>  
>  			for (i=0; i < 8 && len < data->block[0]; i++,len++) {
> -				dev_dbg(&adap->dev, "read i=%d len=%d\n", i, len);
> +				dev_dbg(adap->class_dev.dev, "read i=%d len=%d\n", i, len);
>  				data->block[len+1] = sis630_read(SMB_BYTE+i);
>  			}
>  
> -			dev_dbg(&adap->dev, "clear smbary_sts len=%d i=%d\n",len,i);
> +			dev_dbg(adap->class_dev.dev, "clear smbary_sts len=%d i=%d\n",len,i);
>  
>  			/* clear SMBARY_STS */
>  			sis630_write(SMB_STS,0x10);
> @@ -476,8 +476,8 @@ static int __devinit sis630_probe(struct
>  		return -ENODEV;
>  	}
>  
> -	/* set up the driverfs linkage to our parent device */
> -	sis630_adapter.dev.parent = &dev->dev;
> +	/* set up the driver model linkage to our parent device */
> +	sis630_adapter.class_dev.dev = &dev->dev;
>  
>  	sprintf(sis630_adapter.name, "SMBus SIS630 adapter at %04x",
>  		acpi_base + SMB_STS);
> Index: g26/drivers/i2c/busses/i2c-i810.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-i810.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-i810.c	2006-11-25 14:12:32.000000000 -0800
> @@ -210,9 +210,9 @@ static int __devinit i810_probe(struct p
>  		return retval;
>  	dev_info(&dev->dev, "i810/i815 i2c device found.\n");
>  
> -	/* set up the sysfs linkage to our parent device */
> -	i810_i2c_adapter.dev.parent = &dev->dev;
> -	i810_ddc_adapter.dev.parent = &dev->dev;
> +	/* set up the driver model linkage to our parent device */
> +	i810_i2c_adapter.class_dev.dev = &dev->dev;
> +	i810_ddc_adapter.class_dev.dev = &dev->dev;
>  
>  	retval = i2c_bit_add_bus(&i810_i2c_adapter);
>  	if (retval)
> Index: g26/drivers/i2c/busses/i2c-amd756.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-amd756.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-amd756.c	2006-11-25 14:12:32.000000000 -0800
> @@ -115,14 +115,14 @@ static int amd756_transaction(struct i2c
>  	int result = 0;
>  	int timeout = 0;
>  
> -	dev_dbg(&adap->dev, "Transaction (pre): GS=%04x, GE=%04x, ADD=%04x, "
> +	dev_dbg(adap->class_dev.dev, "Transaction (pre): GS=%04x, GE=%04x, ADD=%04x, "
>  		"DAT=%04x\n", inw_p(SMB_GLOBAL_STATUS),
>  		inw_p(SMB_GLOBAL_ENABLE), inw_p(SMB_HOST_ADDRESS),
>  		inb_p(SMB_HOST_DATA));
>  
>  	/* Make sure the SMBus host is ready to start transmitting */
>  	if ((temp = inw_p(SMB_GLOBAL_STATUS)) & (GS_HST_STS | GS_SMB_STS)) {
> -		dev_dbg(&adap->dev, "SMBus busy (%04x). Waiting...\n", temp);
> +		dev_dbg(adap->class_dev.dev, "SMBus busy (%04x). Waiting...\n", temp);
>  		do {
>  			msleep(1);
>  			temp = inw_p(SMB_GLOBAL_STATUS);
> @@ -130,7 +130,7 @@ static int amd756_transaction(struct i2c
>  		         (timeout++ < MAX_TIMEOUT));
>  		/* If the SMBus is still busy, we give up */
>  		if (timeout >= MAX_TIMEOUT) {
> -			dev_dbg(&adap->dev, "Busy wait timeout (%04x)\n", temp);
> +			dev_dbg(adap->class_dev.dev, "Busy wait timeout (%04x)\n", temp);
>  			goto abort;
>  		}
>  		timeout = 0;
> @@ -147,38 +147,38 @@ static int amd756_transaction(struct i2c
>  
>  	/* If the SMBus is still busy, we give up */
>  	if (timeout >= MAX_TIMEOUT) {
> -		dev_dbg(&adap->dev, "Completion timeout!\n");
> +		dev_dbg(adap->class_dev.dev, "Completion timeout!\n");
>  		goto abort;
>  	}
>  
>  	if (temp & GS_PRERR_STS) {
>  		result = -1;
> -		dev_dbg(&adap->dev, "SMBus Protocol error (no response)!\n");
> +		dev_dbg(adap->class_dev.dev, "SMBus Protocol error (no response)!\n");
>  	}
>  
>  	if (temp & GS_COL_STS) {
>  		result = -1;
> -		dev_warn(&adap->dev, "SMBus collision!\n");
> +		dev_warn(adap->class_dev.dev, "SMBus collision!\n");
>  	}
>  
>  	if (temp & GS_TO_STS) {
>  		result = -1;
> -		dev_dbg(&adap->dev, "SMBus protocol timeout!\n");
> +		dev_dbg(adap->class_dev.dev, "SMBus protocol timeout!\n");
>  	}
>  
>  	if (temp & GS_HCYC_STS)
> -		dev_dbg(&adap->dev, "SMBus protocol success!\n");
> +		dev_dbg(adap->class_dev.dev, "SMBus protocol success!\n");
>  
>  	outw_p(GS_CLEAR_STS, SMB_GLOBAL_STATUS);
>  
>  #ifdef DEBUG
>  	if (((temp = inw_p(SMB_GLOBAL_STATUS)) & GS_CLEAR_STS) != 0x00) {
> -		dev_dbg(&adap->dev,
> +		dev_dbg(adap->class_dev.dev,
>  			"Failed reset at end of transaction (%04x)\n", temp);
>  	}
>  #endif
>  
> -	dev_dbg(&adap->dev,
> +	dev_dbg(adap->class_dev.dev,
>  		"Transaction (post): GS=%04x, GE=%04x, ADD=%04x, DAT=%04x\n",
>  		inw_p(SMB_GLOBAL_STATUS), inw_p(SMB_GLOBAL_ENABLE),
>  		inw_p(SMB_HOST_ADDRESS), inb_p(SMB_HOST_DATA));
> @@ -186,7 +186,7 @@ static int amd756_transaction(struct i2c
>  	return result;
>  
>   abort:
> -	dev_warn(&adap->dev, "Sending abort\n");
> +	dev_warn(adap->class_dev.dev, "Sending abort\n");
>  	outw_p(inw(SMB_GLOBAL_ENABLE) | GE_ABORT, SMB_GLOBAL_ENABLE);
>  	msleep(100);
>  	outw_p(GS_CLEAR_STS, SMB_GLOBAL_STATUS);
> @@ -203,7 +203,7 @@ static s32 amd756_access(struct i2c_adap
>  	/** TODO: Should I supporte the 10-bit transfers? */
>  	switch (size) {
>  	case I2C_SMBUS_PROC_CALL:
> -		dev_dbg(&adap->dev, "I2C_SMBUS_PROC_CALL not supported!\n");
> +		dev_dbg(adap->class_dev.dev, "I2C_SMBUS_PROC_CALL not supported!\n");
>  		/* TODO: Well... It is supported, I'm just not sure what to do here... */
>  		return -1;
>  	case I2C_SMBUS_QUICK:
> @@ -374,8 +374,8 @@ static int __devinit amd756_probe(struct
>  	dev_dbg(&pdev->dev, "SMBREV = 0x%X\n", temp);
>  	dev_dbg(&pdev->dev, "AMD756_smba = 0x%X\n", amd756_ioport);
>  
> -	/* set up the driverfs linkage to our parent device */
> -	amd756_smbus.dev.parent = &pdev->dev;
> +	/* set up the driver model linkage to our parent device */
> +	amd756_smbus.class_dev.dev = &pdev->dev;
>  
>  	sprintf(amd756_smbus.name, "SMBus %s adapter at %04x",
>  		chipname[id->driver_data], amd756_ioport);
> Index: g26/drivers/i2c/busses/i2c-ali1563.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-ali1563.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-ali1563.c	2006-11-25 14:12:32.000000000 -0800
> @@ -68,7 +68,7 @@ static int ali1563_transaction(struct i2
>  	u32 data;
>  	int timeout;
>  
> -	dev_dbg(&a->dev, "Transaction (pre): STS=%02x, CNTL1=%02x, "
> +	dev_dbg(a->class_dev.dev, "Transaction (pre): STS=%02x, CNTL1=%02x, "
>  		"CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
>  		inb_p(SMB_HST_STS), inb_p(SMB_HST_CNTL1), inb_p(SMB_HST_CNTL2),
>  		inb_p(SMB_HST_CMD), inb_p(SMB_HST_ADD), inb_p(SMB_HST_DAT0),
> @@ -76,7 +76,7 @@ static int ali1563_transaction(struct i2
>  
>  	data = inb_p(SMB_HST_STS);
>  	if (data & HST_STS_BAD) {
> -		dev_err(&a->dev, "ali1563: Trying to reset busy device\n");
> +		dev_err(a->class_dev.dev, "ali1563: Trying to reset busy device\n");
>  		outb_p(data | HST_STS_BAD,SMB_HST_STS);
>  		data = inb_p(SMB_HST_STS);
>  		if (data & HST_STS_BAD)
> @@ -89,7 +89,7 @@ static int ali1563_transaction(struct i2
>  		msleep(1);
>  	while (((data = inb_p(SMB_HST_STS)) & HST_STS_BUSY) && --timeout);
>  
> -	dev_dbg(&a->dev, "Transaction (post): STS=%02x, CNTL1=%02x, "
> +	dev_dbg(a->class_dev.dev, "Transaction (post): STS=%02x, CNTL1=%02x, "
>  		"CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
>  		inb_p(SMB_HST_STS), inb_p(SMB_HST_CNTL1), inb_p(SMB_HST_CNTL2),
>  		inb_p(SMB_HST_CMD), inb_p(SMB_HST_ADD), inb_p(SMB_HST_DAT0),
> @@ -99,26 +99,26 @@ static int ali1563_transaction(struct i2
>  		return 0;
>  
>  	if (!timeout) {
> -		dev_err(&a->dev, "Timeout - Trying to KILL transaction!\n");
> +		dev_err(a->class_dev.dev, "Timeout - Trying to KILL transaction!\n");
>  		/* Issue 'kill' to host controller */
>  		outb_p(HST_CNTL2_KILL,SMB_HST_CNTL2);
>  		data = inb_p(SMB_HST_STS);
> - 	}
> +	}
>  
>  	/* device error - no response, ignore the autodetection case */
>  	if ((data & HST_STS_DEVERR) && (size != HST_CNTL2_QUICK)) {
> -		dev_err(&a->dev, "Device error!\n");
> +		dev_err(a->class_dev.dev, "Device error!\n");
>  	}
>  
>  	/* bus collision */
>  	if (data & HST_STS_BUSERR) {
> -		dev_err(&a->dev, "Bus collision!\n");
> +		dev_err(a->class_dev.dev, "Bus collision!\n");
>  		/* Issue timeout, hoping it helps */
>  		outb_p(HST_CNTL1_TIMEOUT,SMB_HST_CNTL1);
>  	}
>  
>  	if (data & HST_STS_FAIL) {
> -		dev_err(&a->dev, "Cleaning fail after KILL!\n");
> +		dev_err(a->class_dev.dev, "Cleaning fail after KILL!\n");
>  		outb_p(0x0,SMB_HST_CNTL2);
>  	}
>  
> @@ -130,7 +130,7 @@ static int ali1563_block_start(struct i2
>  	u32 data;
>  	int timeout;
>  
> -	dev_dbg(&a->dev, "Block (pre): STS=%02x, CNTL1=%02x, "
> +	dev_dbg(a->class_dev.dev, "Block (pre): STS=%02x, CNTL1=%02x, "
>  		"CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
>  		inb_p(SMB_HST_STS), inb_p(SMB_HST_CNTL1), inb_p(SMB_HST_CNTL2),
>  		inb_p(SMB_HST_CMD), inb_p(SMB_HST_ADD), inb_p(SMB_HST_DAT0),
> @@ -138,7 +138,7 @@ static int ali1563_block_start(struct i2
>  
>  	data = inb_p(SMB_HST_STS);
>  	if (data & HST_STS_BAD) {
> -		dev_warn(&a->dev,"ali1563: Trying to reset busy device\n");
> +		dev_warn(a->class_dev.dev,"ali1563: Trying to reset busy device\n");
>  		outb_p(data | HST_STS_BAD,SMB_HST_STS);
>  		data = inb_p(SMB_HST_STS);
>  		if (data & HST_STS_BAD)
> @@ -156,7 +156,7 @@ static int ali1563_block_start(struct i2
>  		msleep(1);
>  	while (!((data = inb_p(SMB_HST_STS)) & HST_STS_DONE) && --timeout);
>  
> -	dev_dbg(&a->dev, "Block (post): STS=%02x, CNTL1=%02x, "
> +	dev_dbg(a->class_dev.dev, "Block (post): STS=%02x, CNTL1=%02x, "
>  		"CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
>  		inb_p(SMB_HST_STS), inb_p(SMB_HST_CNTL1), inb_p(SMB_HST_CNTL2),
>  		inb_p(SMB_HST_CMD), inb_p(SMB_HST_ADD), inb_p(SMB_HST_DAT0),
> @@ -164,7 +164,7 @@ static int ali1563_block_start(struct i2
>  
>  	if (timeout && !(data & HST_STS_BAD))
>  		return 0;
> -	dev_err(&a->dev, "SMBus Error: %s%s%s%s%s\n",
> +	dev_err(a->class_dev.dev, "SMBus Error: %s%s%s%s%s\n",
>  		timeout ? "Timeout " : "",
>  		data & HST_STS_FAIL ? "Transaction Failed " : "",
>  		data & HST_STS_BUSERR ? "No response or Bus Collision " : "",
> @@ -230,13 +230,13 @@ static s32 ali1563_access(struct i2c_ada
>  			break;
>  	}
>  	if (!timeout)
> -		dev_warn(&a->dev,"SMBus not idle. HST_STS = %02x\n",reg);
> +		dev_warn(a->class_dev.dev,"SMBus not idle. HST_STS = %02x\n",reg);
>  	outb_p(0xff,SMB_HST_STS);
>  
>  	/* Map the size to what the chip understands */
>  	switch (size) {
>  	case I2C_SMBUS_PROC_CALL:
> -		dev_err(&a->dev, "I2C_SMBUS_PROC_CALL not supported!\n");
> +		dev_err(a->class_dev.dev, "I2C_SMBUS_PROC_CALL not supported!\n");
>  		error = -EINVAL;
>  		break;
>  	case I2C_SMBUS_QUICK:
> @@ -385,7 +385,7 @@ static int __devinit ali1563_probe(struc
>  
>  	if ((error = ali1563_setup(dev)))
>  		return error;
> -	ali1563_adapter.dev.parent = &dev->dev;
> +	ali1563_adapter.class_dev.dev = &dev->dev;
>  	sprintf(ali1563_adapter.name,"SMBus ALi 1563 Adapter @ %04x",
>  		ali1563_smba);
>  	if ((error = i2c_add_adapter(&ali1563_adapter)))
> Index: g26/drivers/i2c/busses/i2c-viapro.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-viapro.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-viapro.c	2006-11-25 14:12:32.000000000 -0800
> @@ -109,7 +109,7 @@ static unsigned int vt596_features;
>  #ifdef DEBUG
>  static void vt596_dump_regs(const char *msg, u8 size)
>  {
> -	dev_dbg(&vt596_adapter.dev, "%s: STS=%02x CNT=%02x CMD=%02x ADD=%02x "
> +	dev_dbg(vt596_adapter.class_dev.dev, "%s: STS=%02x CNT=%02x CMD=%02x ADD=%02x "
>  		"DAT=%02x,%02x\n", msg, inb_p(SMBHSTSTS), inb_p(SMBHSTCNT),
>  		inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0),
>  		inb_p(SMBHSTDAT1));
> @@ -118,11 +118,11 @@ static void vt596_dump_regs(const char *
>  	 || size == VT596_I2C_BLOCK_DATA) {
>  		int i;
>  
> -		dev_dbg(&vt596_adapter.dev, "BLK=");
> +		dev_dbg(vt596_adapter.class_dev.dev, "BLK=");
>  		for (i = 0; i < I2C_SMBUS_BLOCK_MAX / 2; i++)
>  			printk("%02x,", inb_p(SMBBLKDAT));
>  		printk("\n");
> -		dev_dbg(&vt596_adapter.dev, "    ");
> +		dev_dbg(vt596_adapter.class_dev.dev, "    ");
>  		for (; i < I2C_SMBUS_BLOCK_MAX - 1; i++)
>  			printk("%02x,", inb_p(SMBBLKDAT));
>  		printk("%02x\n", inb_p(SMBBLKDAT));
> @@ -143,12 +143,12 @@ static int vt596_transaction(u8 size)
>  
>  	/* Make sure the SMBus host is ready to start transmitting */
>  	if ((temp = inb_p(SMBHSTSTS)) & 0x1F) {
> -		dev_dbg(&vt596_adapter.dev, "SMBus busy (0x%02x). "
> +		dev_dbg(vt596_adapter.class_dev.dev, "SMBus busy (0x%02x). "
>  			"Resetting...\n", temp);
>  
>  		outb_p(temp, SMBHSTSTS);
>  		if ((temp = inb_p(SMBHSTSTS)) & 0x1F) {
> -			dev_err(&vt596_adapter.dev, "SMBus reset failed! "
> +			dev_err(vt596_adapter.class_dev.dev, "SMBus reset failed! "
>  				"(0x%02x)\n", temp);
>  			return -1;
>  		}
> @@ -166,18 +166,18 @@ static int vt596_transaction(u8 size)
>  	/* If the SMBus is still busy, we give up */
>  	if (timeout >= MAX_TIMEOUT) {
>  		result = -1;
> -		dev_err(&vt596_adapter.dev, "SMBus timeout!\n");
> +		dev_err(vt596_adapter.class_dev.dev, "SMBus timeout!\n");
>  	}
>  
>  	if (temp & 0x10) {
>  		result = -1;
> -		dev_err(&vt596_adapter.dev, "Transaction failed (0x%02x)\n",
> +		dev_err(vt596_adapter.class_dev.dev, "Transaction failed (0x%02x)\n",
>  			size);
>  	}
>  
>  	if (temp & 0x08) {
>  		result = -1;
> -		dev_err(&vt596_adapter.dev, "SMBus collision!\n");
> +		dev_err(vt596_adapter.class_dev.dev, "SMBus collision!\n");
>  	}
>  
>  	if (temp & 0x04) {
> @@ -188,7 +188,7 @@ static int vt596_transaction(u8 size)
>  		   to frighten the user. */
>  		if (!((size == VT596_QUICK && !read) ||
>  		      (size == VT596_BYTE && read)))
> -			dev_err(&vt596_adapter.dev, "Transaction error!\n");
> +			dev_err(vt596_adapter.class_dev.dev, "Transaction error!\n");
>  	}
>  
>  	/* Resetting status register */
> @@ -283,7 +283,7 @@ static s32 vt596_access(struct i2c_adapt
>  	return 0;
>  
>  exit_unsupported:
> -	dev_warn(&vt596_adapter.dev, "Unsupported command invoked! (0x%02x)\n",
> +	dev_warn(vt596_adapter.class_dev.dev, "Unsupported command invoked! (0x%02x)\n",
>  		 size);
>  	return -1;
>  }
> @@ -400,7 +400,7 @@ found:
>  		break;
>  	}
>  
> -	vt596_adapter.dev.parent = &pdev->dev;
> +	vt596_adapter.class_dev.dev = &pdev->dev;
>  	snprintf(vt596_adapter.name, I2C_NAME_SIZE,
>  		 "SMBus Via Pro adapter at %04x", vt596_smba);
>  
> Index: g26/drivers/i2c/busses/i2c-iop3xx.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-iop3xx.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-iop3xx.c	2006-11-25 14:12:32.000000000 -0800
> @@ -491,7 +491,7 @@ iop3xx_i2c_probe(struct platform_device 
>  	memcpy(new_adapter->name, pdev->name, strlen(pdev->name));
>  	new_adapter->id = I2C_HW_IOP3XX;
>  	new_adapter->owner = THIS_MODULE;
> -	new_adapter->dev.parent = &pdev->dev;
> +	new_adapter->class_dev.dev = &pdev->dev;
>  
>  	/*
>  	 * Default values...should these come in from board code?
> Index: g26/drivers/i2c/busses/i2c-ibm_iic.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-ibm_iic.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-ibm_iic.c	2006-11-25 14:12:32.000000000 -0800
> @@ -718,9 +718,10 @@ static int __devinit iic_probe(struct oc
>  	
>  	/* Initialize IIC interface */
>  	iic_dev_init(dev);
> -	
> +
>  	/* Register it with i2c layer */
>  	adap = &dev->adap;
> +	adap->class_dev.dev = &ocp->dev;
>  	strcpy(adap->name, "IBM IIC");
>  	i2c_set_adapdata(adap, dev);
>  	adap->id = I2C_HW_OCP;
> Index: g26/drivers/i2c/busses/i2c-i801.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-i801.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-i801.c	2006-11-25 14:12:32.000000000 -0800
> @@ -512,8 +512,8 @@ static int __devinit i801_probe(struct p
>  	else
>  		dev_dbg(&dev->dev, "SMBus using PCI Interrupt\n");
>  
> -	/* set up the driverfs linkage to our parent device */
> -	i801_adapter.dev.parent = &dev->dev;
> +	/* set up the driver model linkage to our parent device */
> +	i801_adapter.class_dev.dev = &dev->dev;
>  
>  	snprintf(i801_adapter.name, I2C_NAME_SIZE,
>  		"SMBus I801 adapter at %04lx", i801_smba);
> Index: g26/drivers/i2c/busses/i2c-pxa.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-pxa.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-pxa.c	2006-11-25 14:12:32.000000000 -0800
> @@ -130,7 +130,7 @@ static unsigned int i2c_debug = DEBUG;
>  
>  static void i2c_pxa_show_state(struct pxa_i2c *i2c, int lno, const char *fname)
>  {
> -	dev_dbg(&i2c->adap.dev, "state:%s:%d: ISR=%08x, ICR=%08x, IBMR=%02x\n", fname, lno, ISR, ICR, IBMR);
> +	dev_dbg(i2c->adap.class_dev.dev, "state:%s:%d: ISR=%08x, ICR=%08x, IBMR=%02x\n", fname, lno, ISR, ICR, IBMR);
>  }
>  
>  #define show_state(i2c) i2c_pxa_show_state(i2c, __LINE__, __FUNCTION__)
> @@ -169,7 +169,7 @@ static void i2c_pxa_abort(struct pxa_i2c
>  	unsigned long timeout = jiffies + HZ/4;
>  
>  	if (i2c_pxa_is_slavemode(i2c)) {
> -		dev_dbg(&i2c->adap.dev, "%s: called in slave mode\n", __func__);
> +		dev_dbg(i2c->adap.class_dev.dev, "%s: called in slave mode\n", __func__);
>  		return;
>  	}
>  
> @@ -213,12 +213,12 @@ static int i2c_pxa_wait_master(struct px
>  
>  	while (time_before(jiffies, timeout)) {
>  		if (i2c_debug > 1)
> -			dev_dbg(&i2c->adap.dev, "%s: %ld: ISR=%08x, ICR=%08x, IBMR=%02x\n",
> +			dev_dbg(i2c->adap.class_dev.dev, "%s: %ld: ISR=%08x, ICR=%08x, IBMR=%02x\n",
>  				__func__, (long)jiffies, ISR, ICR, IBMR);
>  
>  		if (ISR & ISR_SAD) {
>  			if (i2c_debug > 0)
> -				dev_dbg(&i2c->adap.dev, "%s: Slave detected\n", __func__);
> +				dev_dbg(i2c->adap.class_dev.dev, "%s: Slave detected\n", __func__);
>  			goto out;
>  		}
>  
> @@ -228,7 +228,7 @@ static int i2c_pxa_wait_master(struct px
>  		 */
>  		if ((ISR & (ISR_UB | ISR_IBB)) == 0 && IBMR == 3) {
>  			if (i2c_debug > 0)
> -				dev_dbg(&i2c->adap.dev, "%s: done\n", __func__);
> +				dev_dbg(i2c->adap.class_dev.dev, "%s: done\n", __func__);
>  			return 1;
>  		}
>  
> @@ -236,7 +236,7 @@ static int i2c_pxa_wait_master(struct px
>  	}
>  
>  	if (i2c_debug > 0)
> -		dev_dbg(&i2c->adap.dev, "%s: did not free\n", __func__);
> +		dev_dbg(i2c->adap.class_dev.dev, "%s: did not free\n", __func__);
>   out:
>  	return 0;
>  }
> @@ -244,12 +244,12 @@ static int i2c_pxa_wait_master(struct px
>  static int i2c_pxa_set_master(struct pxa_i2c *i2c)
>  {
>  	if (i2c_debug)
> -		dev_dbg(&i2c->adap.dev, "setting to bus master\n");
> +		dev_dbg(i2c->adap.class_dev.dev, "setting to bus master\n");
>  
>  	if ((ISR & (ISR_UB | ISR_IBB)) != 0) {
> -		dev_dbg(&i2c->adap.dev, "%s: unit is busy\n", __func__);
> +		dev_dbg(i2c->adap.class_dev.dev, "%s: unit is busy\n", __func__);
>  		if (!i2c_pxa_wait_master(i2c)) {
> -			dev_dbg(&i2c->adap.dev, "%s: error: unit busy\n", __func__);
> +			dev_dbg(i2c->adap.class_dev.dev, "%s: error: unit busy\n", __func__);
>  			return I2C_RETRY;
>  		}
>  	}
> @@ -269,14 +269,14 @@ static int i2c_pxa_wait_slave(struct pxa
>  
>  	while (time_before(jiffies, timeout)) {
>  		if (i2c_debug > 1)
> -			dev_dbg(&i2c->adap.dev, "%s: %ld: ISR=%08x, ICR=%08x, IBMR=%02x\n",
> +			dev_dbg(i2c->adap.class_dev.dev, "%s: %ld: ISR=%08x, ICR=%08x, IBMR=%02x\n",
>  				__func__, (long)jiffies, ISR, ICR, IBMR);
>  
>  		if ((ISR & (ISR_UB|ISR_IBB)) == 0 ||
>  		    (ISR & ISR_SAD) != 0 ||
>  		    (ICR & ICR_SCLE) == 0) {
>  			if (i2c_debug > 1)
> -				dev_dbg(&i2c->adap.dev, "%s: done\n", __func__);
> +				dev_dbg(i2c->adap.class_dev.dev, "%s: done\n", __func__);
>  			return 1;
>  		}
>  
> @@ -284,7 +284,7 @@ static int i2c_pxa_wait_slave(struct pxa
>  	}
>  
>  	if (i2c_debug > 0)
> -		dev_dbg(&i2c->adap.dev, "%s: did not free\n", __func__);
> +		dev_dbg(i2c->adap.class_dev.dev, "%s: did not free\n", __func__);
>  	return 0;
>  }
>  
> @@ -308,7 +308,7 @@ static void i2c_pxa_set_slave(struct pxa
>  		}
>  
>  		if (!i2c_pxa_wait_slave(i2c)) {
> -			dev_err(&i2c->adap.dev, "%s: wait timedout\n",
> +			dev_err(i2c->adap.class_dev.dev, "%s: wait timedout\n",
>  				__func__);
>  			return;
>  		}
> @@ -318,7 +318,7 @@ static void i2c_pxa_set_slave(struct pxa
>  	ICR &= ~ICR_SCLE;
>  
>  	if (i2c_debug) {
> -		dev_dbg(&i2c->adap.dev, "ICR now %08x, ISR %08x\n", ICR, ISR);
> +		dev_dbg(i2c->adap.class_dev.dev, "ICR now %08x, ISR %08x\n", ICR, ISR);
>  		decode_ICR(ICR);
>  	}
>  }
> @@ -344,7 +344,7 @@ static void i2c_pxa_reset(struct pxa_i2c
>  	ICR = I2C_ICR_INIT;
>  
>  #ifdef CONFIG_I2C_PXA_SLAVE
> -	dev_info(&i2c->adap.dev, "Enabling slave mode\n");
> +	dev_info(i2c->adap.class_dev.dev, "Enabling slave mode\n");
>  	ICR |= ICR_SADIE | ICR_ALDIE | ICR_SSDIE;
>  #endif
>  
> @@ -518,7 +518,7 @@ static void i2c_pxa_slave_start(struct p
>  	int timeout;
>  
>  	if (i2c_debug > 0)
> -		dev_dbg(&i2c->adap.dev, "SAD, mode is slave-%cx\n",
> +		dev_dbg(i2c->adap.class_dev.dev, "SAD, mode is slave-%cx\n",
>  		       (isr & ISR_RWM) ? 'r' : 't');
>  
>  	if (i2c->slave != NULL)
> @@ -542,7 +542,7 @@ static void i2c_pxa_slave_start(struct p
>  		timeout--;
>  
>  		if (timeout <= 0) {
> -			dev_err(&i2c->adap.dev, "timeout waiting for SCL high\n");
> +			dev_err(i2c->adap.class_dev.dev, "timeout waiting for SCL high\n");
>  			break;
>  		}
>  	}
> @@ -553,13 +553,13 @@ static void i2c_pxa_slave_start(struct p
>  static void i2c_pxa_slave_stop(struct pxa_i2c *i2c)
>  {
>  	if (i2c_debug > 2)
> -		dev_dbg(&i2c->adap.dev, "ISR: SSD (Slave Stop)\n");
> +		dev_dbg(i2c->adap.class_dev.dev, "ISR: SSD (Slave Stop)\n");
>  
>  	if (i2c->slave != NULL)
>  		i2c->slave->event(i2c->slave->data, I2C_SLAVE_EVENT_STOP);
>  
>  	if (i2c_debug > 2)
> -		dev_dbg(&i2c->adap.dev, "ISR: SSD (Slave Stop) acked\n");
> +		dev_dbg(i2c->adap.class_dev.dev, "ISR: SSD (Slave Stop) acked\n");
>  
>  	/*
>  	 * If we have a master-mode message waiting,
> @@ -605,7 +605,7 @@ static void i2c_pxa_slave_start(struct p
>  		timeout--;
>  
>  		if (timeout <= 0) {
> -			dev_err(&i2c->adap.dev, "timeout waiting for SCL high\n");
> +			dev_err(i2c->adap.class_dev.dev, "timeout waiting for SCL high\n");
>  			break;
>  		}
>  	}
> @@ -663,7 +663,7 @@ static int i2c_pxa_do_xfer(struct pxa_i2
>  	 */
>  	ret = i2c_pxa_wait_bus_not_busy(i2c);
>  	if (ret) {
> -		dev_err(&i2c->adap.dev, "i2c_pxa: timeout waiting for bus free\n");
> +		dev_err(i2c->adap.class_dev.dev, "i2c_pxa: timeout waiting for bus free\n");
>  		goto out;
>  	}
>  
> @@ -672,7 +672,7 @@ static int i2c_pxa_do_xfer(struct pxa_i2
>  	 */
>  	ret = i2c_pxa_set_master(i2c);
>  	if (ret) {
> -		dev_err(&i2c->adap.dev, "i2c_pxa_set_master: error %d\n", ret);
> +		dev_err(i2c->adap.class_dev.dev, "i2c_pxa_set_master: error %d\n", ret);
>  		goto out;
>  	}
>  
> @@ -860,7 +860,7 @@ static irqreturn_t i2c_pxa_handler(int t
>  	u32 isr = ISR;
>  
>  	if (i2c_debug > 2 && 0) {
> -		dev_dbg(&i2c->adap.dev, "%s: ISR=%08x, ICR=%08x, IBMR=%02x\n",
> +		dev_dbg(i2c->adap.class_dev.dev, "%s: ISR=%08x, ICR=%08x, IBMR=%02x\n",
>  			__func__, isr, ICR, IBMR);
>  		decode_ISR(isr);
>  	}
> @@ -915,7 +915,7 @@ static int i2c_pxa_xfer(struct i2c_adapt
>  			goto out;
>  
>  		if (i2c_debug)
> -			dev_dbg(&adap->dev, "Retrying transmission\n");
> +			dev_dbg(adap->class_dev.dev, "Retrying transmission\n");
>  		udelay(100);
>  	}
>  	i2c_pxa_scream_blue_murder(i2c, "exhausted retries");
> @@ -980,7 +980,7 @@ static int i2c_pxa_probe(struct platform
>  	i2c_pxa_reset(i2c);
>  
>  	i2c->adap.algo_data = i2c;
> -	i2c->adap.dev.parent = &dev->dev;
> +	i2c->adap.class_dev.dev = &dev->dev;
>  
>  	ret = i2c_add_adapter(&i2c->adap);
>  	if (ret < 0) {
> @@ -992,10 +992,10 @@ static int i2c_pxa_probe(struct platform
>  
>  #ifdef CONFIG_I2C_PXA_SLAVE
>  	printk(KERN_INFO "I2C: %s: PXA I2C adapter, slave address %d\n",
> -	       i2c->adap.dev.bus_id, i2c->slave_addr);
> +	       i2c->adap.class_dev.class_id, i2c->slave_addr);
>  #else
>  	printk(KERN_INFO "I2C: %s: PXA I2C adapter\n",
> -	       i2c->adap.dev.bus_id);
> +	       i2c->adap.class_dev.class_id);
>  #endif
>  	return 0;
>  
> Index: g26/drivers/i2c/busses/i2c-voodoo3.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-voodoo3.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-voodoo3.c	2006-11-25 14:12:32.000000000 -0800
> @@ -202,9 +202,9 @@ static int __devinit voodoo3_probe(struc
>  	if (retval)
>  		return retval;
>  
> -	/* set up the sysfs linkage to our parent device */
> -	voodoo3_i2c_adapter.dev.parent = &dev->dev;
> -	voodoo3_ddc_adapter.dev.parent = &dev->dev;
> +	/* set up the driver model linkage to our parent device */
> +	voodoo3_i2c_adapter.class_dev.dev = &dev->dev;
> +	voodoo3_ddc_adapter.class_dev.dev = &dev->dev;
>  
>  	retval = i2c_bit_add_bus(&voodoo3_i2c_adapter);
>  	if (retval)
> Index: g26/drivers/i2c/busses/i2c-ixp4xx.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-ixp4xx.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-ixp4xx.c	2006-11-25 14:12:32.000000000 -0800
> @@ -130,7 +130,7 @@ static int ixp4xx_i2c_probe(struct platf
>  		I2C_NAME_SIZE);
>  	drv_data->adapter.algo_data = &drv_data->algo_data;
>  
> -	drv_data->adapter.dev.parent = &plat_dev->dev;
> +	drv_data->adapter.class_dev.dev = &plat_dev->dev;
>  
>  	gpio_line_config(gpio->scl_pin, IXP4XX_GPIO_IN);
>  	gpio_line_config(gpio->sda_pin, IXP4XX_GPIO_IN);
> Index: g26/drivers/i2c/busses/i2c-mpc.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-mpc.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-mpc.c	2006-11-25 14:12:32.000000000 -0800
> @@ -329,7 +329,7 @@ static int fsl_i2c_probe(struct platform
>  
>  	i2c->adap = mpc_ops;
>  	i2c_set_adapdata(&i2c->adap, i2c);
> -	i2c->adap.dev.parent = &pdev->dev;
> +	i2c->adap.class_dev.dev = &pdev->dev;
>  	if ((result = i2c_add_adapter(&i2c->adap)) < 0) {
>  		printk(KERN_ERR "i2c-mpc - failed to add adapter\n");
>  		goto fail_add;
> Index: g26/drivers/i2c/busses/i2c-omap.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-omap.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-omap.c	2006-11-25 14:45:16.000000000 -0800
> @@ -602,7 +602,7 @@ omap_i2c_probe(struct platform_device *p
>  	adap->class = I2C_CLASS_HWMON;
>  	strncpy(adap->name, "OMAP I2C adapter", sizeof(adap->name));
>  	adap->algo = &omap_i2c_algo;
> -	adap->dev.parent = &pdev->dev;
> +	adap->class_dev.dev = &pdev->dev;
>  
>  	/* i2c device drivers may be active on return from add_adapter() */
>  	r = i2c_add_adapter(adap);
> Index: g26/drivers/i2c/busses/i2c-sis5595.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-sis5595.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-sis5595.c	2006-11-25 14:12:32.000000000 -0800
> @@ -230,14 +230,14 @@ static int sis5595_transaction(struct i2
>  	/* Make sure the SMBus host is ready to start transmitting */
>  	temp = sis5595_read(SMB_STS_LO) + (sis5595_read(SMB_STS_HI) << 8);
>  	if (temp != 0x00) {
> -		dev_dbg(&adap->dev, "SMBus busy (%04x). Resetting...\n", temp);
> +		dev_dbg(adap->class_dev.dev, "SMBus busy (%04x). Resetting...\n", temp);
>  		sis5595_write(SMB_STS_LO, temp & 0xff);
>  		sis5595_write(SMB_STS_HI, temp >> 8);
>  		if ((temp = sis5595_read(SMB_STS_LO) + (sis5595_read(SMB_STS_HI) << 8)) != 0x00) {
> -			dev_dbg(&adap->dev, "Failed! (%02x)\n", temp);
> +			dev_dbg(adap->class_dev.dev, "Failed! (%02x)\n", temp);
>  			return -1;
>  		} else {
> -			dev_dbg(&adap->dev, "Successfull!\n");
> +			dev_dbg(adap->class_dev.dev, "Successfull!\n");
>  		}
>  	}
>  
> @@ -252,17 +252,17 @@ static int sis5595_transaction(struct i2
>  
>  	/* If the SMBus is still busy, we give up */
>  	if (timeout >= MAX_TIMEOUT) {
> -		dev_dbg(&adap->dev, "SMBus Timeout!\n");
> +		dev_dbg(adap->class_dev.dev, "SMBus Timeout!\n");
>  		result = -1;
>  	}
>  
>  	if (temp & 0x10) {
> -		dev_dbg(&adap->dev, "Error: Failed bus transaction\n");
> +		dev_dbg(adap->class_dev.dev, "Error: Failed bus transaction\n");
>  		result = -1;
>  	}
>  
>  	if (temp & 0x20) {
> -		dev_err(&adap->dev, "Bus collision! SMBus may be locked until "
> +		dev_err(adap->class_dev.dev, "Bus collision! SMBus may be locked until "
>  			"next hard reset (or not...)\n");
>  		/* Clock stops and slave is stuck in mid-transmission */
>  		result = -1;
> @@ -276,7 +276,7 @@ static int sis5595_transaction(struct i2
>  
>  	temp = sis5595_read(SMB_STS_LO) + (sis5595_read(SMB_STS_HI) << 8);
>  	if (temp != 0x00)
> -		dev_dbg(&adap->dev, "Failed reset at end of transaction (%02x)\n", temp);
> +		dev_dbg(adap->class_dev.dev, "Failed reset at end of transaction (%02x)\n", temp);
>  
>  	return result;
>  }
> @@ -383,8 +383,8 @@ static int __devinit sis5595_probe(struc
>  		return -ENODEV;
>  	}
>  
> -	/* set up the driverfs linkage to our parent device */
> -	sis5595_adapter.dev.parent = &dev->dev;
> +	/* set up the driver model linkage to our parent device */
> +	sis5595_adapter.class_dev.dev = &dev->dev;
>  
>  	sprintf(sis5595_adapter.name, "SMBus SIS5595 adapter at %04x",
>  		sis5595_base + SMB_INDEX);
> Index: g26/drivers/i2c/busses/i2c-ixp2000.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-ixp2000.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-ixp2000.c	2006-11-25 14:12:32.000000000 -0800
> @@ -121,7 +121,7 @@ static int ixp2000_i2c_probe(struct plat
>  		I2C_NAME_SIZE);
>  	drv_data->adapter.algo_data = &drv_data->algo_data,
>  
> -	drv_data->adapter.dev.parent = &plat_dev->dev;
> +	drv_data->adapter.class_dev.dev = &plat_dev->dev;
>  
>  	gpio_line_config(gpio->sda_pin, GPIO_IN);
>  	gpio_line_config(gpio->scl_pin, GPIO_IN);
> Index: g26/drivers/i2c/busses/i2c-s3c2410.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-s3c2410.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-s3c2410.c	2006-11-25 14:12:32.000000000 -0800
> @@ -694,7 +694,7 @@ static int s3c24xx_i2c_init(struct s3c24
>  
>  	/* get the plafrom data */
>  
> -	pdata = s3c24xx_i2c_get_platformdata(i2c->adap.dev.parent);
> +	pdata = s3c24xx_i2c_get_platformdata(i2c->adap.class_dev.dev);
>  
>  	/* inititalise the gpio */
>  
> @@ -808,7 +808,7 @@ static int s3c24xx_i2c_probe(struct plat
>  	/* setup info block for the i2c core */
>  
>  	i2c->adap.algo_data = i2c;
> -	i2c->adap.dev.parent = &pdev->dev;
> +	i2c->adap.class_dev.dev = &pdev->dev;
>  
>  	/* initialise the i2c controller */
>  
> @@ -836,8 +836,8 @@ static int s3c24xx_i2c_probe(struct plat
>  	}
>  
>  	i2c->irq = res;
> -		
> -	dev_dbg(&pdev->dev, "irq resource %p (%ld)\n", res, res->start);
> +
> +	dev_dbg(&pdev->dev, "irq resource %p (%Zd)\n", res, res->start);

Unrelated change (not even sure why it is needed).

>  
>  	ret = i2c_add_adapter(&i2c->adap);
>  	if (ret < 0) {
> @@ -847,7 +847,7 @@ static int s3c24xx_i2c_probe(struct plat
>  
>  	platform_set_drvdata(pdev, i2c);
>  
> -	dev_info(&pdev->dev, "%s: S3C I2C adapter\n", i2c->adap.dev.bus_id);
> +	dev_info(&pdev->dev, "%s: S3C I2C adapter\n", i2c->adap.class_dev.class_id);
>  
>   out:
>  	if (ret < 0)
> Index: g26/drivers/i2c/busses/i2c-savage4.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-savage4.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-savage4.c	2006-11-25 14:12:32.000000000 -0800
> @@ -165,8 +165,8 @@ static int __devinit savage4_probe(struc
>  	if (retval)
>  		return retval;
>  
> -	/* set up the sysfs linkage to our parent device */
> -	savage4_i2c_adapter.dev.parent = &dev->dev;
> +	/* set up the driver model linkage to our parent device */
> +	savage4_i2c_adapter.class_dev.dev = &dev->dev;
>  
>  	return i2c_bit_add_bus(&savage4_i2c_adapter);
>  }
> Index: g26/drivers/i2c/busses/i2c-hydra.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-hydra.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-hydra.c	2006-11-25 14:12:32.000000000 -0800
> @@ -133,7 +133,7 @@ static int __devinit hydra_probe(struct 
>  	}
>  
>  	pdregw(hydra_bit_data.data, 0);		/* clear SCLK_OE and SDAT_OE */
> -	hydra_adap.dev.parent = &dev->dev;
> +	hydra_adap.class_dev.dev = &dev->dev;
>  	res = i2c_bit_add_bus(&hydra_adap);
>  	if (res < 0) {
>  		iounmap(hydra_bit_data.data);
> Index: g26/drivers/i2c/busses/i2c-piix4.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-piix4.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-piix4.c	2006-11-25 14:12:32.000000000 -0800
> @@ -213,21 +213,21 @@ static int piix4_transaction(void)
>  	int result = 0;
>  	int timeout = 0;
>  
> -	dev_dbg(&piix4_adapter.dev, "Transaction (pre): CNT=%02x, CMD=%02x, "
> +	dev_dbg(piix4_adapter.class_dev.dev, "Transaction (pre): CNT=%02x, CMD=%02x, "
>  		"ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT),
>  		inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0),
>  		inb_p(SMBHSTDAT1));
>  
>  	/* Make sure the SMBus host is ready to start transmitting */
>  	if ((temp = inb_p(SMBHSTSTS)) != 0x00) {
> -		dev_dbg(&piix4_adapter.dev, "SMBus busy (%02x). "
> +		dev_dbg(piix4_adapter.class_dev.dev, "SMBus busy (%02x). "
>  			"Resetting...\n", temp);
>  		outb_p(temp, SMBHSTSTS);
>  		if ((temp = inb_p(SMBHSTSTS)) != 0x00) {
> -			dev_err(&piix4_adapter.dev, "Failed! (%02x)\n", temp);
> +			dev_err(piix4_adapter.class_dev.dev, "Failed! (%02x)\n", temp);
>  			return -1;
>  		} else {
> -			dev_dbg(&piix4_adapter.dev, "Successfull!\n");
> +			dev_dbg(piix4_adapter.class_dev.dev, "Successfull!\n");
>  		}
>  	}
>  
> @@ -242,35 +242,35 @@ static int piix4_transaction(void)
>  
>  	/* If the SMBus is still busy, we give up */
>  	if (timeout >= MAX_TIMEOUT) {
> -		dev_err(&piix4_adapter.dev, "SMBus Timeout!\n");
> +		dev_err(piix4_adapter.class_dev.dev, "SMBus Timeout!\n");
>  		result = -1;
>  	}
>  
>  	if (temp & 0x10) {
>  		result = -1;
> -		dev_err(&piix4_adapter.dev, "Error: Failed bus transaction\n");
> +		dev_err(piix4_adapter.class_dev.dev, "Error: Failed bus transaction\n");
>  	}
>  
>  	if (temp & 0x08) {
>  		result = -1;
> -		dev_dbg(&piix4_adapter.dev, "Bus collision! SMBus may be "
> +		dev_dbg(piix4_adapter.class_dev.dev, "Bus collision! SMBus may be "
>  			"locked until next hard reset. (sorry!)\n");
>  		/* Clock stops and slave is stuck in mid-transmission */
>  	}
>  
>  	if (temp & 0x04) {
>  		result = -1;
> -		dev_dbg(&piix4_adapter.dev, "Error: no response!\n");
> +		dev_dbg(piix4_adapter.class_dev.dev, "Error: no response!\n");
>  	}
>  
>  	if (inb_p(SMBHSTSTS) != 0x00)
>  		outb_p(inb(SMBHSTSTS), SMBHSTSTS);
>  
>  	if ((temp = inb_p(SMBHSTSTS)) != 0x00) {
> -		dev_err(&piix4_adapter.dev, "Failed reset at end of "
> +		dev_err(piix4_adapter.class_dev.dev, "Failed reset at end of "
>  			"transaction (%02x)\n", temp);
>  	}
> -	dev_dbg(&piix4_adapter.dev, "Transaction (post): CNT=%02x, CMD=%02x, "
> +	dev_dbg(piix4_adapter.class_dev.dev, "Transaction (post): CNT=%02x, CMD=%02x, "
>  		"ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT),
>  		inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0),
>  		inb_p(SMBHSTDAT1));
> @@ -286,7 +286,7 @@ static s32 piix4_access(struct i2c_adapt
>  
>  	switch (size) {
>  	case I2C_SMBUS_PROC_CALL:
> -		dev_err(&adap->dev, "I2C_SMBUS_PROC_CALL not supported!\n");
> +		dev_err(adap->class_dev.dev, "I2C_SMBUS_PROC_CALL not supported!\n");
>  		return -1;
>  	case I2C_SMBUS_QUICK:
>  		outb_p(((addr & 0x7f) << 1) | (read_write & 0x01),
> @@ -422,8 +422,8 @@ static int __devinit piix4_probe(struct 
>  	if (retval)
>  		return retval;
>  
> -	/* set up the driverfs linkage to our parent device */
> -	piix4_adapter.dev.parent = &dev->dev;
> +	/* set up the driver model linkage to our parent device */
> +	piix4_adapter.class_dev.dev = &dev->dev;
>  
>  	snprintf(piix4_adapter.name, I2C_NAME_SIZE,
>  		"SMBus PIIX4 adapter at %04x", piix4_smba);
> Index: g26/drivers/i2c/busses/i2c-sis96x.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-sis96x.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-sis96x.c	2006-11-25 14:12:32.000000000 -0800
> @@ -98,12 +98,12 @@ static int sis96x_transaction(int size)
>  	int result = 0;
>  	int timeout = 0;
>  
> -	dev_dbg(&sis96x_adapter.dev, "SMBus transaction %d\n", size);
> +	dev_dbg(sis96x_adapter.class_dev.dev, "SMBus transaction %d\n", size);
>  
>  	/* Make sure the SMBus host is ready to start transmitting */
>  	if (((temp = sis96x_read(SMB_CNT)) & 0x03) != 0x00) {
>  
> -		dev_dbg(&sis96x_adapter.dev, "SMBus busy (0x%02x). "
> +		dev_dbg(sis96x_adapter.class_dev.dev, "SMBus busy (0x%02x). "
>  			"Resetting...\n", temp);
>  
>  		/* kill the transaction */
> @@ -111,10 +111,10 @@ static int sis96x_transaction(int size)
>  
>  		/* check it again */
>  		if (((temp = sis96x_read(SMB_CNT)) & 0x03) != 0x00) {
> -			dev_dbg(&sis96x_adapter.dev, "Failed (0x%02x)\n", temp);
> +			dev_dbg(sis96x_adapter.class_dev.dev, "Failed (0x%02x)\n", temp);
>  			return -1;
>  		} else {
> -			dev_dbg(&sis96x_adapter.dev, "Successful\n");
> +			dev_dbg(sis96x_adapter.class_dev.dev, "Successful\n");
>  		}
>  	}
>  
> @@ -136,26 +136,26 @@ static int sis96x_transaction(int size)
>  
>  	/* If the SMBus is still busy, we give up */
>  	if (timeout >= MAX_TIMEOUT) {
> -		dev_dbg(&sis96x_adapter.dev, "SMBus Timeout! (0x%02x)\n", temp);
> +		dev_dbg(sis96x_adapter.class_dev.dev, "SMBus Timeout! (0x%02x)\n", temp);
>  		result = -1;
>  	}
>  
>  	/* device error - probably missing ACK */
>  	if (temp & 0x02) {
> -		dev_dbg(&sis96x_adapter.dev, "Failed bus transaction!\n");
> +		dev_dbg(sis96x_adapter.class_dev.dev, "Failed bus transaction!\n");
>  		result = -1;
>  	}
>  
>  	/* bus collision */
>  	if (temp & 0x04) {
> -		dev_dbg(&sis96x_adapter.dev, "Bus collision!\n");
> +		dev_dbg(sis96x_adapter.class_dev.dev, "Bus collision!\n");
>  		result = -1;
>  	}
>  
>  	/* Finish up by resetting the bus */
>  	sis96x_write(SMB_STS, temp);
>  	if ((temp = sis96x_read(SMB_STS))) {
> -		dev_dbg(&sis96x_adapter.dev, "Failed reset at "
> +		dev_dbg(sis96x_adapter.class_dev.dev, "Failed reset at "
>  			"end of transaction! (0x%02x)\n", temp);
>  	}
>  
> @@ -203,12 +203,12 @@ static s32 sis96x_access(struct i2c_adap
>  
>  	case I2C_SMBUS_BLOCK_DATA:
>  		/* TO DO: */
> -		dev_info(&adap->dev, "SMBus block not implemented!\n");
> +		dev_info(adap->class_dev.dev, "SMBus block not implemented!\n");
>  		return -1;
>  		break;
>  
>  	default:
> -		dev_info(&adap->dev, "Unsupported I2C size\n");
> +		dev_info(adap->class_dev.dev, "Unsupported I2C size\n");
>  		return -1;
>  		break;
>  	}
> @@ -297,8 +297,8 @@ static int __devinit sis96x_probe(struct
>  		return -EINVAL;
>  	}
>  
> -	/* set up the driverfs linkage to our parent device */
> -	sis96x_adapter.dev.parent = &dev->dev;
> +	/* set up the driver model linkage to our parent device */
> +	sis96x_adapter.class_dev.dev = &dev->dev;
>  
>  	snprintf(sis96x_adapter.name, I2C_NAME_SIZE,
>  		"SiS96x SMBus adapter at 0x%04x", sis96x_smbus_base);
> Index: g26/drivers/i2c/busses/i2c-ali15x3.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-ali15x3.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-ali15x3.c	2006-11-25 14:12:32.000000000 -0800
> @@ -233,7 +233,7 @@ static int ali15x3_transaction(struct i2
>  	int result = 0;
>  	int timeout = 0;
>  
> -	dev_dbg(&adap->dev, "Transaction (pre): STS=%02x, CNT=%02x, CMD=%02x, "
> +	dev_dbg(adap->class_dev.dev, "Transaction (pre): STS=%02x, CNT=%02x, CMD=%02x, "
>  		"ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTSTS),
>  		inb_p(SMBHSTCNT), inb_p(SMBHSTCMD), inb_p(SMBHSTADD),
>  		inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1));
> @@ -265,7 +265,7 @@ static int ali15x3_transaction(struct i2
>  	   then the BUSY bit may come back on when you try and use the chip again.
>  	   If that's the case you are stuck.
>  	*/
> -		dev_info(&adap->dev, "Resetting entire SMB Bus to "
> +		dev_info(adap->class_dev.dev, "Resetting entire SMB Bus to "
>  			"clear busy condition (%02x)\n", temp);
>  		outb_p(ALI15X3_T_OUT, SMBHSTCNT);
>  		temp = inb_p(SMBHSTSTS);
> @@ -280,7 +280,7 @@ static int ali15x3_transaction(struct i2
>  			/* this is probably going to be correctable only by a power reset
>  			   as one of the bits now appears to be stuck */
>  			/* This may be a bus or device with electrical problems. */
> -			dev_err(&adap->dev, "SMBus reset failed! (0x%02x) - "
> +			dev_err(adap->class_dev.dev, "SMBus reset failed! (0x%02x) - "
>  				"controller or device on bus is probably hung\n",
>  				temp);
>  			return -1;
> @@ -306,12 +306,12 @@ static int ali15x3_transaction(struct i2
>  	/* If the SMBus is still busy, we give up */
>  	if (timeout >= MAX_TIMEOUT) {
>  		result = -1;
> -		dev_err(&adap->dev, "SMBus Timeout!\n");
> +		dev_err(adap->class_dev.dev, "SMBus Timeout!\n");
>  	}
>  
>  	if (temp & ALI15X3_STS_TERM) {
>  		result = -1;
> -		dev_dbg(&adap->dev, "Error: Failed bus transaction\n");
> +		dev_dbg(adap->class_dev.dev, "Error: Failed bus transaction\n");
>  	}
>  
>  	/*
> @@ -322,7 +322,7 @@ static int ali15x3_transaction(struct i2
>  	*/
>  	if (temp & ALI15X3_STS_COLL) {
>  		result = -1;
> -		dev_dbg(&adap->dev,
> +		dev_dbg(adap->class_dev.dev,
>  			"Error: no response or bus collision ADD=%02x\n",
>  			inb_p(SMBHSTADD));
>  	}
> @@ -330,9 +330,9 @@ static int ali15x3_transaction(struct i2
>  	/* haven't ever seen this */
>  	if (temp & ALI15X3_STS_DEV) {
>  		result = -1;
> -		dev_err(&adap->dev, "Error: device error\n");
> +		dev_err(adap->class_dev.dev, "Error: device error\n");
>  	}
> -	dev_dbg(&adap->dev, "Transaction (post): STS=%02x, CNT=%02x, CMD=%02x, "
> +	dev_dbg(adap->class_dev.dev, "Transaction (post): STS=%02x, CNT=%02x, CMD=%02x, "
>  		"ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTSTS),
>  		inb_p(SMBHSTCNT), inb_p(SMBHSTCMD), inb_p(SMBHSTADD),
>  		inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1));
> @@ -359,12 +359,12 @@ static s32 ali15x3_access(struct i2c_ada
>  		temp = inb_p(SMBHSTSTS);
>  	}
>  	if (timeout >= MAX_TIMEOUT) {
> -		dev_err(&adap->dev, "Idle wait Timeout! STS=0x%02x\n", temp);
> +		dev_err(adap->class_dev.dev, "Idle wait Timeout! STS=0x%02x\n", temp);
>  	}
>  
>  	switch (size) {
>  	case I2C_SMBUS_PROC_CALL:
> -		dev_err(&adap->dev, "I2C_SMBUS_PROC_CALL not supported!\n");
> +		dev_err(adap->class_dev.dev, "I2C_SMBUS_PROC_CALL not supported!\n");
>  		return -1;
>  	case I2C_SMBUS_QUICK:
>  		outb_p(((addr & 0x7f) << 1) | (read_write & 0x01),
> @@ -448,7 +448,7 @@ static s32 ali15x3_access(struct i2c_ada
>  		outb_p(inb_p(SMBHSTCNT) | ALI15X3_BLOCK_CLR, SMBHSTCNT);
>  		for (i = 1; i <= data->block[0]; i++) {
>  			data->block[i] = inb_p(SMBBLKDAT);
> -			dev_dbg(&adap->dev, "Blk: len=%d, i=%d, data=%02x\n",
> +			dev_dbg(adap->class_dev.dev, "Blk: len=%d, i=%d, data=%02x\n",
>  				len, i, data->block[i]);
>  		}
>  		break;
> @@ -489,8 +489,8 @@ static int __devinit ali15x3_probe(struc
>  		return -ENODEV;
>  	}
>  
> -	/* set up the driverfs linkage to our parent device */
> -	ali15x3_adapter.dev.parent = &dev->dev;
> +	/* set up the driver model linkage to our parent device */
> +	ali15x3_adapter.class_dev.dev = &dev->dev;
>  
>  	snprintf(ali15x3_adapter.name, I2C_NAME_SIZE,
>  		"SMBus ALI15X3 adapter at %04x", ali15x3_smba);
> Index: g26/drivers/i2c/busses/i2c-ali1535.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-ali1535.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-ali1535.c	2006-11-25 14:12:32.000000000 -0800
> @@ -210,7 +210,7 @@ static int ali1535_transaction(struct i2
>  	int result = 0;
>  	int timeout = 0;
>  
> -	dev_dbg(&adap->dev, "Transaction (pre): STS=%02x, TYP=%02x, "
> +	dev_dbg(adap->class_dev.dev, "Transaction (pre): STS=%02x, TYP=%02x, "
>  		"CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
>  		inb_p(SMBHSTSTS), inb_p(SMBHSTTYP), inb_p(SMBHSTCMD),
>  		inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1));
> @@ -240,7 +240,7 @@ static int ali1535_transaction(struct i2
>  		 * BUSY bit may come back on when you try and use the chip
>  		 * again.  If that's the case you are stuck.
>  		 */
> -		dev_info(&adap->dev,
> +		dev_info(adap->class_dev.dev,
>  			"Resetting entire SMB Bus to clear busy condition (%02x)\n",
>  			temp);
>  		outb_p(ALI1535_T_OUT, SMBHSTTYP);
> @@ -257,7 +257,7 @@ static int ali1535_transaction(struct i2
>  			 * power reset as one of the bits now appears to be
>  			 * stuck */
>  			/* This may be a bus or device with electrical problems. */
> -			dev_err(&adap->dev,
> +			dev_err(adap->class_dev.dev,
>  				"SMBus reset failed! (0x%02x) - controller or "
>  				"device on bus is probably hung\n", temp);
>  			return -1;
> @@ -283,12 +283,12 @@ static int ali1535_transaction(struct i2
>  	/* If the SMBus is still busy, we give up */
>  	if (timeout >= MAX_TIMEOUT) {
>  		result = -1;
> -		dev_err(&adap->dev, "SMBus Timeout!\n");
> +		dev_err(adap->class_dev.dev, "SMBus Timeout!\n");
>  	}
>  
>  	if (temp & ALI1535_STS_FAIL) {
>  		result = -1;
> -		dev_dbg(&adap->dev, "Error: Failed bus transaction\n");
> +		dev_dbg(adap->class_dev.dev, "Error: Failed bus transaction\n");
>  	}
>  
>  	/* Unfortunately the ALI SMB controller maps "no response" and "bus
> @@ -297,7 +297,7 @@ static int ali1535_transaction(struct i2
>  	 */
>  	if (temp & ALI1535_STS_BUSERR) {
>  		result = -1;
> -		dev_dbg(&adap->dev,
> +		dev_dbg(adap->class_dev.dev,
>  			"Error: no response or bus collision ADD=%02x\n",
>  			inb_p(SMBHSTADD));
>  	}
> @@ -305,16 +305,16 @@ static int ali1535_transaction(struct i2
>  	/* haven't ever seen this */
>  	if (temp & ALI1535_STS_DEV) {
>  		result = -1;
> -		dev_err(&adap->dev, "Error: device error\n");
> +		dev_err(adap->class_dev.dev, "Error: device error\n");
>  	}
>  
>  	/* check to see if the "command complete" indication is set */
>  	if (!(temp & ALI1535_STS_DONE)) {
>  		result = -1;
> -		dev_err(&adap->dev, "Error: command never completed\n");
> +		dev_err(adap->class_dev.dev, "Error: command never completed\n");
>  	}
>  
> -	dev_dbg(&adap->dev, "Transaction (post): STS=%02x, TYP=%02x, "
> +	dev_dbg(adap->class_dev.dev, "Transaction (post): STS=%02x, TYP=%02x, "
>  		"CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
>  		inb_p(SMBHSTSTS), inb_p(SMBHSTTYP), inb_p(SMBHSTCMD),
>  		inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1));
> @@ -352,14 +352,14 @@ static s32 ali1535_access(struct i2c_ada
>  		temp = inb_p(SMBHSTSTS);
>  	}
>  	if (timeout >= MAX_TIMEOUT)
> -		dev_warn(&adap->dev, "Idle wait Timeout! STS=0x%02x\n", temp);
> +		dev_warn(adap->class_dev.dev, "Idle wait Timeout! STS=0x%02x\n", temp);
>  
>  	/* clear status register (clear-on-write) */
>  	outb_p(0xFF, SMBHSTSTS);
>  
>  	switch (size) {
>  	case I2C_SMBUS_PROC_CALL:
> -		dev_err(&adap->dev, "I2C_SMBUS_PROC_CALL not supported!\n");
> +		dev_err(adap->class_dev.dev, "I2C_SMBUS_PROC_CALL not supported!\n");
>  		result = -1;
>  		goto EXIT;
>  	case I2C_SMBUS_QUICK:
> @@ -451,7 +451,7 @@ static s32 ali1535_access(struct i2c_ada
>  		outb_p(inb_p(SMBHSTTYP) | ALI1535_BLOCK_CLR, SMBHSTTYP);
>  		for (i = 1; i <= data->block[0]; i++) {
>  			data->block[i] = inb_p(SMBBLKDAT);
> -			dev_dbg(&adap->dev, "Blk: len=%d, i=%d, data=%02x\n",
> +			dev_dbg(adap->class_dev.dev, "Blk: len=%d, i=%d, data=%02x\n",
>  				len, i, data->block[i]);
>  		}
>  		break;
> @@ -494,8 +494,8 @@ static int __devinit ali1535_probe(struc
>  		return -ENODEV;
>  	}
>  
> -	/* set up the driverfs linkage to our parent device */
> -	ali1535_adapter.dev.parent = &dev->dev;
> +	/* set up the driver model linkage to our parent device */
> +	ali1535_adapter.class_dev.dev = &dev->dev;
>  
>  	snprintf(ali1535_adapter.name, I2C_NAME_SIZE, 
>  		"SMBus ALI1535 adapter at %04x", ali1535_smba);
> Index: g26/drivers/i2c/busses/i2c-amd756-s4882.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-amd756-s4882.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-amd756-s4882.c	2006-11-25 14:12:32.000000000 -0800
> @@ -161,7 +161,7 @@ static int __init amd756_s4882_init(void
>  		if (error == -EINVAL)
>  			error = -ENODEV;
>  		else
> -			dev_err(&amd756_smbus.dev, "Physical bus removal "
> +			dev_err(amd756_smbus.class_dev.dev, "Physical bus removal "
>  				"failed\n");
>  		goto ERROR0;
>  	}
> @@ -202,7 +202,7 @@ static int __init amd756_s4882_init(void
>  					      I2C_SMBUS_WRITE, 0x03,
>  					      I2C_SMBUS_BYTE_DATA, &ioconfig);
>  	if (error) {
> -		dev_err(&amd756_smbus.dev, "PCA9556 configuration failed\n");
> +		dev_err(amd756_smbus.class_dev.dev, "PCA9556 configuration failed\n");
>  		error = -EIO;
>  		goto ERROR3;
>  	}
> @@ -211,7 +211,7 @@ static int __init amd756_s4882_init(void
>  	for (i = 0; i < 5; i++) {
>  		error = i2c_add_adapter(s4882_adapter+i);
>  		if (error) {
> -			dev_err(&amd756_smbus.dev,
> +			dev_err(amd756_smbus.class_dev.dev,
>  			       "Virtual adapter %d registration "
>  			       "failed, module not inserted\n", i);
>  			for (i--; i >= 0; i--)
> @@ -249,7 +249,7 @@ static void __exit amd756_s4882_exit(voi
>  
>  	/* Restore physical bus */
>  	if (i2c_add_adapter(&amd756_smbus))
> -		dev_err(&amd756_smbus.dev, "Physical bus restoration "
> +		dev_err(amd756_smbus.class_dev.dev, "Physical bus restoration "
>  			"failed\n");
>  }
>  
> Index: g26/drivers/i2c/busses/i2c-stub.c
> ===================================================================
> --- g26.orig/drivers/i2c/busses/i2c-stub.c	2006-11-25 14:10:39.000000000 -0800
> +++ g26/drivers/i2c/busses/i2c-stub.c	2006-11-25 14:12:32.000000000 -0800
> @@ -47,19 +47,19 @@ static s32 stub_xfer(struct i2c_adapter 
>  	switch (size) {
>  
>  	case I2C_SMBUS_QUICK:
> -		dev_dbg(&adap->dev, "smbus quick - addr 0x%02x\n", addr);
> +		dev_dbg(adap->class_dev.dev, "smbus quick - addr 0x%02x\n", addr);
>  		ret = 0;
>  		break;
>  
>  	case I2C_SMBUS_BYTE:
>  		if (read_write == I2C_SMBUS_WRITE) {
>  			stub_pointer = command;
> -			dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, "
> +			dev_dbg(adap->class_dev.dev, "smbus byte - addr 0x%02x, "
>  					"wrote 0x%02x.\n",
>  					addr, command);
>  		} else {
>  			data->byte = stub_bytes[stub_pointer++];
> -			dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, "
> +			dev_dbg(adap->class_dev.dev, "smbus byte - addr 0x%02x, "
>  					"read  0x%02x.\n",
>  					addr, data->byte);
>  		}
> @@ -70,12 +70,12 @@ static s32 stub_xfer(struct i2c_adapter 
>  	case I2C_SMBUS_BYTE_DATA:
>  		if (read_write == I2C_SMBUS_WRITE) {
>  			stub_bytes[command] = data->byte;
> -			dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, "
> +			dev_dbg(adap->class_dev.dev, "smbus byte data - addr 0x%02x, "
>  					"wrote 0x%02x at 0x%02x.\n",
>  					addr, data->byte, command);
>  		} else {
>  			data->byte = stub_bytes[command];
> -			dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, "
> +			dev_dbg(adap->class_dev.dev, "smbus byte data - addr 0x%02x, "
>  					"read  0x%02x at 0x%02x.\n",
>  					addr, data->byte, command);
>  		}
> @@ -87,12 +87,12 @@ static s32 stub_xfer(struct i2c_adapter 
>  	case I2C_SMBUS_WORD_DATA:
>  		if (read_write == I2C_SMBUS_WRITE) {
>  			stub_words[command] = data->word;
> -			dev_dbg(&adap->dev, "smbus word data - addr 0x%02x, "
> +			dev_dbg(adap->class_dev.dev, "smbus word data - addr 0x%02x, "
>  					"wrote 0x%04x at 0x%02x.\n",
>  					addr, data->word, command);
>  		} else {
>  			data->word = stub_words[command];
> -			dev_dbg(&adap->dev, "smbus word data - addr 0x%02x, "
> +			dev_dbg(adap->class_dev.dev, "smbus word data - addr 0x%02x, "
>  					"read  0x%04x at 0x%02x.\n",
>  					addr, data->word, command);
>  		}
> @@ -101,7 +101,7 @@ static s32 stub_xfer(struct i2c_adapter 
>  		break;
>  
>  	default:
> -		dev_dbg(&adap->dev, "Unsupported I2C/SMBus command\n");
> +		dev_dbg(adap->class_dev.dev, "Unsupported I2C/SMBus command\n");
>  		ret = -1;
>  		break;
>  	} /* switch (size) */

There are 3 new i2c bus drivers in 2.6.20-rc1: i2c-versatile, i2c-pnx
and i2c-at91. The latter two would need to be added to this patch. The
three of them need to be added to the core patch (for the dev.parent
change.)

-- 
Jean Delvare



More information about the i2c mailing list