]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
i2c: Declare more i2c_adapter parent devices
authorJean Delvare <khali@linux-fr.org>
Tue, 13 Feb 2007 21:09:03 +0000 (22:09 +0100)
committerJean Delvare <khali@arrakis.delvare>
Tue, 13 Feb 2007 21:09:03 +0000 (22:09 +0100)
Declare the parent device of i2c_adapter devices each time we can
easily do so. It makes the i2c_adapter appear at the right place in
the device tree, rather than as a platform device.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Len Brown <len.brown@intel.com>
Cc: Jordan Crouse <jordan.crouse@amd.com>
Cc: Jody McIntyre <scjody@modernduck.com>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: v4l-dvb-maintainer@linuxtv.org
Cc: Petr Vandrovec <vandrove@vc.cvut.cz>
15 files changed:
drivers/acpi/i2c_ec.c
drivers/i2c/busses/i2c-amd756-s4882.c
drivers/i2c/busses/i2c-ibm_iic.c
drivers/i2c/busses/i2c-mv64xxx.c
drivers/i2c/busses/scx200_acb.c
drivers/ieee1394/pcilynx.c
drivers/media/dvb/b2c2/flexcop-i2c.c
drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
drivers/media/video/cafe_ccic.c
drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
drivers/media/video/usbvision/usbvision-i2c.c
drivers/media/video/w9968cf.c
drivers/media/video/zoran_card.c
drivers/video/matrox/i2c-matroxfb.c

index 8338be0990bce2854078bfef18e45ccef0836ca2..bb54b6cdb30b8a1ed42bfe0f9b9f78cb3739ed2f 100644 (file)
@@ -340,6 +340,7 @@ static int acpi_ec_hc_add(struct acpi_device *device)
        smbus->adapter.owner = THIS_MODULE;
        smbus->adapter.algo = &acpi_ec_smbus_algorithm;
        smbus->adapter.algo_data = smbus;
+       smbus->adapter.dev.parent = &device->dev;
 
        if (i2c_add_adapter(&smbus->adapter)) {
                ACPI_DEBUG_PRINT((ACPI_DB_WARN,
index 08e915730caf94505e44bd27845c193c50dd394f..e5e96c8175660b15f006d9517a2866248e5a4a62 100644 (file)
@@ -184,12 +184,14 @@ static int __init amd756_s4882_init(void)
        s4882_algo[0].smbus_xfer = amd756_access_virt0;
        s4882_adapter[0] = amd756_smbus;
        s4882_adapter[0].algo = s4882_algo;
+       s4882_adapter[0].dev.parent = amd756_smbus.dev.parent;
        for (i = 1; i < 5; i++) {
                s4882_algo[i] = *(amd756_smbus.algo);
                s4882_adapter[i] = amd756_smbus;
                sprintf(s4882_adapter[i].name,
                        "SMBus 8111 adapter (CPU%d)", i-1);
                s4882_adapter[i].algo = s4882_algo+i;
+               s4882_adapter[i].dev.parent = amd756_smbus.dev.parent;
        }
        s4882_algo[1].smbus_xfer = amd756_access_virt1;
        s4882_algo[2].smbus_xfer = amd756_access_virt2;
index 1898e9987021606c78af90c3b97869066355aa7d..8b14d14e60cad3e3cd1099df6d221dc6ab1b475e 100644 (file)
@@ -727,6 +727,7 @@ static int __devinit iic_probe(struct ocp_device *ocp){
        
        /* Register it with i2c layer */
        adap = &dev->adap;
+       adap->dev.parent = &ocp->dev;
        strcpy(adap->name, "IBM IIC");
        i2c_set_adapdata(adap, dev);
        adap->id = I2C_HW_OCP;
index 490173611d6b615013b2d87a7984af9aec7b04d2..a3283b907eb87a947fe30979e27867c34811cfaf 100644 (file)
@@ -520,6 +520,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
                rc = -ENXIO;
                goto exit_unmap_regs;
        }
+       drv_data->adapter.dev.parent = &pd->dev;
        drv_data->adapter.id = I2C_HW_MV64XXX;
        drv_data->adapter.algo = &mv64xxx_i2c_algo;
        drv_data->adapter.owner = THIS_MODULE;
index 714bae780953c821792ec410597411f722c7df87..0b082c5a01956d7e98b52329ad920b69693793e3 100644 (file)
@@ -428,7 +428,7 @@ static __init int scx200_acb_probe(struct scx200_acb_iface *iface)
 }
 
 static __init struct scx200_acb_iface *scx200_create_iface(const char *text,
-               int index)
+               struct device *dev, int index)
 {
        struct scx200_acb_iface *iface;
        struct i2c_adapter *adapter;
@@ -446,6 +446,7 @@ static __init struct scx200_acb_iface *scx200_create_iface(const char *text,
        adapter->id = I2C_HW_SMBUS_SCX200;
        adapter->algo = &scx200_acb_algorithm;
        adapter->class = I2C_CLASS_HWMON;
+       adapter->dev.parent = dev;
 
        mutex_init(&iface->mutex);
 
@@ -486,7 +487,7 @@ static __init int scx200_create_pci(const char *text, struct pci_dev *pdev,
        struct scx200_acb_iface *iface;
        int rc;
 
-       iface = scx200_create_iface(text, 0);
+       iface = scx200_create_iface(text, &pdev->dev, 0);
 
        if (iface == NULL)
                return -ENOMEM;
@@ -524,7 +525,7 @@ static int __init scx200_create_isa(const char *text, unsigned long base,
        struct scx200_acb_iface *iface;
        int rc;
 
-       iface = scx200_create_iface(text, index);
+       iface = scx200_create_iface(text, NULL, index);
 
        if (iface == NULL)
                return -ENOMEM;
index fbb7f14ec5097455c628e08c0b4b4910d557af5e..0742befe92270f0d9557072dc59a6b2771e5197c 100644 (file)
@@ -1434,6 +1434,7 @@ static int __devinit add_card(struct pci_dev *dev,
                 i2c_adapter_data = bit_data;
                 i2c_ad->algo_data = &i2c_adapter_data;
                 i2c_adapter_data.data = lynx;
+               i2c_ad->dev.parent = &dev->dev;
 
                PRINTD(KERN_DEBUG, lynx->id,"original eeprom control: %d",
                       reg_read(lynx, SERIAL_EEPROM_CONTROL));
index e0bd2d8f0f0c92e08235aa9e15db650d43723f21..5347a406fff7e0e73abe885eff3562ca747a10a6 100644 (file)
@@ -190,6 +190,7 @@ int flexcop_i2c_init(struct flexcop_device *fc)
        fc->i2c_adap.class          = I2C_CLASS_TV_DIGITAL;
        fc->i2c_adap.algo       = &flexcop_algo;
        fc->i2c_adap.algo_data  = NULL;
+       fc->i2c_adap.dev.parent = fc->dev;
 
        if ((ret = i2c_add_adapter(&fc->i2c_adap)) < 0)
                return ret;
index 55ba020386c97d32db99f288250c5d603a382789..70df31b0a8a9cdecfae95d3f4dea2efc07ad0b5f 100644 (file)
@@ -27,6 +27,7 @@ int dvb_usb_i2c_init(struct dvb_usb_device *d)
 #endif
        d->i2c_adap.algo      = d->props.i2c_algo;
        d->i2c_adap.algo_data = NULL;
+       d->i2c_adap.dev.parent = &d->udev->dev;
 
        i2c_set_adapdata(&d->i2c_adap, d);
 
index 60820deb900b3958e2cc0c43faaa1b5360eab34f..b60cdc93d6dbddab7031a69128acb3114c5f9852 100644 (file)
@@ -1690,6 +1690,7 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i
 #endif
        ttusb->i2c_adap.algo              = &ttusb_dec_algo;
        ttusb->i2c_adap.algo_data         = NULL;
+       ttusb->i2c_adap.dev.parent        = &udev->dev;
 
        result = i2c_add_adapter(&ttusb->i2c_adap);
        if (result) {
index fb1410c6f864be4d89e8dd9573787554d68f8e49..4dae8925667f77cd2cbfb9919321b3d00d87d265 100644 (file)
@@ -549,6 +549,7 @@ static int cafe_smbus_setup(struct cafe_camera *cam)
        adap->client_unregister = cafe_smbus_detach;
        adap->algo = &cafe_smbus_algo;
        strcpy(adap->name, "cafe_ccic");
+       adap->dev.parent = &cam->pdev->dev;
        i2c_set_adapdata(adap, cam);
        ret = i2c_add_adapter(adap);
        if (ret)
index f9bb41d8f4f3375896fe3580ad8ac815a6c3b172..62a7cfca837dae7846a5faf299f88ccb4977527e 100644 (file)
@@ -977,6 +977,7 @@ void pvr2_i2c_core_init(struct pvr2_hdw *hdw)
        memcpy(&hdw->i2c_adap,&pvr2_i2c_adap_template,sizeof(hdw->i2c_adap));
        memcpy(&hdw->i2c_algo,&pvr2_i2c_algo_template,sizeof(hdw->i2c_algo));
        strlcpy(hdw->i2c_adap.name,hdw->name,sizeof(hdw->i2c_adap.name));
+       hdw->i2c_adap.dev.parent = &hdw->usb_dev->dev;
        hdw->i2c_adap.algo = &hdw->i2c_algo;
        hdw->i2c_adap.algo_data = hdw;
        hdw->i2c_pend_mask = 0;
index 858252c15084a3d562d3cb1c981e4c8853c6823f..a242b76aea894c8b0b7e16282c063b5733f0fe0d 100644 (file)
@@ -258,6 +258,7 @@ int usbvision_init_i2c(struct usb_usbvision *usbvision)
        sprintf(usbvision->i2c_adap.name + strlen(usbvision->i2c_adap.name),
                " #%d", usbvision->vdev->minor & 0x1f);
        PDEBUG(DBG_I2C,"Adaptername: %s", usbvision->i2c_adap.name);
+       usbvision->i2c_adap.dev.parent = &usbvision->dev->dev;
 
        i2c_set_adapdata(&usbvision->i2c_adap, usbvision);
        i2c_set_clientdata(&usbvision->i2c_client, usbvision);
index 6e64af293be58e905b266b12845161f1f7be55d3..8f31613b9903897b52fe42f12c9533559d120a5f 100644 (file)
@@ -1573,6 +1573,7 @@ static int w9968cf_i2c_init(struct w9968cf_device* cam)
 
        memcpy(&cam->i2c_adapter, &adap, sizeof(struct i2c_adapter));
        strcpy(cam->i2c_adapter.name, "w9968cf");
+       cam->i2c_adapter.dev.parent = &cam->usbdev->dev;
        i2c_set_adapdata(&cam->i2c_adapter, cam);
 
        DBG(6, "Registering I2C adapter with kernel...")
index 4d1eb2fba34a8c7d5ec8edd30d76adf1376645fc..73162a3a61dd4182c03921c76595fbdcc53b93ec 100644 (file)
@@ -843,6 +843,7 @@ zoran_register_i2c (struct zoran *zr)
                sizeof(I2C_NAME(&zr->i2c_adapter)) - 1);
        i2c_set_adapdata(&zr->i2c_adapter, zr);
        zr->i2c_adapter.algo_data = &zr->i2c_algo;
+       zr->i2c_adapter.dev.parent = &zr->pci_dev->dev;
        return i2c_bit_add_bus(&zr->i2c_adapter);
 }
 
index f64c4a0984cd22857eb81f56eb9195b4f86d20bf..5ec718a5fe2257c093ccaf74f550ba9100bf4c27 100644 (file)
@@ -115,6 +115,7 @@ static int i2c_bus_reg(struct i2c_bit_adapter* b, struct matrox_fb_info* minfo,
                minfo->fbcon.node);
        i2c_set_adapdata(&b->adapter, b);
        b->adapter.algo_data = &b->bac;
+       b->adapter.dev.parent = &ACCESS_FBINFO(pcidev)->dev;
        b->bac = matrox_i2c_algo_template;
        b->bac.data = b;
        err = i2c_bit_add_bus(&b->adapter);