From: David Brownell Subject: i2c: Remove i2c_adapter.dev from all i2c adapters Change init of all I2C adapter drivers: stop using i2c_adapter.dev.parent and set i2c_adapter.class_dev.dev instead. Along with previous patches, this means almost all uses of i2c_adapter.dev are gone; so the eventual patch to remove that field will be much smaller. Signed-off-by: David Brownell Signed-off-by: Jean Delvare --- drivers/i2c/busses/i2c-ali1535.c | 4 ++-- drivers/i2c/busses/i2c-ali1563.c | 2 +- drivers/i2c/busses/i2c-ali15x3.c | 4 ++-- drivers/i2c/busses/i2c-amd756.c | 4 ++-- drivers/i2c/busses/i2c-amd8111.c | 4 ++-- drivers/i2c/busses/i2c-at91.c | 2 +- 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-iop3xx.c | 2 +- drivers/i2c/busses/i2c-isa.c | 1 - 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-nforce2.c | 2 +- drivers/i2c/busses/i2c-ocores.c | 2 +- drivers/i2c/busses/i2c-omap.c | 2 +- drivers/i2c/busses/i2c-piix4.c | 4 ++-- drivers/i2c/busses/i2c-pnx.c | 2 +- drivers/i2c/busses/i2c-powermac.c | 2 +- drivers/i2c/busses/i2c-prosavage.c | 2 +- drivers/i2c/busses/i2c-pxa.c | 2 +- drivers/i2c/busses/i2c-s3c2410.c | 2 +- drivers/i2c/busses/i2c-savage4.c | 4 ++-- drivers/i2c/busses/i2c-sis5595.c | 4 ++-- drivers/i2c/busses/i2c-sis630.c | 4 ++-- drivers/i2c/busses/i2c-sis96x.c | 4 ++-- drivers/i2c/busses/i2c-versatile.c | 2 +- drivers/i2c/busses/i2c-via.c | 4 ++-- drivers/i2c/busses/i2c-viapro.c | 2 +- drivers/i2c/busses/i2c-voodoo3.c | 6 +++--- drivers/i2c/i2c-core.c | 16 ++++++++++++++-- drivers/media/common/saa7146_i2c.c | 2 +- drivers/media/dvb/pluto2/pluto2.c | 2 +- drivers/media/video/bt8xx/bttv-i2c.c | 2 +- drivers/media/video/cx88/cx88-i2c.c | 2 +- drivers/media/video/cx88/cx88-vp3054-i2c.c | 2 +- drivers/media/video/em28xx/em28xx-i2c.c | 2 +- drivers/media/video/saa7134/saa7134-i2c.c | 2 +- drivers/video/aty/radeon_i2c.c | 2 +- drivers/video/i810/i810-i2c.c | 2 +- drivers/video/intelfb/intelfb_i2c.c | 2 +- drivers/video/nvidia/nv_i2c.c | 2 +- drivers/video/riva/rivafb-i2c.c | 2 +- drivers/video/savage/savagefb-i2c.c | 2 +- 45 files changed, 72 insertions(+), 61 deletions(-) --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-ali1535.c 2007-01-04 16:30:20.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-ali1535.c 2007-01-04 16:30:30.000000000 +0100 @@ -496,8 +496,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); --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-ali1563.c 2007-01-04 16:30:20.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-ali1563.c 2007-01-04 16:30:30.000000000 +0100 @@ -389,7 +389,7 @@ static int __devinit ali1563_probe(struc if ((error = ali1563_setup(dev))) goto exit; - 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))) --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-ali15x3.c 2007-01-04 16:30:20.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-ali15x3.c 2007-01-04 16:30:30.000000000 +0100 @@ -492,8 +492,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); --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-amd756.c 2007-01-04 16:30:20.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-amd756.c 2007-01-04 16:30:30.000000000 +0100 @@ -376,8 +376,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); --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-amd8111.c 2007-01-04 16:30:20.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-amd8111.c 2007-01-04 16:30:30.000000000 +0100 @@ -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) --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-at91.c 2007-01-04 16:30:20.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-at91.c 2007-01-04 16:30:30.000000000 +0100 @@ -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); --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-hydra.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-hydra.c 2007-01-04 16:30:30.000000000 +0100 @@ -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); --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-i801.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-i801.c 2007-01-04 16:30:30.000000000 +0100 @@ -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); --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-i810.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-i810.c 2007-01-04 16:30:30.000000000 +0100 @@ -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) --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-iop3xx.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-iop3xx.c 2007-01-04 16:30:30.000000000 +0100 @@ -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? --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-isa.c 2007-01-04 16:30:20.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-isa.c 2007-01-04 16:30:30.000000000 +0100 @@ -156,7 +156,6 @@ static int __init i2c_isa_init(void) } /* Add this adapter to the i2c_adapter class */ - memset(&isa_adapter.class_dev, 0x00, sizeof(struct class_device)); isa_adapter.class_dev.dev = &isa_adapter.dev; isa_adapter.class_dev.class = &i2c_adapter_class; strlcpy(isa_adapter.class_dev.class_id, isa_adapter.dev.bus_id, --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-ixp2000.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-ixp2000.c 2007-01-04 16:30:30.000000000 +0100 @@ -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); --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-ixp4xx.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-ixp4xx.c 2007-01-04 16:30:30.000000000 +0100 @@ -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); --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-mpc.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-mpc.c 2007-01-04 16:30:30.000000000 +0100 @@ -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; --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-nforce2.c 2007-01-04 16:30:20.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-nforce2.c 2007-01-04 16:30:30.000000000 +0100 @@ -241,7 +241,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); --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-ocores.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-ocores.c 2007-01-04 16:30:30.000000000 +0100 @@ -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); --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-omap.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-omap.c 2007-01-04 16:30:30.000000000 +0100 @@ -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); --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-piix4.c 2007-01-04 16:30:20.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-piix4.c 2007-01-04 16:30:30.000000000 +0100 @@ -427,8 +427,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); --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-pnx.c 2007-01-04 16:30:20.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-pnx.c 2007-01-04 16:30:30.000000000 +0100 @@ -640,7 +640,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"); --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-powermac.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-powermac.c 2007-01-04 16:30:30.000000000 +0100 @@ -249,7 +249,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) { --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-prosavage.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-prosavage.c 2007-01-04 16:30:30.000000000 +0100 @@ -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; --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-pxa.c 2007-01-04 16:30:20.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-pxa.c 2007-01-04 16:30:30.000000000 +0100 @@ -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) { --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-s3c2410.c 2007-01-04 16:30:20.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-s3c2410.c 2007-01-04 16:30:30.000000000 +0100 @@ -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 */ --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-savage4.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-savage4.c 2007-01-04 16:30:30.000000000 +0100 @@ -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); } --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-sis5595.c 2007-01-04 16:30:20.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-sis5595.c 2007-01-04 16:30:30.000000000 +0100 @@ -385,8 +385,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); --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-sis630.c 2007-01-04 16:30:20.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-sis630.c 2007-01-04 16:30:30.000000000 +0100 @@ -489,8 +489,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); --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-sis96x.c 2007-01-04 16:30:20.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-sis96x.c 2007-01-04 16:30:30.000000000 +0100 @@ -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); --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-versatile.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-versatile.c 2007-01-04 16:30:30.000000000 +0100 @@ -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; --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-via.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-via.c 2007-01-04 16:30:30.000000000 +0100 @@ -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 ) { --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-viapro.c 2007-01-04 16:30:20.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-viapro.c 2007-01-04 16:30:30.000000000 +0100 @@ -403,7 +403,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); --- linux-2.6.20-rc3.orig/drivers/i2c/busses/i2c-voodoo3.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/busses/i2c-voodoo3.c 2007-01-04 16:30:30.000000000 +0100 @@ -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) --- linux-2.6.20-rc3.orig/drivers/i2c/i2c-core.c 2007-01-04 16:30:24.000000000 +0100 +++ linux-2.6.20-rc3/drivers/i2c/i2c-core.c 2007-01-04 17:35:27.000000000 +0100 @@ -188,6 +188,14 @@ int i2c_add_adapter(struct i2c_adapter * list_add_tail(&adap->list,&adapters); INIT_LIST_HEAD(&adap->clients); + /* Until we get rid of i2c_adapter.dev, we use the real device + * as its parent, and we overwrite class_dev.dev to point to it. + * It is assumed that adap->class_dev has been zeroed by the + * caller except for the dev field. + */ + adap->dev.parent = adap->class_dev.dev; + adap->class_dev.dev = &adap->dev; + /* Add the adapter to the driver core. * If the parent pointer is not set up, * we add this adapter to the host bus. @@ -209,8 +217,6 @@ int i2c_add_adapter(struct i2c_adapter * goto out_unregister; /* Add this adapter to the i2c_adapter class */ - memset(&adap->class_dev, 0x00, sizeof(struct class_device)); - adap->class_dev.dev = &adap->dev; adap->class_dev.class = &i2c_adapter_class; strlcpy(adap->class_dev.class_id, adap->dev.bus_id, BUS_ID_SIZE); res = class_device_register(&adap->class_dev); @@ -310,6 +316,12 @@ int i2c_del_adapter(struct i2c_adapter * dev_dbg(dev, "adapter %s [%s] unregistered\n", adap->class_dev.class_id, adap->name); + /* Temporary hack until i2c_adapter.dev is gone: + * restore the original value of adap->class_dev.dev so + * that adapters can register again. This is important for + * some drivers. */ + adap->class_dev.dev = adap->dev.parent; + out_unlock: mutex_unlock(&core_lists); return res; --- linux-2.6.20-rc3.orig/drivers/media/common/saa7146_i2c.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/media/common/saa7146_i2c.c 2007-01-04 16:30:30.000000000 +0100 @@ -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; --- linux-2.6.20-rc3.orig/drivers/media/dvb/pluto2/pluto2.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/media/dvb/pluto2/pluto2.c 2007-01-04 16:30:30.000000000 +0100 @@ -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; --- linux-2.6.20-rc3.orig/drivers/media/video/bt8xx/bttv-i2c.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/media/video/bt8xx/bttv-i2c.c 2007-01-04 16:30:30.000000000 +0100 @@ -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"); --- linux-2.6.20-rc3.orig/drivers/media/video/cx88/cx88-i2c.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/media/video/cx88/cx88-i2c.c 2007-01-04 16:30:30.000000000 +0100 @@ -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); --- linux-2.6.20-rc3.orig/drivers/media/video/cx88/cx88-vp3054-i2c.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/media/video/cx88/cx88-vp3054-i2c.c 2007-01-04 16:30:30.000000000 +0100 @@ -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; --- linux-2.6.20-rc3.orig/drivers/media/video/em28xx/em28xx-i2c.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/media/video/em28xx/em28xx-i2c.c 2007-01-04 16:30:30.000000000 +0100 @@ -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); --- linux-2.6.20-rc3.orig/drivers/media/video/saa7134/saa7134-i2c.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/media/video/saa7134/saa7134-i2c.c 2007-01-04 16:30:30.000000000 +0100 @@ -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); --- linux-2.6.20-rc3.orig/drivers/video/aty/radeon_i2c.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/video/aty/radeon_i2c.c 2007-01-04 16:30:30.000000000 +0100 @@ -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; --- linux-2.6.20-rc3.orig/drivers/video/i810/i810-i2c.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/video/i810/i810-i2c.c 2007-01-04 16:30:30.000000000 +0100 @@ -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; --- linux-2.6.20-rc3.orig/drivers/video/intelfb/intelfb_i2c.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/video/intelfb/intelfb_i2c.c 2007-01-04 16:30:30.000000000 +0100 @@ -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; --- linux-2.6.20-rc3.orig/drivers/video/nvidia/nv_i2c.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/video/nvidia/nv_i2c.c 2007-01-04 16:30:30.000000000 +0100 @@ -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; --- linux-2.6.20-rc3.orig/drivers/video/riva/rivafb-i2c.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/video/riva/rivafb-i2c.c 2007-01-04 16:30:30.000000000 +0100 @@ -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; --- linux-2.6.20-rc3.orig/drivers/video/savage/savagefb-i2c.c 2007-01-04 16:30:14.000000000 +0100 +++ linux-2.6.20-rc3/drivers/video/savage/savagefb-i2c.c 2007-01-04 16:30:30.000000000 +0100 @@ -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;