[i2c] [patch 2.6.20-rc1 5/6] remove i2c_adapter.dev usage from adapters

Jean Delvare khali at linux-fr.org
Wed Jan 3 14:59:12 CET 2007


Hi David,

On Mon, 1 Jan 2007 12:46:50 -0800, David Brownell wrote:
> Change I2C adapter driver init:  they stop using i2c_adapter.dev.parent,
> and provide i2c_adapter.class_dev.dev instead.
> 
> Along with previous patches, this means almost all uses of i2c_adapter.dev
> (outside i2c-core, which won't change quite yet) are gone.
> 
> Signed-off-by: David Brownell <dbrownell at users.sourceforge.net>
> ---
> Another revision, to address your request to have this patch switch over
> to requiring init using i2c_adapter.class_dev.dev not ...dev.parent; and
> of course to not actually remove i2c_adapter.dev itself.  "Patch #5A/6".
> 
>  i2c/busses/i2c-ali1535.c           |    4 ++--
>  i2c/busses/i2c-ali1563.c           |    2 +-
>  i2c/busses/i2c-ali15x3.c           |    4 ++--
>  i2c/busses/i2c-amd756.c            |    4 ++--
>  i2c/busses/i2c-amd8111.c           |    4 ++--
>  i2c/busses/i2c-at91.c              |    2 +-
>  i2c/busses/i2c-hydra.c             |    2 +-
>  i2c/busses/i2c-i801.c              |    4 ++--
>  i2c/busses/i2c-i810.c              |    6 +++---
>  i2c/busses/i2c-ibm_iic.c           |    1 +
>  i2c/busses/i2c-iop3xx.c            |    2 +-
>  i2c/busses/i2c-ixp2000.c           |    2 +-
>  i2c/busses/i2c-ixp4xx.c            |    2 +-
>  i2c/busses/i2c-mpc.c               |    2 +-
>  i2c/busses/i2c-mv64xxx.c           |    1 +
>  i2c/busses/i2c-nforce2.c           |    2 +-
>  i2c/busses/i2c-ocores.c            |    2 +-
>  i2c/busses/i2c-omap.c              |    2 +-
>  i2c/busses/i2c-piix4.c             |    4 ++--
>  i2c/busses/i2c-pnx.c               |    2 +-
>  i2c/busses/i2c-powermac.c          |    2 +-
>  i2c/busses/i2c-prosavage.c         |    2 +-
>  i2c/busses/i2c-pxa.c               |    2 +-
>  i2c/busses/i2c-s3c2410.c           |    2 +-
>  i2c/busses/i2c-savage4.c           |    4 ++--
>  i2c/busses/i2c-sis5595.c           |    4 ++--
>  i2c/busses/i2c-sis630.c            |    4 ++--
>  i2c/busses/i2c-sis96x.c            |    4 ++--
>  i2c/busses/i2c-versatile.c         |    2 +-
>  i2c/busses/i2c-via.c               |    4 ++--
>  i2c/busses/i2c-viapro.c            |    2 +-
>  i2c/busses/i2c-voodoo3.c           |    6 +++---
>  i2c/i2c-core.c                     |    6 ++----
>  media/common/saa7146_i2c.c         |    2 +-
>  media/dvb/pluto2/pluto2.c          |    2 +-
>  media/video/bt8xx/bttv-i2c.c       |    2 +-
>  media/video/cx88/cx88-i2c.c        |    2 +-
>  media/video/cx88/cx88-vp3054-i2c.c |    2 +-
>  media/video/em28xx/em28xx-i2c.c    |    2 +-
>  media/video/saa7134/saa7134-i2c.c  |    2 +-
>  video/aty/radeon_i2c.c             |    2 +-
>  video/i810/i810-i2c.c              |    2 +-
>  video/intelfb/intelfb_i2c.c        |    2 +-
>  video/nvidia/nv_i2c.c              |    2 +-
>  video/riva/rivafb-i2c.c            |    2 +-
>  video/savage/savagefb-i2c.c        |    2 +-
>  46 files changed, 62 insertions(+), 62 deletions(-)
> 
> Index: at91/drivers/i2c/i2c-core.c
> ===================================================================
> --- at91.orig/drivers/i2c/i2c-core.c	2006-12-31 01:09:01.000000000 -0800
> +++ at91/drivers/i2c/i2c-core.c	2006-12-31 04:16:19.000000000 -0800
> @@ -187,10 +187,8 @@ int i2c_add_adapter(struct i2c_adapter *
>  	list_add_tail(&adap->list,&adapters);
>  	INIT_LIST_HEAD(&adap->clients);
>  
> -	/* Add the adapter to the driver core.
> -	 * If the parent pointer is not set up,
> -	 * we add this adapter to the host bus.
> -	 */
> +	/* create pseudo-adapter device (OBSOLETE, WILL VANISH) */
> +	adap->dev.parent = adap->class_dev.dev;
>  	if (adap->dev.parent == NULL) {
>  		adap->dev.parent = &platform_bus;
>  		printk(KERN_WARNING "** WARNING:  I2C adapter driver [%s] "

Additionally I removed:

-	memset(&adap->class_dev, 0x00, sizeof(struct class_device));

later in this function. We will have to do that someday, and if any
driver provides a non-zeroed class_dev I'd like to know rather sooner
than later. And I did the same in i2c-isa, where the i2c_adapter
structure is a static global so it's zeroed already.

I've checked all the in-tree drivers which call i2c_add_adapter() and
they all seem to properly zero the class_dev structure, either because
the i2c_adapter structure is a static global, or by using kzalloc() to
allocate its memory. So I don't actually expect any problem there. I'm
just unsure what would happen in the former case for hot-replugged
devices, as the structure is only zeroed once.

> Index: at91/drivers/i2c/busses/i2c-prosavage.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-prosavage.c	2006-12-30 18:58:51.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-prosavage.c	2006-12-31 01:09:38.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;
> Index: at91/drivers/i2c/busses/i2c-i801.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-i801.c	2006-12-30 18:58:51.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-i801.c	2006-12-31 01:09:38.000000000 -0800
> @@ -522,8 +522,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: at91/drivers/i2c/busses/i2c-at91.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-at91.c	2006-12-31 01:09:09.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-at91.c	2006-12-31 01:09:38.000000000 -0800
> @@ -229,7 +229,7 @@ static int __devinit at91_i2c_probe(stru
>  	sprintf(adapter->name, "AT91");
>  	adapter->algo = &at91_algorithm;
>  	adapter->class = I2C_CLASS_HWMON;
> -	adapter->dev.parent = &pdev->dev;
> +	adapter->class_dev.dev = &pdev->dev;
>  
>  	platform_set_drvdata(pdev, adapter);
>  
> Index: at91/drivers/media/common/saa7146_i2c.c
> ===================================================================
> --- at91.orig/drivers/media/common/saa7146_i2c.c	2006-12-30 18:58:52.000000000 -0800
> +++ at91/drivers/media/common/saa7146_i2c.c	2006-12-31 01:09:38.000000000 -0800
> @@ -409,7 +409,7 @@ int saa7146_i2c_adapter_prepare(struct s
>  	if( NULL != i2c_adapter ) {
>  		BUG_ON(!i2c_adapter->class);
>  		i2c_set_adapdata(i2c_adapter,dev);
> -		i2c_adapter->dev.parent    = &dev->pci->dev;
> +		i2c_adapter->class_dev.dev = &dev->pci->dev;
>  		i2c_adapter->algo	   = &saa7146_algo;
>  		i2c_adapter->algo_data     = NULL;
>  		i2c_adapter->id		   = I2C_HW_SAA7146;
> Index: at91/drivers/i2c/busses/i2c-ibm_iic.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-ibm_iic.c	2006-12-30 18:58:51.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-ibm_iic.c	2006-12-31 01:09:38.000000000 -0800
> @@ -727,6 +727,7 @@ static int __devinit iic_probe(struct oc
>  	
>  	/* 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;

I moved this one to patch #5.5.

> Index: at91/drivers/video/aty/radeon_i2c.c
> ===================================================================
> --- at91.orig/drivers/video/aty/radeon_i2c.c	2006-12-30 18:58:52.000000000 -0800
> +++ at91/drivers/video/aty/radeon_i2c.c	2006-12-31 01:09:38.000000000 -0800
> @@ -74,7 +74,7 @@ static int radeon_setup_i2c_bus(struct r
>  	chan->adapter.owner		= THIS_MODULE;
>  	chan->adapter.id		= I2C_HW_B_RADEON;
>  	chan->adapter.algo_data		= &chan->algo;
> -	chan->adapter.dev.parent	= &chan->rinfo->pdev->dev;
> +	chan->adapter.class_dev.dev	= &chan->rinfo->pdev->dev;
>  	chan->algo.setsda		= radeon_gpio_setsda;
>  	chan->algo.setscl		= radeon_gpio_setscl;
>  	chan->algo.getsda		= radeon_gpio_getsda;
> Index: at91/drivers/i2c/busses/i2c-savage4.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-savage4.c	2006-12-30 18:58:51.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-savage4.c	2006-12-31 01:09:38.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: at91/drivers/i2c/busses/i2c-ixp2000.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-ixp2000.c	2006-12-30 18:58:51.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-ixp2000.c	2006-12-31 01:09:38.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: at91/drivers/media/video/cx88/cx88-vp3054-i2c.c
> ===================================================================
> --- at91.orig/drivers/media/video/cx88/cx88-vp3054-i2c.c	2006-12-30 18:58:52.000000000 -0800
> +++ at91/drivers/media/video/cx88/cx88-vp3054-i2c.c	2006-12-31 01:09:38.000000000 -0800
> @@ -138,7 +138,7 @@ int vp3054_i2c_probe(struct cx8802_dev *
>  
>  	vp3054_i2c->adap.class |= I2C_CLASS_TV_DIGITAL;
>  
> -	vp3054_i2c->adap.dev.parent = &dev->pci->dev;
> +	vp3054_i2c->adap.class_dev.dev = &dev->pci->dev;
>  	strlcpy(vp3054_i2c->adap.name, core->name,
>  		sizeof(vp3054_i2c->adap.name));
>  	vp3054_i2c->algo.data = dev;
> Index: at91/drivers/i2c/busses/i2c-hydra.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-hydra.c	2006-12-30 18:58:51.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-hydra.c	2006-12-31 01:09:39.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: at91/drivers/i2c/busses/i2c-piix4.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-piix4.c	2006-12-31 01:09:09.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-piix4.c	2006-12-31 01:09:39.000000000 -0800
> @@ -428,8 +428,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: at91/drivers/i2c/busses/i2c-amd756.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-amd756.c	2006-12-31 01:09:09.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-amd756.c	2006-12-31 01:09:39.000000000 -0800
> @@ -379,8 +379,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: at91/drivers/i2c/busses/i2c-iop3xx.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-iop3xx.c	2006-12-30 18:58:52.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-iop3xx.c	2006-12-31 01:09:39.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: at91/drivers/i2c/busses/i2c-omap.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-omap.c	2006-12-30 18:58:51.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-omap.c	2006-12-31 01:09:39.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: at91/drivers/i2c/busses/i2c-pnx.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-pnx.c	2006-12-31 01:09:09.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-pnx.c	2006-12-31 01:09:39.000000000 -0800
> @@ -641,7 +641,7 @@ static int __devinit i2c_pnx_probe(struc
>  		goto out_clock;
>  
>  	/* Register this adapter with the I2C subsystem */
> -	i2c_pnx->adapter->dev.parent = &pdev->dev;
> +	i2c_pnx->adapter->class_dev.dev = &pdev->dev;
>  	ret = i2c_add_adapter(i2c_pnx->adapter);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "I2C: Failed to add bus\n");
> Index: at91/drivers/i2c/busses/i2c-voodoo3.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-voodoo3.c	2006-12-30 18:58:51.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-voodoo3.c	2006-12-31 01:09:39.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: at91/drivers/media/video/cx88/cx88-i2c.c
> ===================================================================
> --- at91.orig/drivers/media/video/cx88/cx88-i2c.c	2006-12-30 18:58:52.000000000 -0800
> +++ at91/drivers/media/video/cx88/cx88-i2c.c	2006-12-31 01:09:39.000000000 -0800
> @@ -223,7 +223,7 @@ int cx88_i2c_init(struct cx88_core *core
>  	if (cx88_boards[core->board].mpeg & CX88_MPEG_DVB)
>  		core->i2c_adap.class |= I2C_CLASS_TV_DIGITAL;
>  
> -	core->i2c_adap.dev.parent = &pci->dev;
> +	core->i2c_adap.class_dev.dev = &pci->dev;
>  	strlcpy(core->i2c_adap.name,core->name,sizeof(core->i2c_adap.name));
>  	core->i2c_algo.data = core;
>  	i2c_set_adapdata(&core->i2c_adap,core);
> Index: at91/drivers/i2c/busses/i2c-viapro.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-viapro.c	2006-12-31 01:09:09.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-viapro.c	2006-12-31 01:09:39.000000000 -0800
> @@ -405,7 +405,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: at91/drivers/i2c/busses/i2c-mv64xxx.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-mv64xxx.c	2006-12-30 18:58:51.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-mv64xxx.c	2006-12-31 01:09:39.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;

I've moved this one to patch #5.5.

> Index: at91/drivers/media/video/saa7134/saa7134-i2c.c
> ===================================================================
> --- at91.orig/drivers/media/video/saa7134/saa7134-i2c.c	2006-12-30 18:58:52.000000000 -0800
> +++ at91/drivers/media/video/saa7134/saa7134-i2c.c	2006-12-31 01:09:39.000000000 -0800
> @@ -465,7 +465,7 @@ void saa7134_i2c_call_clients(struct saa
>  int saa7134_i2c_register(struct saa7134_dev *dev)
>  {
>  	dev->i2c_adap = saa7134_adap_template;
> -	dev->i2c_adap.dev.parent = &dev->pci->dev;
> +	dev->i2c_adap.class_dev.dev = &dev->pci->dev;
>  	strcpy(dev->i2c_adap.name,dev->name);
>  	dev->i2c_adap.algo_data = dev;
>  	i2c_add_adapter(&dev->i2c_adap);
> Index: at91/drivers/i2c/busses/i2c-nforce2.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-nforce2.c	2006-12-31 01:09:09.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-nforce2.c	2006-12-31 01:09:39.000000000 -0800
> @@ -243,7 +243,7 @@ static int __devinit nforce2_probe_smb (
>  	smbus->adapter.class = I2C_CLASS_HWMON;
>  	smbus->adapter.algo = &smbus_algorithm;
>  	smbus->adapter.algo_data = smbus;
> -	smbus->adapter.dev.parent = &dev->dev;
> +	smbus->adapter.class_dev.dev = &dev->dev;
>  	snprintf(smbus->adapter.name, I2C_NAME_SIZE,
>  		"SMBus nForce2 adapter at %04x", smbus->base);
>  
> Index: at91/drivers/i2c/busses/i2c-pxa.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-pxa.c	2006-12-31 01:09:09.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-pxa.c	2006-12-31 01:09:39.000000000 -0800
> @@ -871,7 +871,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) {
> Index: at91/drivers/i2c/busses/i2c-ali1563.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-ali1563.c	2006-12-31 01:09:09.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-ali1563.c	2006-12-31 01:09:39.000000000 -0800
> @@ -390,7 +390,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: at91/drivers/i2c/busses/i2c-ali15x3.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-ali15x3.c	2006-12-31 01:09:09.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-ali15x3.c	2006-12-31 01:09:39.000000000 -0800
> @@ -495,8 +495,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: at91/drivers/video/intelfb/intelfb_i2c.c
> ===================================================================
> --- at91.orig/drivers/video/intelfb/intelfb_i2c.c	2006-12-30 18:58:52.000000000 -0800
> +++ at91/drivers/video/intelfb/intelfb_i2c.c	2006-12-31 01:09:39.000000000 -0800
> @@ -109,7 +109,7 @@ static int intelfb_setup_i2c_bus(struct 
>  	chan->adapter.owner			= THIS_MODULE;
>  	chan->adapter.id			= I2C_HW_B_INTELFB;
>  	chan->adapter.algo_data		= &chan->algo;
> -	chan->adapter.dev.parent	= &chan->dinfo->pdev->dev;
> +	chan->adapter.class_dev.dev	= &chan->dinfo->pdev->dev;
>  	chan->algo.setsda			= intelfb_gpio_setsda;
>  	chan->algo.setscl			= intelfb_gpio_setscl;
>  	chan->algo.getsda			= intelfb_gpio_getsda;
> Index: at91/drivers/i2c/busses/i2c-versatile.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-versatile.c	2006-12-30 18:58:51.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-versatile.c	2006-12-31 01:09:39.000000000 -0800
> @@ -98,7 +98,7 @@ static int i2c_versatile_probe(struct pl
>  	i2c->adap.owner = THIS_MODULE;
>  	strlcpy(i2c->adap.name, "Versatile I2C adapter", sizeof(i2c->adap.name));
>  	i2c->adap.algo_data = &i2c->algo;
> -	i2c->adap.dev.parent = &dev->dev;
> +	i2c->adap.class_dev.dev = &dev->dev;
>  	i2c->algo = i2c_versatile_algo;
>  	i2c->algo.data = i2c;
>  
> Index: at91/drivers/i2c/busses/i2c-ali1535.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-ali1535.c	2006-12-31 01:09:09.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-ali1535.c	2006-12-31 01:09:39.000000000 -0800
> @@ -498,8 +498,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: at91/drivers/media/video/em28xx/em28xx-i2c.c
> ===================================================================
> --- at91.orig/drivers/media/video/em28xx/em28xx-i2c.c	2006-12-30 18:58:52.000000000 -0800
> +++ at91/drivers/media/video/em28xx/em28xx-i2c.c	2006-12-31 01:09:39.000000000 -0800
> @@ -552,7 +552,7 @@ int em28xx_i2c_register(struct em28xx *d
>  	BUG_ON(!dev->em28xx_write_regs || !dev->em28xx_read_reg);
>  	BUG_ON(!dev->em28xx_write_regs_req || !dev->em28xx_read_reg_req);
>  	dev->i2c_adap = em28xx_adap_template;
> -	dev->i2c_adap.dev.parent = &dev->udev->dev;
> +	dev->i2c_adap.class_dev.dev = &dev->udev->dev;
>  	strcpy(dev->i2c_adap.name, dev->name);
>  	dev->i2c_adap.algo_data = dev;
>  	i2c_add_adapter(&dev->i2c_adap);
> Index: at91/drivers/video/riva/rivafb-i2c.c
> ===================================================================
> --- at91.orig/drivers/video/riva/rivafb-i2c.c	2006-12-30 18:58:52.000000000 -0800
> +++ at91/drivers/video/riva/rivafb-i2c.c	2006-12-31 01:09:39.000000000 -0800
> @@ -97,7 +97,7 @@ static int riva_setup_i2c_bus(struct riv
>  	chan->adapter.owner		= THIS_MODULE;
>  	chan->adapter.id		= I2C_HW_B_RIVA;
>  	chan->adapter.algo_data		= &chan->algo;
> -	chan->adapter.dev.parent	= &chan->par->pdev->dev;
> +	chan->adapter.class_dev.dev	= &chan->par->pdev->dev;
>  	chan->algo.setsda		= riva_gpio_setsda;
>  	chan->algo.setscl		= riva_gpio_setscl;
>  	chan->algo.getsda		= riva_gpio_getsda;
> Index: at91/drivers/i2c/busses/i2c-sis630.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-sis630.c	2006-12-31 01:09:09.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-sis630.c	2006-12-31 01:09:39.000000000 -0800
> @@ -490,8 +490,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: at91/drivers/i2c/busses/i2c-powermac.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-powermac.c	2006-12-30 18:58:52.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-powermac.c	2006-12-31 01:09:39.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: at91/drivers/i2c/busses/i2c-ixp4xx.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-ixp4xx.c	2006-12-30 18:58:51.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-ixp4xx.c	2006-12-31 01:09:39.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: at91/drivers/i2c/busses/i2c-via.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-via.c	2006-12-30 18:58:51.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-via.c	2006-12-31 01:09:39.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: at91/drivers/media/video/bt8xx/bttv-i2c.c
> ===================================================================
> --- at91.orig/drivers/media/video/bt8xx/bttv-i2c.c	2006-12-30 18:58:52.000000000 -0800
> +++ at91/drivers/media/video/bt8xx/bttv-i2c.c	2006-12-31 01:09:39.000000000 -0800
> @@ -449,7 +449,7 @@ int __devinit init_bttv_i2c(struct bttv 
>  		btv->c.i2c_adap.algo_data = &btv->i2c_algo;
>  	}
>  
> -	btv->c.i2c_adap.dev.parent = &btv->c.pci->dev;
> +	btv->c.i2c_adap.class_dev.dev = &btv->c.pci->dev;
>  	snprintf(btv->c.i2c_adap.name, sizeof(btv->c.i2c_adap.name),
>  		 "bt%d #%d [%s]", btv->id, btv->c.nr,
>  		 btv->use_i2c_hw ? "hw" : "sw");
> Index: at91/drivers/video/savage/savagefb-i2c.c
> ===================================================================
> --- at91.orig/drivers/video/savage/savagefb-i2c.c	2006-12-30 18:58:52.000000000 -0800
> +++ at91/drivers/video/savage/savagefb-i2c.c	2006-12-31 01:09:39.000000000 -0800
> @@ -146,7 +146,7 @@ static int savage_setup_i2c_bus(struct s
>  		chan->adapter.owner		= THIS_MODULE;
>  		chan->adapter.id		= I2C_HW_B_SAVAGE;
>  		chan->adapter.algo_data		= &chan->algo;
> -		chan->adapter.dev.parent	= &chan->par->pcidev->dev;
> +		chan->adapter.class_dev.dev	= &chan->par->pcidev->dev;
>  		chan->algo.udelay		= 40;
>  		chan->algo.timeout		= 20;
>  		chan->algo.data 		= chan;
> Index: at91/drivers/i2c/busses/i2c-s3c2410.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-s3c2410.c	2006-12-31 01:09:09.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-s3c2410.c	2006-12-31 01:09:39.000000000 -0800
> @@ -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 */
>  
> Index: at91/drivers/video/nvidia/nv_i2c.c
> ===================================================================
> --- at91.orig/drivers/video/nvidia/nv_i2c.c	2006-12-30 18:58:52.000000000 -0800
> +++ at91/drivers/video/nvidia/nv_i2c.c	2006-12-31 01:09:39.000000000 -0800
> @@ -97,7 +97,7 @@ static int nvidia_setup_i2c_bus(struct n
>  	chan->adapter.owner = THIS_MODULE;
>  	chan->adapter.id = I2C_HW_B_NVIDIA;
>  	chan->adapter.algo_data = &chan->algo;
> -	chan->adapter.dev.parent = &chan->par->pci_dev->dev;
> +	chan->adapter.class_dev.dev = &chan->par->pci_dev->dev;
>  	chan->algo.setsda = nvidia_gpio_setsda;
>  	chan->algo.setscl = nvidia_gpio_setscl;
>  	chan->algo.getsda = nvidia_gpio_getsda;
> Index: at91/drivers/i2c/busses/i2c-mpc.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-mpc.c	2006-12-30 18:58:51.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-mpc.c	2006-12-31 01:09:39.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: at91/drivers/i2c/busses/i2c-ocores.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-ocores.c	2006-12-30 18:58:52.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-ocores.c	2006-12-31 01:09:39.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: at91/drivers/i2c/busses/i2c-sis96x.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-sis96x.c	2006-12-31 01:09:09.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-sis96x.c	2006-12-31 01:09:39.000000000 -0800
> @@ -302,8 +302,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: at91/drivers/video/i810/i810-i2c.c
> ===================================================================
> --- at91.orig/drivers/video/i810/i810-i2c.c	2006-12-30 18:58:52.000000000 -0800
> +++ at91/drivers/video/i810/i810-i2c.c	2006-12-31 01:09:39.000000000 -0800
> @@ -90,7 +90,7 @@ static int i810_setup_i2c_bus(struct i81
>          strcpy(chan->adapter.name, name);
>          chan->adapter.owner             = THIS_MODULE;
>          chan->adapter.algo_data         = &chan->algo;
> -        chan->adapter.dev.parent        = &chan->par->dev->dev;
> +        chan->adapter.class_dev.dev     = &chan->par->dev->dev;
>  	chan->adapter.id                = I2C_HW_B_I810;
>  	chan->algo.setsda               = i810i2c_setsda;
>  	chan->algo.setscl               = i810i2c_setscl;
> Index: at91/drivers/i2c/busses/i2c-i810.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-i810.c	2006-12-30 18:58:51.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-i810.c	2006-12-31 01:09:39.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: at91/drivers/i2c/busses/i2c-amd8111.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-amd8111.c	2006-12-31 01:09:09.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-amd8111.c	2006-12-31 01:09:39.000000000 -0800
> @@ -356,8 +356,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: at91/drivers/media/dvb/pluto2/pluto2.c
> ===================================================================
> --- at91.orig/drivers/media/dvb/pluto2/pluto2.c	2006-12-30 18:58:52.000000000 -0800
> +++ at91/drivers/media/dvb/pluto2/pluto2.c	2006-12-31 01:09:39.000000000 -0800
> @@ -629,7 +629,7 @@ static int __devinit pluto2_probe(struct
>  	strcpy(pluto->i2c_adap.name, DRIVER_NAME);
>  	pluto->i2c_adap.owner = THIS_MODULE;
>  	pluto->i2c_adap.class = I2C_CLASS_TV_DIGITAL;
> -	pluto->i2c_adap.dev.parent = &pdev->dev;
> +	pluto->i2c_adap.class_dev.dev = &pdev->dev;
>  	pluto->i2c_adap.algo_data = &pluto->i2c_bit;
>  	pluto->i2c_bit.data = pluto;
>  	pluto->i2c_bit.setsda = pluto_setsda;
> Index: at91/drivers/i2c/busses/i2c-sis5595.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-sis5595.c	2006-12-31 01:09:09.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-sis5595.c	2006-12-31 01:09:39.000000000 -0800
> @@ -386,8 +386,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);

Thanks,
-- 
Jean Delvare



More information about the i2c mailing list