diff options
22 files changed, 153 insertions, 122 deletions
diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt index c9ae70a37a6c..854808b67fae 100644 --- a/Documentation/video4linux/v4l2-framework.txt +++ b/Documentation/video4linux/v4l2-framework.txt | |||
@@ -364,14 +364,12 @@ from the remove() callback ensures that this is always done correctly. | |||
364 | 364 | ||
365 | The bridge driver also has some helper functions it can use: | 365 | The bridge driver also has some helper functions it can use: |
366 | 366 | ||
367 | struct v4l2_subdev *sd = v4l2_i2c_new_subdev(adapter, "module_foo", "chipid", 0x36); | 367 | struct v4l2_subdev *sd = v4l2_i2c_new_subdev(v4l2_dev, adapter, |
368 | "module_foo", "chipid", 0x36); | ||
368 | 369 | ||
369 | This loads the given module (can be NULL if no module needs to be loaded) and | 370 | This loads the given module (can be NULL if no module needs to be loaded) and |
370 | calls i2c_new_device() with the given i2c_adapter and chip/address arguments. | 371 | calls i2c_new_device() with the given i2c_adapter and chip/address arguments. |
371 | If all goes well, then it registers the subdev with the v4l2_device. It gets | 372 | If all goes well, then it registers the subdev with the v4l2_device. |
372 | the v4l2_device by calling i2c_get_adapdata(adapter), so you should make sure | ||
373 | to call i2c_set_adapdata(adapter, v4l2_device) when you setup the i2c_adapter | ||
374 | in your driver. | ||
375 | 373 | ||
376 | You can also use v4l2_i2c_new_probed_subdev() which is very similar to | 374 | You can also use v4l2_i2c_new_probed_subdev() which is very similar to |
377 | v4l2_i2c_new_subdev(), except that it has an array of possible I2C addresses | 375 | v4l2_i2c_new_subdev(), except that it has an array of possible I2C addresses |
diff --git a/drivers/media/video/au0828/au0828-cards.c b/drivers/media/video/au0828/au0828-cards.c index abba48b154c5..053bbe8c8e3a 100644 --- a/drivers/media/video/au0828/au0828-cards.c +++ b/drivers/media/video/au0828/au0828-cards.c | |||
@@ -211,8 +211,8 @@ void au0828_card_setup(struct au0828_dev *dev) | |||
211 | /* Load the analog demodulator driver (note this would need to | 211 | /* Load the analog demodulator driver (note this would need to |
212 | be abstracted out if we ever need to support a different | 212 | be abstracted out if we ever need to support a different |
213 | demod) */ | 213 | demod) */ |
214 | sd = v4l2_i2c_new_subdev(&dev->i2c_adap, "au8522", "au8522", | 214 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
215 | 0x8e >> 1); | 215 | "au8522", "au8522", 0x8e >> 1); |
216 | if (sd == NULL) | 216 | if (sd == NULL) |
217 | printk(KERN_ERR "analog subdev registration failed\n"); | 217 | printk(KERN_ERR "analog subdev registration failed\n"); |
218 | } | 218 | } |
@@ -220,8 +220,8 @@ void au0828_card_setup(struct au0828_dev *dev) | |||
220 | /* Setup tuners */ | 220 | /* Setup tuners */ |
221 | if (dev->board.tuner_type != TUNER_ABSENT) { | 221 | if (dev->board.tuner_type != TUNER_ABSENT) { |
222 | /* Load the tuner module, which does the attach */ | 222 | /* Load the tuner module, which does the attach */ |
223 | sd = v4l2_i2c_new_subdev(&dev->i2c_adap, "tuner", "tuner", | 223 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
224 | dev->board.tuner_addr); | 224 | "tuner", "tuner", dev->board.tuner_addr); |
225 | if (sd == NULL) | 225 | if (sd == NULL) |
226 | printk(KERN_ERR "tuner subdev registration fail\n"); | 226 | printk(KERN_ERR "tuner subdev registration fail\n"); |
227 | 227 | ||
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index b9c3ba51fb86..ced777084ca0 100644 --- a/drivers/media/video/bt8xx/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c | |||
@@ -3512,12 +3512,15 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3512 | 3512 | ||
3513 | /* Load tuner module before issuing tuner config call! */ | 3513 | /* Load tuner module before issuing tuner config call! */ |
3514 | if (bttv_tvcards[btv->c.type].has_radio) | 3514 | if (bttv_tvcards[btv->c.type].has_radio) |
3515 | v4l2_i2c_new_probed_subdev(&btv->c.i2c_adap, | 3515 | v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev, |
3516 | "tuner", "tuner", v4l2_i2c_tuner_addrs(ADDRS_RADIO)); | 3516 | &btv->c.i2c_adap, "tuner", "tuner", |
3517 | v4l2_i2c_new_probed_subdev(&btv->c.i2c_adap, "tuner", | 3517 | v4l2_i2c_tuner_addrs(ADDRS_RADIO)); |
3518 | "tuner", v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 3518 | v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev, |
3519 | v4l2_i2c_new_probed_subdev(&btv->c.i2c_adap, "tuner", | 3519 | &btv->c.i2c_adap, "tuner", "tuner", |
3520 | "tuner", v4l2_i2c_tuner_addrs(ADDRS_TV_WITH_DEMOD)); | 3520 | v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); |
3521 | v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev, | ||
3522 | &btv->c.i2c_adap, "tuner", "tuner", | ||
3523 | v4l2_i2c_tuner_addrs(ADDRS_TV_WITH_DEMOD)); | ||
3521 | 3524 | ||
3522 | tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; | 3525 | tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; |
3523 | tun_setup.type = btv->tuner_type; | 3526 | tun_setup.type = btv->tuner_type; |
@@ -3570,8 +3573,8 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3570 | }; | 3573 | }; |
3571 | struct v4l2_subdev *sd; | 3574 | struct v4l2_subdev *sd; |
3572 | 3575 | ||
3573 | sd = v4l2_i2c_new_probed_subdev(&btv->c.i2c_adap, | 3576 | sd = v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev, |
3574 | "saa6588", "saa6588", addrs); | 3577 | &btv->c.i2c_adap, "saa6588", "saa6588", addrs); |
3575 | btv->has_saa6588 = (sd != NULL); | 3578 | btv->has_saa6588 = (sd != NULL); |
3576 | } | 3579 | } |
3577 | 3580 | ||
@@ -3595,8 +3598,8 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3595 | I2C_CLIENT_END | 3598 | I2C_CLIENT_END |
3596 | }; | 3599 | }; |
3597 | 3600 | ||
3598 | btv->sd_msp34xx = v4l2_i2c_new_probed_subdev(&btv->c.i2c_adap, | 3601 | btv->sd_msp34xx = v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev, |
3599 | "msp3400", "msp3400", addrs); | 3602 | &btv->c.i2c_adap, "msp3400", "msp3400", addrs); |
3600 | if (btv->sd_msp34xx) | 3603 | if (btv->sd_msp34xx) |
3601 | return; | 3604 | return; |
3602 | goto no_audio; | 3605 | goto no_audio; |
@@ -3609,16 +3612,16 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3609 | I2C_CLIENT_END | 3612 | I2C_CLIENT_END |
3610 | }; | 3613 | }; |
3611 | 3614 | ||
3612 | if (v4l2_i2c_new_probed_subdev(&btv->c.i2c_adap, | 3615 | if (v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev, |
3613 | "tda7432", "tda7432", addrs)) | 3616 | &btv->c.i2c_adap, "tda7432", "tda7432", addrs)) |
3614 | return; | 3617 | return; |
3615 | goto no_audio; | 3618 | goto no_audio; |
3616 | } | 3619 | } |
3617 | 3620 | ||
3618 | case 3: { | 3621 | case 3: { |
3619 | /* The user specified that we should probe for tvaudio */ | 3622 | /* The user specified that we should probe for tvaudio */ |
3620 | btv->sd_tvaudio = v4l2_i2c_new_probed_subdev(&btv->c.i2c_adap, | 3623 | btv->sd_tvaudio = v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev, |
3621 | "tvaudio", "tvaudio", tvaudio_addrs); | 3624 | &btv->c.i2c_adap, "tvaudio", "tvaudio", tvaudio_addrs); |
3622 | if (btv->sd_tvaudio) | 3625 | if (btv->sd_tvaudio) |
3623 | return; | 3626 | return; |
3624 | goto no_audio; | 3627 | goto no_audio; |
@@ -3642,16 +3645,16 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3642 | I2C_CLIENT_END | 3645 | I2C_CLIENT_END |
3643 | }; | 3646 | }; |
3644 | 3647 | ||
3645 | btv->sd_msp34xx = v4l2_i2c_new_probed_subdev(&btv->c.i2c_adap, | 3648 | btv->sd_msp34xx = v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev, |
3646 | "msp3400", "msp3400", addrs); | 3649 | &btv->c.i2c_adap, "msp3400", "msp3400", addrs); |
3647 | } else if (bttv_tvcards[btv->c.type].msp34xx_alt) { | 3650 | } else if (bttv_tvcards[btv->c.type].msp34xx_alt) { |
3648 | static const unsigned short addrs[] = { | 3651 | static const unsigned short addrs[] = { |
3649 | I2C_ADDR_MSP3400_ALT >> 1, | 3652 | I2C_ADDR_MSP3400_ALT >> 1, |
3650 | I2C_CLIENT_END | 3653 | I2C_CLIENT_END |
3651 | }; | 3654 | }; |
3652 | 3655 | ||
3653 | btv->sd_msp34xx = v4l2_i2c_new_probed_subdev(&btv->c.i2c_adap, | 3656 | btv->sd_msp34xx = v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev, |
3654 | "msp3400", "msp3400", addrs); | 3657 | &btv->c.i2c_adap, "msp3400", "msp3400", addrs); |
3655 | } | 3658 | } |
3656 | 3659 | ||
3657 | /* If we found a msp34xx, then we're done. */ | 3660 | /* If we found a msp34xx, then we're done. */ |
@@ -3665,14 +3668,14 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3665 | I2C_CLIENT_END | 3668 | I2C_CLIENT_END |
3666 | }; | 3669 | }; |
3667 | 3670 | ||
3668 | if (v4l2_i2c_new_probed_subdev(&btv->c.i2c_adap, | 3671 | if (v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev, |
3669 | "tda7432", "tda7432", addrs)) | 3672 | &btv->c.i2c_adap, "tda7432", "tda7432", addrs)) |
3670 | return; | 3673 | return; |
3671 | } | 3674 | } |
3672 | 3675 | ||
3673 | /* Now see if we can find one of the tvaudio devices. */ | 3676 | /* Now see if we can find one of the tvaudio devices. */ |
3674 | btv->sd_tvaudio = v4l2_i2c_new_probed_subdev(&btv->c.i2c_adap, | 3677 | btv->sd_tvaudio = v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev, |
3675 | "tvaudio", "tvaudio", tvaudio_addrs); | 3678 | &btv->c.i2c_adap, "tvaudio", "tvaudio", tvaudio_addrs); |
3676 | if (btv->sd_tvaudio) | 3679 | if (btv->sd_tvaudio) |
3677 | return; | 3680 | return; |
3678 | 3681 | ||
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index 7abe94d9fb4c..5f582726985d 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c | |||
@@ -1954,7 +1954,7 @@ static int cafe_pci_probe(struct pci_dev *pdev, | |||
1954 | goto out_freeirq; | 1954 | goto out_freeirq; |
1955 | 1955 | ||
1956 | cam->sensor_addr = 0x42; | 1956 | cam->sensor_addr = 0x42; |
1957 | cam->sensor = v4l2_i2c_new_subdev(&cam->i2c_adapter, | 1957 | cam->sensor = v4l2_i2c_new_subdev(&cam->v4l2_dev, &cam->i2c_adapter, |
1958 | "ov7670", "ov7670", cam->sensor_addr); | 1958 | "ov7670", "ov7670", cam->sensor_addr); |
1959 | if (cam->sensor == NULL) { | 1959 | if (cam->sensor == NULL) { |
1960 | ret = -ENODEV; | 1960 | ret = -ENODEV; |
diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c index d092643faf46..b9b7064a2be8 100644 --- a/drivers/media/video/cx18/cx18-i2c.c +++ b/drivers/media/video/cx18/cx18-i2c.c | |||
@@ -100,16 +100,16 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx) | |||
100 | 100 | ||
101 | if (hw == CX18_HW_TUNER) { | 101 | if (hw == CX18_HW_TUNER) { |
102 | /* special tuner group handling */ | 102 | /* special tuner group handling */ |
103 | sd = v4l2_i2c_new_probed_subdev(adap, mod, type, | 103 | sd = v4l2_i2c_new_probed_subdev(&cx->v4l2_dev, |
104 | cx->card_i2c->radio); | 104 | adap, mod, type, cx->card_i2c->radio); |
105 | if (sd != NULL) | 105 | if (sd != NULL) |
106 | sd->grp_id = hw; | 106 | sd->grp_id = hw; |
107 | sd = v4l2_i2c_new_probed_subdev(adap, mod, type, | 107 | sd = v4l2_i2c_new_probed_subdev(&cx->v4l2_dev, |
108 | cx->card_i2c->demod); | 108 | adap, mod, type, cx->card_i2c->demod); |
109 | if (sd != NULL) | 109 | if (sd != NULL) |
110 | sd->grp_id = hw; | 110 | sd->grp_id = hw; |
111 | sd = v4l2_i2c_new_probed_subdev(adap, mod, type, | 111 | sd = v4l2_i2c_new_probed_subdev(&cx->v4l2_dev, |
112 | cx->card_i2c->tv); | 112 | adap, mod, type, cx->card_i2c->tv); |
113 | if (sd != NULL) | 113 | if (sd != NULL) |
114 | sd->grp_id = hw; | 114 | sd->grp_id = hw; |
115 | return sd != NULL ? 0 : -1; | 115 | return sd != NULL ? 0 : -1; |
@@ -120,7 +120,7 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx) | |||
120 | return -1; | 120 | return -1; |
121 | 121 | ||
122 | /* It's an I2C device other than an analog tuner */ | 122 | /* It's an I2C device other than an analog tuner */ |
123 | sd = v4l2_i2c_new_subdev(adap, mod, type, hw_addrs[idx]); | 123 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, adap, mod, type, hw_addrs[idx]); |
124 | if (sd != NULL) | 124 | if (sd != NULL) |
125 | sd->grp_id = hw; | 125 | sd->grp_id = hw; |
126 | return sd != NULL ? 0 : -1; | 126 | return sd != NULL ? 0 : -1; |
diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c index b63719fddee4..f209fe14f829 100644 --- a/drivers/media/video/cx231xx/cx231xx-cards.c +++ b/drivers/media/video/cx231xx/cx231xx-cards.c | |||
@@ -311,8 +311,8 @@ void cx231xx_card_setup(struct cx231xx *dev) | |||
311 | 311 | ||
312 | /* request some modules */ | 312 | /* request some modules */ |
313 | if (dev->board.decoder == CX231XX_AVDECODER) { | 313 | if (dev->board.decoder == CX231XX_AVDECODER) { |
314 | dev->sd_cx25840 = | 314 | dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
315 | v4l2_i2c_new_subdev(&dev->i2c_bus[0].i2c_adap, | 315 | &dev->i2c_bus[0].i2c_adap, |
316 | "cx25840", "cx25840", 0x88 >> 1); | 316 | "cx25840", "cx25840", 0x88 >> 1); |
317 | if (dev->sd_cx25840 == NULL) | 317 | if (dev->sd_cx25840 == NULL) |
318 | cx231xx_info("cx25840 subdev registration failure\n"); | 318 | cx231xx_info("cx25840 subdev registration failure\n"); |
@@ -321,8 +321,8 @@ void cx231xx_card_setup(struct cx231xx *dev) | |||
321 | } | 321 | } |
322 | 322 | ||
323 | if (dev->board.tuner_type != TUNER_ABSENT) { | 323 | if (dev->board.tuner_type != TUNER_ABSENT) { |
324 | dev->sd_tuner = | 324 | dev->sd_tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
325 | v4l2_i2c_new_subdev(&dev->i2c_bus[1].i2c_adap, | 325 | &dev->i2c_bus[1].i2c_adap, |
326 | "tuner", "tuner", 0xc2 >> 1); | 326 | "tuner", "tuner", 0xc2 >> 1); |
327 | if (dev->sd_tuner == NULL) | 327 | if (dev->sd_tuner == NULL) |
328 | cx231xx_info("tuner subdev registration failure\n"); | 328 | cx231xx_info("tuner subdev registration failure\n"); |
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c index fe8525517c4e..a3c0565be1a9 100644 --- a/drivers/media/video/cx23885/cx23885-cards.c +++ b/drivers/media/video/cx23885/cx23885-cards.c | |||
@@ -739,7 +739,8 @@ void cx23885_card_setup(struct cx23885_dev *dev) | |||
739 | case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H: | 739 | case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H: |
740 | case CX23885_BOARD_COMPRO_VIDEOMATE_E650F: | 740 | case CX23885_BOARD_COMPRO_VIDEOMATE_E650F: |
741 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: | 741 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: |
742 | dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->i2c_bus[2].i2c_adap, | 742 | dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
743 | &dev->i2c_bus[2].i2c_adap, | ||
743 | "cx25840", "cx25840", 0x88 >> 1); | 744 | "cx25840", "cx25840", 0x88 >> 1); |
744 | v4l2_subdev_call(dev->sd_cx25840, core, load_fw); | 745 | v4l2_subdev_call(dev->sd_cx25840, core, load_fw); |
745 | break; | 746 | break; |
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index 41f0a2b11872..ce7b3f8cdc65 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c | |||
@@ -1523,10 +1523,12 @@ int cx23885_video_register(struct cx23885_dev *dev) | |||
1523 | struct v4l2_subdev *sd = NULL; | 1523 | struct v4l2_subdev *sd = NULL; |
1524 | 1524 | ||
1525 | if (dev->tuner_addr) | 1525 | if (dev->tuner_addr) |
1526 | sd = v4l2_i2c_new_subdev(&dev->i2c_bus[1].i2c_adap, | 1526 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
1527 | &dev->i2c_bus[1].i2c_adap, | ||
1527 | "tuner", "tuner", dev->tuner_addr); | 1528 | "tuner", "tuner", dev->tuner_addr); |
1528 | else | 1529 | else |
1529 | sd = v4l2_i2c_new_probed_subdev(&dev->i2c_bus[1].i2c_adap, | 1530 | sd = v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, |
1531 | &dev->i2c_bus[1].i2c_adap, | ||
1530 | "tuner", "tuner", v4l2_i2c_tuner_addrs(ADDRS_TV)); | 1532 | "tuner", "tuner", v4l2_i2c_tuner_addrs(ADDRS_TV)); |
1531 | if (sd) { | 1533 | if (sd) { |
1532 | struct tuner_setup tun_setup; | 1534 | struct tuner_setup tun_setup; |
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 84ecfb291276..6bbbfc66bb4b 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c | |||
@@ -3221,16 +3221,19 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr) | |||
3221 | The radio_type is sometimes missing, or set to UNSET but | 3221 | The radio_type is sometimes missing, or set to UNSET but |
3222 | later code configures a tea5767. | 3222 | later code configures a tea5767. |
3223 | */ | 3223 | */ |
3224 | v4l2_i2c_new_probed_subdev(&core->i2c_adap, "tuner", "tuner", | 3224 | v4l2_i2c_new_probed_subdev(&core->v4l2_dev, &core->i2c_adap, |
3225 | "tuner", "tuner", | ||
3225 | v4l2_i2c_tuner_addrs(ADDRS_RADIO)); | 3226 | v4l2_i2c_tuner_addrs(ADDRS_RADIO)); |
3226 | if (has_demod) | 3227 | if (has_demod) |
3227 | v4l2_i2c_new_probed_subdev(&core->i2c_adap, "tuner", | 3228 | v4l2_i2c_new_probed_subdev(&core->v4l2_dev, |
3228 | "tuner", v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 3229 | &core->i2c_adap, "tuner", "tuner", |
3230 | v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | ||
3229 | if (core->board.tuner_addr == ADDR_UNSET) { | 3231 | if (core->board.tuner_addr == ADDR_UNSET) { |
3230 | v4l2_i2c_new_probed_subdev(&core->i2c_adap, "tuner", | 3232 | v4l2_i2c_new_probed_subdev(&core->v4l2_dev, |
3231 | "tuner", has_demod ? tv_addrs + 4 : tv_addrs); | 3233 | &core->i2c_adap, "tuner", "tuner", |
3234 | has_demod ? tv_addrs + 4 : tv_addrs); | ||
3232 | } else { | 3235 | } else { |
3233 | v4l2_i2c_new_subdev(&core->i2c_adap, | 3236 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, |
3234 | "tuner", "tuner", core->board.tuner_addr); | 3237 | "tuner", "tuner", core->board.tuner_addr); |
3235 | } | 3238 | } |
3236 | } | 3239 | } |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index fb0764af6c77..d7d4d2a6ed9d 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -1882,7 +1882,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, | |||
1882 | /* load and configure helper modules */ | 1882 | /* load and configure helper modules */ |
1883 | 1883 | ||
1884 | if (core->board.audio_chip == V4L2_IDENT_WM8775) | 1884 | if (core->board.audio_chip == V4L2_IDENT_WM8775) |
1885 | v4l2_i2c_new_subdev(&core->i2c_adap, | 1885 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, |
1886 | "wm8775", "wm8775", 0x36 >> 1); | 1886 | "wm8775", "wm8775", 0x36 >> 1); |
1887 | 1887 | ||
1888 | if (core->board.audio_chip == V4L2_IDENT_TVAUDIO) { | 1888 | if (core->board.audio_chip == V4L2_IDENT_TVAUDIO) { |
@@ -1892,7 +1892,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, | |||
1892 | 0xb0 >> 1, I2C_CLIENT_END | 1892 | 0xb0 >> 1, I2C_CLIENT_END |
1893 | }; | 1893 | }; |
1894 | 1894 | ||
1895 | v4l2_i2c_new_probed_subdev(&core->i2c_adap, | 1895 | v4l2_i2c_new_probed_subdev(&core->v4l2_dev, &core->i2c_adap, |
1896 | "tvaudio", "tvaudio", i2c_addr); | 1896 | "tvaudio", "tvaudio", i2c_addr); |
1897 | } | 1897 | } |
1898 | 1898 | ||
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index e7fc2d5b129e..7c70738479dd 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -1958,44 +1958,46 @@ void em28xx_card_setup(struct em28xx *dev) | |||
1958 | 1958 | ||
1959 | /* request some modules */ | 1959 | /* request some modules */ |
1960 | if (dev->board.has_msp34xx) | 1960 | if (dev->board.has_msp34xx) |
1961 | v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "msp3400", | 1961 | v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
1962 | "msp3400", msp3400_addrs); | 1962 | "msp3400", "msp3400", msp3400_addrs); |
1963 | 1963 | ||
1964 | if (dev->board.decoder == EM28XX_SAA711X) | 1964 | if (dev->board.decoder == EM28XX_SAA711X) |
1965 | v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "saa7115", | 1965 | v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
1966 | "saa7115_auto", saa711x_addrs); | 1966 | "saa7115", "saa7115_auto", saa711x_addrs); |
1967 | 1967 | ||
1968 | if (dev->board.decoder == EM28XX_TVP5150) | 1968 | if (dev->board.decoder == EM28XX_TVP5150) |
1969 | v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "tvp5150", | 1969 | v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
1970 | "tvp5150", tvp5150_addrs); | 1970 | "tvp5150", "tvp5150", tvp5150_addrs); |
1971 | 1971 | ||
1972 | if (dev->board.adecoder == EM28XX_TVAUDIO) | 1972 | if (dev->board.adecoder == EM28XX_TVAUDIO) |
1973 | v4l2_i2c_new_subdev(&dev->i2c_adap, "tvaudio", | 1973 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
1974 | "tvaudio", dev->board.tvaudio_addr); | 1974 | "tvaudio", "tvaudio", dev->board.tvaudio_addr); |
1975 | 1975 | ||
1976 | if (dev->board.tuner_type != TUNER_ABSENT) { | 1976 | if (dev->board.tuner_type != TUNER_ABSENT) { |
1977 | int has_demod = (dev->tda9887_conf & TDA9887_PRESENT); | 1977 | int has_demod = (dev->tda9887_conf & TDA9887_PRESENT); |
1978 | 1978 | ||
1979 | if (dev->board.radio.type) | 1979 | if (dev->board.radio.type) |
1980 | v4l2_i2c_new_subdev(&dev->i2c_adap, "tuner", "tuner", | 1980 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
1981 | dev->board.radio_addr); | 1981 | "tuner", "tuner", dev->board.radio_addr); |
1982 | 1982 | ||
1983 | if (has_demod) | 1983 | if (has_demod) |
1984 | v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "tuner", | 1984 | v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, |
1985 | "tuner", v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 1985 | &dev->i2c_adap, "tuner", "tuner", |
1986 | v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | ||
1986 | if (dev->tuner_addr == 0) { | 1987 | if (dev->tuner_addr == 0) { |
1987 | enum v4l2_i2c_tuner_type type = | 1988 | enum v4l2_i2c_tuner_type type = |
1988 | has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; | 1989 | has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; |
1989 | struct v4l2_subdev *sd; | 1990 | struct v4l2_subdev *sd; |
1990 | 1991 | ||
1991 | sd = v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "tuner", | 1992 | sd = v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, |
1992 | "tuner", v4l2_i2c_tuner_addrs(type)); | 1993 | &dev->i2c_adap, "tuner", "tuner", |
1994 | v4l2_i2c_tuner_addrs(type)); | ||
1993 | 1995 | ||
1994 | if (sd) | 1996 | if (sd) |
1995 | dev->tuner_addr = v4l2_i2c_subdev_addr(sd); | 1997 | dev->tuner_addr = v4l2_i2c_subdev_addr(sd); |
1996 | } else { | 1998 | } else { |
1997 | v4l2_i2c_new_subdev(&dev->i2c_adap, "tuner", | 1999 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
1998 | "tuner", dev->tuner_addr); | 2000 | "tuner", "tuner", dev->tuner_addr); |
1999 | } | 2001 | } |
2000 | } | 2002 | } |
2001 | 2003 | ||
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index e73a196ecc7a..1a289fd33cd4 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.c +++ b/drivers/media/video/ivtv/ivtv-i2c.c | |||
@@ -161,15 +161,18 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx) | |||
161 | return -1; | 161 | return -1; |
162 | if (hw == IVTV_HW_TUNER) { | 162 | if (hw == IVTV_HW_TUNER) { |
163 | /* special tuner handling */ | 163 | /* special tuner handling */ |
164 | sd = v4l2_i2c_new_probed_subdev(adap, mod, type, | 164 | sd = v4l2_i2c_new_probed_subdev(&itv->v4l2_dev, |
165 | adap, mod, type, | ||
165 | itv->card_i2c->radio); | 166 | itv->card_i2c->radio); |
166 | if (sd) | 167 | if (sd) |
167 | sd->grp_id = 1 << idx; | 168 | sd->grp_id = 1 << idx; |
168 | sd = v4l2_i2c_new_probed_subdev(adap, mod, type, | 169 | sd = v4l2_i2c_new_probed_subdev(&itv->v4l2_dev, |
170 | adap, mod, type, | ||
169 | itv->card_i2c->demod); | 171 | itv->card_i2c->demod); |
170 | if (sd) | 172 | if (sd) |
171 | sd->grp_id = 1 << idx; | 173 | sd->grp_id = 1 << idx; |
172 | sd = v4l2_i2c_new_probed_subdev(adap, mod, type, | 174 | sd = v4l2_i2c_new_probed_subdev(&itv->v4l2_dev, |
175 | adap, mod, type, | ||
173 | itv->card_i2c->tv); | 176 | itv->card_i2c->tv); |
174 | if (sd) | 177 | if (sd) |
175 | sd->grp_id = 1 << idx; | 178 | sd->grp_id = 1 << idx; |
@@ -180,9 +183,11 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx) | |||
180 | if (hw == IVTV_HW_UPD64031A || hw == IVTV_HW_UPD6408X) { | 183 | if (hw == IVTV_HW_UPD64031A || hw == IVTV_HW_UPD6408X) { |
181 | unsigned short addrs[2] = { hw_addrs[idx], I2C_CLIENT_END }; | 184 | unsigned short addrs[2] = { hw_addrs[idx], I2C_CLIENT_END }; |
182 | 185 | ||
183 | sd = v4l2_i2c_new_probed_subdev(adap, mod, type, addrs); | 186 | sd = v4l2_i2c_new_probed_subdev(&itv->v4l2_dev, |
187 | adap, mod, type, addrs); | ||
184 | } else { | 188 | } else { |
185 | sd = v4l2_i2c_new_subdev(adap, mod, type, hw_addrs[idx]); | 189 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, |
190 | adap, mod, type, hw_addrs[idx]); | ||
186 | } | 191 | } |
187 | if (sd) | 192 | if (sd) |
188 | sd->grp_id = 1 << idx; | 193 | sd->grp_id = 1 << idx; |
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c index 238bb40ae098..6a52b1d5f7ba 100644 --- a/drivers/media/video/mxb.c +++ b/drivers/media/video/mxb.c | |||
@@ -168,13 +168,20 @@ static int mxb_probe(struct saa7146_dev *dev) | |||
168 | return -EFAULT; | 168 | return -EFAULT; |
169 | } | 169 | } |
170 | 170 | ||
171 | mxb->saa7111a = v4l2_i2c_new_subdev(&mxb->i2c_adapter, "saa7115", "saa7111", I2C_SAA7111A); | 171 | mxb->saa7111a = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
172 | mxb->tea6420_1 = v4l2_i2c_new_subdev(&mxb->i2c_adapter, "tea6420", "tea6420", I2C_TEA6420_1); | 172 | "saa7115", "saa7111", I2C_SAA7111A); |
173 | mxb->tea6420_2 = v4l2_i2c_new_subdev(&mxb->i2c_adapter, "tea6420", "tea6420", I2C_TEA6420_2); | 173 | mxb->tea6420_1 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
174 | mxb->tea6415c = v4l2_i2c_new_subdev(&mxb->i2c_adapter, "tea6415c", "tea6415c", I2C_TEA6415C); | 174 | "tea6420", "tea6420", I2C_TEA6420_1); |
175 | mxb->tda9840 = v4l2_i2c_new_subdev(&mxb->i2c_adapter, "tda9840", "tda9840", I2C_TDA9840); | 175 | mxb->tea6420_2 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
176 | mxb->tuner = v4l2_i2c_new_subdev(&mxb->i2c_adapter, "tuner", "tuner", I2C_TUNER); | 176 | "tea6420", "tea6420", I2C_TEA6420_2); |
177 | if (v4l2_i2c_new_subdev(&mxb->i2c_adapter, "saa5246a", "saa5246a", I2C_SAA5246A)) { | 177 | mxb->tea6415c = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
178 | "tea6415c", "tea6415c", I2C_TEA6415C); | ||
179 | mxb->tda9840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | ||
180 | "tda9840", "tda9840", I2C_TDA9840); | ||
181 | mxb->tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | ||
182 | "tuner", "tuner", I2C_TUNER); | ||
183 | if (v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | ||
184 | "saa5246a", "saa5246a", I2C_SAA5246A)) { | ||
178 | printk(KERN_INFO "mxb: found teletext decoder\n"); | 185 | printk(KERN_INFO "mxb: found teletext decoder\n"); |
179 | } | 186 | } |
180 | 187 | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 2ee9d4d4c55c..d9d974a8f52a 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -2039,7 +2039,7 @@ static int pvr2_hdw_load_subdev(struct pvr2_hdw *hdw, | |||
2039 | "Module ID %u:" | 2039 | "Module ID %u:" |
2040 | " Setting up with specified i2c address 0x%x", | 2040 | " Setting up with specified i2c address 0x%x", |
2041 | mid, i2caddr[0]); | 2041 | mid, i2caddr[0]); |
2042 | sd = v4l2_i2c_new_subdev(&hdw->i2c_adap, | 2042 | sd = v4l2_i2c_new_subdev(&hdw->v4l2_dev, &hdw->i2c_adap, |
2043 | fname, fname, | 2043 | fname, fname, |
2044 | i2caddr[0]); | 2044 | i2caddr[0]); |
2045 | } else { | 2045 | } else { |
@@ -2047,7 +2047,7 @@ static int pvr2_hdw_load_subdev(struct pvr2_hdw *hdw, | |||
2047 | "Module ID %u:" | 2047 | "Module ID %u:" |
2048 | " Setting up with address probe list", | 2048 | " Setting up with address probe list", |
2049 | mid); | 2049 | mid); |
2050 | sd = v4l2_i2c_new_probed_subdev(&hdw->i2c_adap, | 2050 | sd = v4l2_i2c_new_probed_subdev(&hdw->v4l2_dev, &hdw->i2c_adap, |
2051 | fname, fname, | 2051 | fname, fname, |
2052 | i2caddr); | 2052 | i2caddr); |
2053 | } | 2053 | } |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index a790a7246a63..e2ffc6756dcc 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -6599,20 +6599,24 @@ int saa7134_board_init2(struct saa7134_dev *dev) | |||
6599 | /* Note: radio tuner address is always filled in, | 6599 | /* Note: radio tuner address is always filled in, |
6600 | so we do not need to probe for a radio tuner device. */ | 6600 | so we do not need to probe for a radio tuner device. */ |
6601 | if (dev->radio_type != UNSET) | 6601 | if (dev->radio_type != UNSET) |
6602 | v4l2_i2c_new_subdev(&dev->i2c_adap, | 6602 | v4l2_i2c_new_subdev(&dev->v4l2_dev, |
6603 | "tuner", "tuner", dev->radio_addr); | 6603 | &dev->i2c_adap, "tuner", "tuner", |
6604 | dev->radio_addr); | ||
6604 | if (has_demod) | 6605 | if (has_demod) |
6605 | v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "tuner", | 6606 | v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, |
6606 | "tuner", v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 6607 | &dev->i2c_adap, "tuner", "tuner", |
6608 | v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | ||
6607 | if (dev->tuner_addr == ADDR_UNSET) { | 6609 | if (dev->tuner_addr == ADDR_UNSET) { |
6608 | enum v4l2_i2c_tuner_type type = | 6610 | enum v4l2_i2c_tuner_type type = |
6609 | has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; | 6611 | has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; |
6610 | 6612 | ||
6611 | v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "tuner", | 6613 | v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, |
6612 | "tuner", v4l2_i2c_tuner_addrs(type)); | 6614 | &dev->i2c_adap, "tuner", "tuner", |
6615 | v4l2_i2c_tuner_addrs(type)); | ||
6613 | } else { | 6616 | } else { |
6614 | v4l2_i2c_new_subdev(&dev->i2c_adap, | 6617 | v4l2_i2c_new_subdev(&dev->v4l2_dev, |
6615 | "tuner", "tuner", dev->tuner_addr); | 6618 | &dev->i2c_adap, "tuner", "tuner", |
6619 | dev->tuner_addr); | ||
6616 | } | 6620 | } |
6617 | } | 6621 | } |
6618 | 6622 | ||
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index ef15f1cb92e4..234f530f0d74 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -982,7 +982,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
982 | /* load i2c helpers */ | 982 | /* load i2c helpers */ |
983 | if (card_is_empress(dev)) { | 983 | if (card_is_empress(dev)) { |
984 | struct v4l2_subdev *sd = | 984 | struct v4l2_subdev *sd = |
985 | v4l2_i2c_new_subdev(&dev->i2c_adap, | 985 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
986 | "saa6752hs", "saa6752hs", | 986 | "saa6752hs", "saa6752hs", |
987 | saa7134_boards[dev->board].empress_addr); | 987 | saa7134_boards[dev->board].empress_addr); |
988 | 988 | ||
@@ -995,8 +995,8 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
995 | struct v4l2_subdev *sd; | 995 | struct v4l2_subdev *sd; |
996 | 996 | ||
997 | addrs[0] = saa7134_boards[dev->board].rds_addr; | 997 | addrs[0] = saa7134_boards[dev->board].rds_addr; |
998 | sd = v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "saa6588", | 998 | sd = v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
999 | "saa6588", addrs); | 999 | "saa6588", "saa6588", addrs); |
1000 | if (sd) | 1000 | if (sd) |
1001 | printk(KERN_INFO "%s: found RDS decoder\n", dev->name); | 1001 | printk(KERN_INFO "%s: found RDS decoder\n", dev->name); |
1002 | } | 1002 | } |
diff --git a/drivers/media/video/usbvision/usbvision-i2c.c b/drivers/media/video/usbvision/usbvision-i2c.c index dd2f8f27c73b..83778267175d 100644 --- a/drivers/media/video/usbvision/usbvision-i2c.c +++ b/drivers/media/video/usbvision/usbvision-i2c.c | |||
@@ -247,7 +247,8 @@ int usbvision_i2c_register(struct usb_usbvision *usbvision) | |||
247 | switch (usbvision_device_data[usbvision->DevModel].Codec) { | 247 | switch (usbvision_device_data[usbvision->DevModel].Codec) { |
248 | case CODEC_SAA7113: | 248 | case CODEC_SAA7113: |
249 | case CODEC_SAA7111: | 249 | case CODEC_SAA7111: |
250 | v4l2_i2c_new_probed_subdev(&usbvision->i2c_adap, "saa7115", | 250 | v4l2_i2c_new_probed_subdev(&usbvision->v4l2_dev, |
251 | &usbvision->i2c_adap, "saa7115", | ||
251 | "saa7115_auto", saa711x_addrs); | 252 | "saa7115_auto", saa711x_addrs); |
252 | break; | 253 | break; |
253 | } | 254 | } |
@@ -256,13 +257,15 @@ int usbvision_i2c_register(struct usb_usbvision *usbvision) | |||
256 | enum v4l2_i2c_tuner_type type; | 257 | enum v4l2_i2c_tuner_type type; |
257 | struct tuner_setup tun_setup; | 258 | struct tuner_setup tun_setup; |
258 | 259 | ||
259 | sd = v4l2_i2c_new_probed_subdev(&usbvision->i2c_adap, "tuner", | 260 | sd = v4l2_i2c_new_probed_subdev(&usbvision->v4l2_dev, |
261 | &usbvision->i2c_adap, "tuner", | ||
260 | "tuner", v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 262 | "tuner", v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); |
261 | /* depending on whether we found a demod or not, select | 263 | /* depending on whether we found a demod or not, select |
262 | the tuner type. */ | 264 | the tuner type. */ |
263 | type = sd ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; | 265 | type = sd ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; |
264 | 266 | ||
265 | sd = v4l2_i2c_new_probed_subdev(&usbvision->i2c_adap, "tuner", | 267 | sd = v4l2_i2c_new_probed_subdev(&usbvision->v4l2_dev, |
268 | &usbvision->i2c_adap, "tuner", | ||
266 | "tuner", v4l2_i2c_tuner_addrs(type)); | 269 | "tuner", v4l2_i2c_tuner_addrs(type)); |
267 | 270 | ||
268 | if (usbvision->tuner_type != -1) { | 271 | if (usbvision->tuner_type != -1) { |
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 270833b1b38f..f576ef66b807 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -760,18 +760,16 @@ EXPORT_SYMBOL_GPL(v4l2_i2c_subdev_init); | |||
760 | 760 | ||
761 | 761 | ||
762 | 762 | ||
763 | /* Load an i2c sub-device. It assumes that i2c_get_adapdata(adapter) | 763 | /* Load an i2c sub-device. */ |
764 | returns the v4l2_device and that i2c_get_clientdata(client) | 764 | struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev, |
765 | returns the v4l2_subdev. */ | 765 | struct i2c_adapter *adapter, |
766 | struct v4l2_subdev *v4l2_i2c_new_subdev(struct i2c_adapter *adapter, | ||
767 | const char *module_name, const char *client_type, u8 addr) | 766 | const char *module_name, const char *client_type, u8 addr) |
768 | { | 767 | { |
769 | struct v4l2_device *dev = i2c_get_adapdata(adapter); | ||
770 | struct v4l2_subdev *sd = NULL; | 768 | struct v4l2_subdev *sd = NULL; |
771 | struct i2c_client *client; | 769 | struct i2c_client *client; |
772 | struct i2c_board_info info; | 770 | struct i2c_board_info info; |
773 | 771 | ||
774 | BUG_ON(!dev); | 772 | BUG_ON(!v4l2_dev); |
775 | 773 | ||
776 | if (module_name) | 774 | if (module_name) |
777 | request_module(module_name); | 775 | request_module(module_name); |
@@ -798,7 +796,7 @@ struct v4l2_subdev *v4l2_i2c_new_subdev(struct i2c_adapter *adapter, | |||
798 | 796 | ||
799 | /* Register with the v4l2_device which increases the module's | 797 | /* Register with the v4l2_device which increases the module's |
800 | use count as well. */ | 798 | use count as well. */ |
801 | if (v4l2_device_register_subdev(dev, sd)) | 799 | if (v4l2_device_register_subdev(v4l2_dev, sd)) |
802 | sd = NULL; | 800 | sd = NULL; |
803 | /* Decrease the module use count to match the first try_module_get. */ | 801 | /* Decrease the module use count to match the first try_module_get. */ |
804 | module_put(client->driver->driver.owner); | 802 | module_put(client->driver->driver.owner); |
@@ -812,19 +810,17 @@ error: | |||
812 | } | 810 | } |
813 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev); | 811 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev); |
814 | 812 | ||
815 | /* Probe and load an i2c sub-device. It assumes that i2c_get_adapdata(adapter) | 813 | /* Probe and load an i2c sub-device. */ |
816 | returns the v4l2_device and that i2c_get_clientdata(client) | 814 | struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct v4l2_device *v4l2_dev, |
817 | returns the v4l2_subdev. */ | 815 | struct i2c_adapter *adapter, |
818 | struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct i2c_adapter *adapter, | ||
819 | const char *module_name, const char *client_type, | 816 | const char *module_name, const char *client_type, |
820 | const unsigned short *addrs) | 817 | const unsigned short *addrs) |
821 | { | 818 | { |
822 | struct v4l2_device *dev = i2c_get_adapdata(adapter); | ||
823 | struct v4l2_subdev *sd = NULL; | 819 | struct v4l2_subdev *sd = NULL; |
824 | struct i2c_client *client = NULL; | 820 | struct i2c_client *client = NULL; |
825 | struct i2c_board_info info; | 821 | struct i2c_board_info info; |
826 | 822 | ||
827 | BUG_ON(!dev); | 823 | BUG_ON(!v4l2_dev); |
828 | 824 | ||
829 | if (module_name) | 825 | if (module_name) |
830 | request_module(module_name); | 826 | request_module(module_name); |
@@ -850,7 +846,7 @@ struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct i2c_adapter *adapter, | |||
850 | 846 | ||
851 | /* Register with the v4l2_device which increases the module's | 847 | /* Register with the v4l2_device which increases the module's |
852 | use count as well. */ | 848 | use count as well. */ |
853 | if (v4l2_device_register_subdev(dev, sd)) | 849 | if (v4l2_device_register_subdev(v4l2_dev, sd)) |
854 | sd = NULL; | 850 | sd = NULL; |
855 | /* Decrease the module use count to match the first try_module_get. */ | 851 | /* Decrease the module use count to match the first try_module_get. */ |
856 | module_put(client->driver->driver.owner); | 852 | module_put(client->driver->driver.owner); |
diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c index c39a2d4d5178..94343758ff5f 100644 --- a/drivers/media/video/vino.c +++ b/drivers/media/video/vino.c | |||
@@ -4337,11 +4337,13 @@ static int __init vino_module_init(void) | |||
4337 | vino_init_stage++; | 4337 | vino_init_stage++; |
4338 | 4338 | ||
4339 | addr[0] = 0x45; | 4339 | addr[0] = 0x45; |
4340 | vino_drvdata->decoder = v4l2_i2c_new_probed_subdev(&vino_i2c_adapter, | 4340 | vino_drvdata->decoder = |
4341 | "saa7191", "saa7191", addr); | 4341 | v4l2_i2c_new_probed_subdev(&vino_drvdata->v4l2_dev, |
4342 | &vino_i2c_adapter, "saa7191", "saa7191", addr); | ||
4342 | addr[0] = 0x2b; | 4343 | addr[0] = 0x2b; |
4343 | vino_drvdata->camera = v4l2_i2c_new_probed_subdev(&vino_i2c_adapter, | 4344 | vino_drvdata->camera = |
4344 | "indycam", "indycam", addr); | 4345 | v4l2_i2c_new_probed_subdev(&vino_drvdata->v4l2_dev, |
4346 | &vino_i2c_adapter, "indycam", "indycam", addr); | ||
4345 | 4347 | ||
4346 | dprintk("init complete!\n"); | 4348 | dprintk("init complete!\n"); |
4347 | 4349 | ||
diff --git a/drivers/media/video/w9968cf.c b/drivers/media/video/w9968cf.c index df181e86f9cb..f59b2bd07e89 100644 --- a/drivers/media/video/w9968cf.c +++ b/drivers/media/video/w9968cf.c | |||
@@ -3523,7 +3523,8 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
3523 | w9968cf_turn_on_led(cam); | 3523 | w9968cf_turn_on_led(cam); |
3524 | 3524 | ||
3525 | w9968cf_i2c_init(cam); | 3525 | w9968cf_i2c_init(cam); |
3526 | cam->sensor_sd = v4l2_i2c_new_probed_subdev(&cam->i2c_adapter, | 3526 | cam->sensor_sd = v4l2_i2c_new_probed_subdev(&cam->v4l2_dev, |
3527 | &cam->i2c_adapter, | ||
3527 | "ovcamchip", "ovcamchip", addrs); | 3528 | "ovcamchip", "ovcamchip", addrs); |
3528 | 3529 | ||
3529 | usb_set_intfdata(intf, cam); | 3530 | usb_set_intfdata(intf, cam); |
diff --git a/drivers/media/video/zoran/zoran_card.c b/drivers/media/video/zoran/zoran_card.c index f91bba435ed5..1ef70b090c4c 100644 --- a/drivers/media/video/zoran/zoran_card.c +++ b/drivers/media/video/zoran/zoran_card.c | |||
@@ -1360,11 +1360,13 @@ static int __devinit zoran_probe(struct pci_dev *pdev, | |||
1360 | goto zr_free_irq; | 1360 | goto zr_free_irq; |
1361 | } | 1361 | } |
1362 | 1362 | ||
1363 | zr->decoder = v4l2_i2c_new_probed_subdev(&zr->i2c_adapter, | 1363 | zr->decoder = v4l2_i2c_new_probed_subdev(&zr->v4l2_dev, |
1364 | zr->card.mod_decoder, zr->card.i2c_decoder, zr->card.addrs_decoder); | 1364 | &zr->i2c_adapter, zr->card.mod_decoder, zr->card.i2c_decoder, |
1365 | zr->card.addrs_decoder); | ||
1365 | 1366 | ||
1366 | if (zr->card.mod_encoder) | 1367 | if (zr->card.mod_encoder) |
1367 | zr->encoder = v4l2_i2c_new_probed_subdev(&zr->i2c_adapter, | 1368 | zr->encoder = v4l2_i2c_new_probed_subdev(&zr->v4l2_dev, |
1369 | &zr->i2c_adapter, | ||
1368 | zr->card.mod_encoder, zr->card.i2c_encoder, | 1370 | zr->card.mod_encoder, zr->card.i2c_encoder, |
1369 | zr->card.addrs_encoder); | 1371 | zr->card.addrs_encoder); |
1370 | 1372 | ||
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 1613a0ab8b04..01302f19bc91 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h | |||
@@ -139,12 +139,14 @@ struct v4l2_subdev_ops; | |||
139 | /* Load an i2c module and return an initialized v4l2_subdev struct. | 139 | /* Load an i2c module and return an initialized v4l2_subdev struct. |
140 | Only call request_module if module_name != NULL. | 140 | Only call request_module if module_name != NULL. |
141 | The client_type argument is the name of the chip that's on the adapter. */ | 141 | The client_type argument is the name of the chip that's on the adapter. */ |
142 | struct v4l2_subdev *v4l2_i2c_new_subdev(struct i2c_adapter *adapter, | 142 | struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev, |
143 | struct i2c_adapter *adapter, | ||
143 | const char *module_name, const char *client_type, u8 addr); | 144 | const char *module_name, const char *client_type, u8 addr); |
144 | /* Probe and load an i2c module and return an initialized v4l2_subdev struct. | 145 | /* Probe and load an i2c module and return an initialized v4l2_subdev struct. |
145 | Only call request_module if module_name != NULL. | 146 | Only call request_module if module_name != NULL. |
146 | The client_type argument is the name of the chip that's on the adapter. */ | 147 | The client_type argument is the name of the chip that's on the adapter. */ |
147 | struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct i2c_adapter *adapter, | 148 | struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct v4l2_device *v4l2_dev, |
149 | struct i2c_adapter *adapter, | ||
148 | const char *module_name, const char *client_type, | 150 | const char *module_name, const char *client_type, |
149 | const unsigned short *addrs); | 151 | const unsigned short *addrs); |
150 | /* Like v4l2_i2c_new_probed_subdev, except probe for a single address. */ | 152 | /* Like v4l2_i2c_new_probed_subdev, except probe for a single address. */ |