diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2009-08-10 01:49:08 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-18 23:19:24 -0400 |
commit | 53dacb15705901e14b03dcba27e40364fedd9d09 (patch) | |
tree | ca3b4111465aca9d58024ace0f0072ee7952c11e | |
parent | 0da2808ca27ab7f65346d4d191569c669db8f628 (diff) |
V4L/DVB (12540): v4l: simplify v4l2_i2c_new_subdev and friends
Rewrite v4l2_i2c_new_subdev as a simplified version of v4l2_i2c_new_subdev_cfg
and remove v4l2_i2c_new_probed_subdev and v4l2_i2c_new_probed_subdev_addr.
This simplifies this API substantially.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
23 files changed, 126 insertions, 269 deletions
diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt index ba4706afc5fb..e395a9cdc533 100644 --- a/Documentation/video4linux/v4l2-framework.txt +++ b/Documentation/video4linux/v4l2-framework.txt | |||
@@ -370,19 +370,20 @@ from the remove() callback ensures that this is always done correctly. | |||
370 | The bridge driver also has some helper functions it can use: | 370 | The bridge driver also has some helper functions it can use: |
371 | 371 | ||
372 | struct v4l2_subdev *sd = v4l2_i2c_new_subdev(v4l2_dev, adapter, | 372 | struct v4l2_subdev *sd = v4l2_i2c_new_subdev(v4l2_dev, adapter, |
373 | "module_foo", "chipid", 0x36); | 373 | "module_foo", "chipid", 0x36, NULL); |
374 | 374 | ||
375 | This loads the given module (can be NULL if no module needs to be loaded) and | 375 | This loads the given module (can be NULL if no module needs to be loaded) and |
376 | calls i2c_new_device() with the given i2c_adapter and chip/address arguments. | 376 | calls i2c_new_device() with the given i2c_adapter and chip/address arguments. |
377 | If all goes well, then it registers the subdev with the v4l2_device. | 377 | If all goes well, then it registers the subdev with the v4l2_device. |
378 | 378 | ||
379 | You can also use v4l2_i2c_new_probed_subdev() which is very similar to | 379 | You can also use the last argument of v4l2_i2c_new_subdev() to pass an array |
380 | v4l2_i2c_new_subdev(), except that it has an array of possible I2C addresses | 380 | of possible I2C addresses that it should probe. These probe addresses are |
381 | that it should probe. Internally it calls i2c_new_probed_device(). | 381 | only used if the previous argument is 0. A non-zero argument means that you |
382 | know the exact i2c address so in that case no probing will take place. | ||
382 | 383 | ||
383 | Both functions return NULL if something went wrong. | 384 | Both functions return NULL if something went wrong. |
384 | 385 | ||
385 | Note that the chipid you pass to v4l2_i2c_new_(probed_)subdev() is usually | 386 | Note that the chipid you pass to v4l2_i2c_new_subdev() is usually |
386 | the same as the module name. It allows you to specify a chip variant, e.g. | 387 | the same as the module name. It allows you to specify a chip variant, e.g. |
387 | "saa7114" or "saa7115". In general though the i2c driver autodetects this. | 388 | "saa7114" or "saa7115". In general though the i2c driver autodetects this. |
388 | The use of chipid is something that needs to be looked at more closely at a | 389 | The use of chipid is something that needs to be looked at more closely at a |
@@ -410,11 +411,6 @@ the irq and platform_data arguments after the subdev was setup. The older | |||
410 | v4l2_i2c_new_(probed_)subdev functions will call s_config as well, but with | 411 | v4l2_i2c_new_(probed_)subdev functions will call s_config as well, but with |
411 | irq set to 0 and platform_data set to NULL. | 412 | irq set to 0 and platform_data set to NULL. |
412 | 413 | ||
413 | Note that in the next kernel release the functions v4l2_i2c_new_subdev, | ||
414 | v4l2_i2c_new_probed_subdev and v4l2_i2c_new_probed_subdev_addr will all be | ||
415 | replaced by a single v4l2_i2c_new_subdev that is identical to | ||
416 | v4l2_i2c_new_subdev_cfg but without the irq and platform_data arguments. | ||
417 | |||
418 | struct video_device | 414 | struct video_device |
419 | ------------------- | 415 | ------------------- |
420 | 416 | ||
diff --git a/drivers/media/video/au0828/au0828-cards.c b/drivers/media/video/au0828/au0828-cards.c index 830c4a933f63..57dd9195daf5 100644 --- a/drivers/media/video/au0828/au0828-cards.c +++ b/drivers/media/video/au0828/au0828-cards.c | |||
@@ -212,7 +212,7 @@ void au0828_card_setup(struct au0828_dev *dev) | |||
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->v4l2_dev, &dev->i2c_adap, | 214 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
215 | "au8522", "au8522", 0x8e >> 1); | 215 | "au8522", "au8522", 0x8e >> 1, NULL); |
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 | } |
@@ -221,7 +221,7 @@ void au0828_card_setup(struct au0828_dev *dev) | |||
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->v4l2_dev, &dev->i2c_adap, | 223 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
224 | "tuner", "tuner", dev->board.tuner_addr); | 224 | "tuner", "tuner", dev->board.tuner_addr, NULL); |
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 b42251fa96ba..12279f6d9bc4 100644 --- a/drivers/media/video/bt8xx/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c | |||
@@ -3524,8 +3524,8 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3524 | }; | 3524 | }; |
3525 | struct v4l2_subdev *sd; | 3525 | struct v4l2_subdev *sd; |
3526 | 3526 | ||
3527 | sd = v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev, | 3527 | sd = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3528 | &btv->c.i2c_adap, "saa6588", "saa6588", addrs); | 3528 | &btv->c.i2c_adap, "saa6588", "saa6588", 0, addrs); |
3529 | btv->has_saa6588 = (sd != NULL); | 3529 | btv->has_saa6588 = (sd != NULL); |
3530 | } | 3530 | } |
3531 | 3531 | ||
@@ -3549,8 +3549,8 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3549 | I2C_CLIENT_END | 3549 | I2C_CLIENT_END |
3550 | }; | 3550 | }; |
3551 | 3551 | ||
3552 | btv->sd_msp34xx = v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev, | 3552 | btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3553 | &btv->c.i2c_adap, "msp3400", "msp3400", addrs); | 3553 | &btv->c.i2c_adap, "msp3400", "msp3400", 0, addrs); |
3554 | if (btv->sd_msp34xx) | 3554 | if (btv->sd_msp34xx) |
3555 | return; | 3555 | return; |
3556 | goto no_audio; | 3556 | goto no_audio; |
@@ -3563,16 +3563,16 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3563 | I2C_CLIENT_END | 3563 | I2C_CLIENT_END |
3564 | }; | 3564 | }; |
3565 | 3565 | ||
3566 | if (v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev, | 3566 | if (v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3567 | &btv->c.i2c_adap, "tda7432", "tda7432", addrs)) | 3567 | &btv->c.i2c_adap, "tda7432", "tda7432", 0, addrs)) |
3568 | return; | 3568 | return; |
3569 | goto no_audio; | 3569 | goto no_audio; |
3570 | } | 3570 | } |
3571 | 3571 | ||
3572 | case 3: { | 3572 | case 3: { |
3573 | /* The user specified that we should probe for tvaudio */ | 3573 | /* The user specified that we should probe for tvaudio */ |
3574 | btv->sd_tvaudio = v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev, | 3574 | btv->sd_tvaudio = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3575 | &btv->c.i2c_adap, "tvaudio", "tvaudio", tvaudio_addrs()); | 3575 | &btv->c.i2c_adap, "tvaudio", "tvaudio", 0, tvaudio_addrs()); |
3576 | if (btv->sd_tvaudio) | 3576 | if (btv->sd_tvaudio) |
3577 | return; | 3577 | return; |
3578 | goto no_audio; | 3578 | goto no_audio; |
@@ -3591,13 +3591,13 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3591 | it really is a msp3400, so it will return NULL when the device | 3591 | it really is a msp3400, so it will return NULL when the device |
3592 | found is really something else (e.g. a tea6300). */ | 3592 | found is really something else (e.g. a tea6300). */ |
3593 | if (!bttv_tvcards[btv->c.type].no_msp34xx) { | 3593 | if (!bttv_tvcards[btv->c.type].no_msp34xx) { |
3594 | btv->sd_msp34xx = v4l2_i2c_new_probed_subdev_addr(&btv->c.v4l2_dev, | 3594 | btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3595 | &btv->c.i2c_adap, "msp3400", "msp3400", | 3595 | &btv->c.i2c_adap, "msp3400", "msp3400", |
3596 | I2C_ADDR_MSP3400 >> 1); | 3596 | 0, I2C_ADDRS(I2C_ADDR_MSP3400 >> 1)); |
3597 | } else if (bttv_tvcards[btv->c.type].msp34xx_alt) { | 3597 | } else if (bttv_tvcards[btv->c.type].msp34xx_alt) { |
3598 | btv->sd_msp34xx = v4l2_i2c_new_probed_subdev_addr(&btv->c.v4l2_dev, | 3598 | btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3599 | &btv->c.i2c_adap, "msp3400", "msp3400", | 3599 | &btv->c.i2c_adap, "msp3400", "msp3400", |
3600 | I2C_ADDR_MSP3400_ALT >> 1); | 3600 | 0, I2C_ADDRS(I2C_ADDR_MSP3400_ALT >> 1)); |
3601 | } | 3601 | } |
3602 | 3602 | ||
3603 | /* If we found a msp34xx, then we're done. */ | 3603 | /* If we found a msp34xx, then we're done. */ |
@@ -3611,14 +3611,14 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3611 | I2C_CLIENT_END | 3611 | I2C_CLIENT_END |
3612 | }; | 3612 | }; |
3613 | 3613 | ||
3614 | if (v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev, | 3614 | if (v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3615 | &btv->c.i2c_adap, "tda7432", "tda7432", addrs)) | 3615 | &btv->c.i2c_adap, "tda7432", "tda7432", 0, addrs)) |
3616 | return; | 3616 | return; |
3617 | } | 3617 | } |
3618 | 3618 | ||
3619 | /* Now see if we can find one of the tvaudio devices. */ | 3619 | /* Now see if we can find one of the tvaudio devices. */ |
3620 | btv->sd_tvaudio = v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev, | 3620 | btv->sd_tvaudio = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3621 | &btv->c.i2c_adap, "tvaudio", "tvaudio", tvaudio_addrs()); | 3621 | &btv->c.i2c_adap, "tvaudio", "tvaudio", 0, tvaudio_addrs()); |
3622 | if (btv->sd_tvaudio) | 3622 | if (btv->sd_tvaudio) |
3623 | return; | 3623 | return; |
3624 | 3624 | ||
@@ -3641,15 +3641,15 @@ void __devinit bttv_init_tuner(struct bttv *btv) | |||
3641 | 3641 | ||
3642 | /* Load tuner module before issuing tuner config call! */ | 3642 | /* Load tuner module before issuing tuner config call! */ |
3643 | if (bttv_tvcards[btv->c.type].has_radio) | 3643 | if (bttv_tvcards[btv->c.type].has_radio) |
3644 | v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev, | 3644 | v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3645 | &btv->c.i2c_adap, "tuner", "tuner", | 3645 | &btv->c.i2c_adap, "tuner", "tuner", |
3646 | v4l2_i2c_tuner_addrs(ADDRS_RADIO)); | 3646 | 0, v4l2_i2c_tuner_addrs(ADDRS_RADIO)); |
3647 | v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev, | 3647 | v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3648 | &btv->c.i2c_adap, "tuner", "tuner", | 3648 | &btv->c.i2c_adap, "tuner", "tuner", |
3649 | v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 3649 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); |
3650 | v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev, | 3650 | v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3651 | &btv->c.i2c_adap, "tuner", "tuner", | 3651 | &btv->c.i2c_adap, "tuner", "tuner", |
3652 | v4l2_i2c_tuner_addrs(ADDRS_TV_WITH_DEMOD)); | 3652 | 0, v4l2_i2c_tuner_addrs(ADDRS_TV_WITH_DEMOD)); |
3653 | 3653 | ||
3654 | tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; | 3654 | tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; |
3655 | tun_setup.type = btv->tuner_type; | 3655 | tun_setup.type = btv->tuner_type; |
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index 9c149a781294..657c481d255c 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c | |||
@@ -1955,7 +1955,7 @@ static int cafe_pci_probe(struct pci_dev *pdev, | |||
1955 | 1955 | ||
1956 | cam->sensor_addr = 0x42; | 1956 | cam->sensor_addr = 0x42; |
1957 | cam->sensor = v4l2_i2c_new_subdev(&cam->v4l2_dev, &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, NULL); |
1959 | if (cam->sensor == NULL) { | 1959 | if (cam->sensor == NULL) { |
1960 | ret = -ENODEV; | 1960 | ret = -ENODEV; |
1961 | goto out_smbus; | 1961 | goto out_smbus; |
diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c index dbbf93d2eee0..2477461e84d7 100644 --- a/drivers/media/video/cx18/cx18-i2c.c +++ b/drivers/media/video/cx18/cx18-i2c.c | |||
@@ -139,16 +139,16 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx) | |||
139 | 139 | ||
140 | if (hw == CX18_HW_TUNER) { | 140 | if (hw == CX18_HW_TUNER) { |
141 | /* special tuner group handling */ | 141 | /* special tuner group handling */ |
142 | sd = v4l2_i2c_new_probed_subdev(&cx->v4l2_dev, | 142 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, |
143 | adap, mod, type, cx->card_i2c->radio); | 143 | adap, mod, type, 0, cx->card_i2c->radio); |
144 | if (sd != NULL) | 144 | if (sd != NULL) |
145 | sd->grp_id = hw; | 145 | sd->grp_id = hw; |
146 | sd = v4l2_i2c_new_probed_subdev(&cx->v4l2_dev, | 146 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, |
147 | adap, mod, type, cx->card_i2c->demod); | 147 | adap, mod, type, 0, cx->card_i2c->demod); |
148 | if (sd != NULL) | 148 | if (sd != NULL) |
149 | sd->grp_id = hw; | 149 | sd->grp_id = hw; |
150 | sd = v4l2_i2c_new_probed_subdev(&cx->v4l2_dev, | 150 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, |
151 | adap, mod, type, cx->card_i2c->tv); | 151 | adap, mod, type, 0, cx->card_i2c->tv); |
152 | if (sd != NULL) | 152 | if (sd != NULL) |
153 | sd->grp_id = hw; | 153 | sd->grp_id = hw; |
154 | return sd != NULL ? 0 : -1; | 154 | return sd != NULL ? 0 : -1; |
@@ -162,7 +162,7 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx) | |||
162 | return -1; | 162 | return -1; |
163 | 163 | ||
164 | /* It's an I2C device other than an analog tuner or IR chip */ | 164 | /* It's an I2C device other than an analog tuner or IR chip */ |
165 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, adap, mod, type, hw_addrs[idx]); | 165 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, adap, mod, type, hw_addrs[idx], NULL); |
166 | if (sd != NULL) | 166 | if (sd != NULL) |
167 | sd->grp_id = hw; | 167 | sd->grp_id = hw; |
168 | return sd != NULL ? 0 : -1; | 168 | return sd != NULL ? 0 : -1; |
diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c index 63d2239fd324..319c459459e0 100644 --- a/drivers/media/video/cx231xx/cx231xx-cards.c +++ b/drivers/media/video/cx231xx/cx231xx-cards.c | |||
@@ -313,7 +313,7 @@ void cx231xx_card_setup(struct cx231xx *dev) | |||
313 | if (dev->board.decoder == CX231XX_AVDECODER) { | 313 | if (dev->board.decoder == CX231XX_AVDECODER) { |
314 | dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 314 | dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
315 | &dev->i2c_bus[0].i2c_adap, | 315 | &dev->i2c_bus[0].i2c_adap, |
316 | "cx25840", "cx25840", 0x88 >> 1); | 316 | "cx25840", "cx25840", 0x88 >> 1, NULL); |
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"); |
319 | cx25840_call(dev, core, load_fw); | 319 | cx25840_call(dev, core, load_fw); |
@@ -323,7 +323,7 @@ void cx231xx_card_setup(struct cx231xx *dev) | |||
323 | if (dev->board.tuner_type != TUNER_ABSENT) { | 323 | if (dev->board.tuner_type != TUNER_ABSENT) { |
324 | dev->sd_tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 324 | dev->sd_tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
325 | &dev->i2c_bus[1].i2c_adap, | 325 | &dev->i2c_bus[1].i2c_adap, |
326 | "tuner", "tuner", 0xc2 >> 1); | 326 | "tuner", "tuner", 0xc2 >> 1, NULL); |
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"); |
329 | 329 | ||
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c index 3143d85ef31d..02ba4aec7d92 100644 --- a/drivers/media/video/cx23885/cx23885-cards.c +++ b/drivers/media/video/cx23885/cx23885-cards.c | |||
@@ -929,7 +929,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) | |||
929 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: | 929 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: |
930 | dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 930 | dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
931 | &dev->i2c_bus[2].i2c_adap, | 931 | &dev->i2c_bus[2].i2c_adap, |
932 | "cx25840", "cx25840", 0x88 >> 1); | 932 | "cx25840", "cx25840", 0x88 >> 1, NULL); |
933 | v4l2_subdev_call(dev->sd_cx25840, core, load_fw); | 933 | v4l2_subdev_call(dev->sd_cx25840, core, load_fw); |
934 | break; | 934 | break; |
935 | } | 935 | } |
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index 5d6093336300..654cc253cd50 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c | |||
@@ -1521,11 +1521,11 @@ int cx23885_video_register(struct cx23885_dev *dev) | |||
1521 | if (dev->tuner_addr) | 1521 | if (dev->tuner_addr) |
1522 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 1522 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
1523 | &dev->i2c_bus[1].i2c_adap, | 1523 | &dev->i2c_bus[1].i2c_adap, |
1524 | "tuner", "tuner", dev->tuner_addr); | 1524 | "tuner", "tuner", dev->tuner_addr, NULL); |
1525 | else | 1525 | else |
1526 | sd = v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, | 1526 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
1527 | &dev->i2c_bus[1].i2c_adap, | 1527 | &dev->i2c_bus[1].i2c_adap, |
1528 | "tuner", "tuner", v4l2_i2c_tuner_addrs(ADDRS_TV)); | 1528 | "tuner", "tuner", 0, v4l2_i2c_tuner_addrs(ADDRS_TV)); |
1529 | if (sd) { | 1529 | if (sd) { |
1530 | struct tuner_setup tun_setup; | 1530 | struct tuner_setup tun_setup; |
1531 | 1531 | ||
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index e5f07fbd5a35..33be6369871a 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c | |||
@@ -3439,20 +3439,20 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr) | |||
3439 | The radio_type is sometimes missing, or set to UNSET but | 3439 | The radio_type is sometimes missing, or set to UNSET but |
3440 | later code configures a tea5767. | 3440 | later code configures a tea5767. |
3441 | */ | 3441 | */ |
3442 | v4l2_i2c_new_probed_subdev(&core->v4l2_dev, &core->i2c_adap, | 3442 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, |
3443 | "tuner", "tuner", | 3443 | "tuner", "tuner", |
3444 | v4l2_i2c_tuner_addrs(ADDRS_RADIO)); | 3444 | 0, v4l2_i2c_tuner_addrs(ADDRS_RADIO)); |
3445 | if (has_demod) | 3445 | if (has_demod) |
3446 | v4l2_i2c_new_probed_subdev(&core->v4l2_dev, | 3446 | v4l2_i2c_new_subdev(&core->v4l2_dev, |
3447 | &core->i2c_adap, "tuner", "tuner", | 3447 | &core->i2c_adap, "tuner", "tuner", |
3448 | v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 3448 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); |
3449 | if (core->board.tuner_addr == ADDR_UNSET) { | 3449 | if (core->board.tuner_addr == ADDR_UNSET) { |
3450 | v4l2_i2c_new_probed_subdev(&core->v4l2_dev, | 3450 | v4l2_i2c_new_subdev(&core->v4l2_dev, |
3451 | &core->i2c_adap, "tuner", "tuner", | 3451 | &core->i2c_adap, "tuner", "tuner", |
3452 | has_demod ? tv_addrs + 4 : tv_addrs); | 3452 | 0, has_demod ? tv_addrs + 4 : tv_addrs); |
3453 | } else { | 3453 | } else { |
3454 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, | 3454 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, |
3455 | "tuner", "tuner", core->board.tuner_addr); | 3455 | "tuner", "tuner", core->board.tuner_addr, NULL); |
3456 | } | 3456 | } |
3457 | } | 3457 | } |
3458 | 3458 | ||
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 2bb54c3ef5cd..81d2b5dea18e 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -1881,14 +1881,14 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, | |||
1881 | 1881 | ||
1882 | if (core->board.audio_chip == V4L2_IDENT_WM8775) | 1882 | if (core->board.audio_chip == V4L2_IDENT_WM8775) |
1883 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, | 1883 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, |
1884 | "wm8775", "wm8775", 0x36 >> 1); | 1884 | "wm8775", "wm8775", 0x36 >> 1, NULL); |
1885 | 1885 | ||
1886 | if (core->board.audio_chip == V4L2_IDENT_TVAUDIO) { | 1886 | if (core->board.audio_chip == V4L2_IDENT_TVAUDIO) { |
1887 | /* This probes for a tda9874 as is used on some | 1887 | /* This probes for a tda9874 as is used on some |
1888 | Pixelview Ultra boards. */ | 1888 | Pixelview Ultra boards. */ |
1889 | v4l2_i2c_new_probed_subdev_addr(&core->v4l2_dev, | 1889 | v4l2_i2c_new_subdev(&core->v4l2_dev, |
1890 | &core->i2c_adap, | 1890 | &core->i2c_adap, |
1891 | "tvaudio", "tvaudio", 0xb0 >> 1); | 1891 | "tvaudio", "tvaudio", 0, I2C_ADDRS(0xb0 >> 1)); |
1892 | } | 1892 | } |
1893 | 1893 | ||
1894 | switch (core->boardnr) { | 1894 | switch (core->boardnr) { |
diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c index 8ea65d794dbf..a125a452d24b 100644 --- a/drivers/media/video/davinci/vpif_display.c +++ b/drivers/media/video/davinci/vpif_display.c | |||
@@ -1566,10 +1566,10 @@ static __init int vpif_probe(struct platform_device *pdev) | |||
1566 | } | 1566 | } |
1567 | 1567 | ||
1568 | for (i = 0; i < subdev_count; i++) { | 1568 | for (i = 0; i < subdev_count; i++) { |
1569 | vpif_obj.sd[i] = v4l2_i2c_new_probed_subdev(&vpif_obj.v4l2_dev, | 1569 | vpif_obj.sd[i] = v4l2_i2c_new_subdev(&vpif_obj.v4l2_dev, |
1570 | i2c_adap, subdevdata[i].name, | 1570 | i2c_adap, subdevdata[i].name, |
1571 | subdevdata[i].name, | 1571 | subdevdata[i].name, |
1572 | &subdevdata[i].addr); | 1572 | 0, I2C_ADDRS(subdevdata[i].addr)); |
1573 | if (!vpif_obj.sd[i]) { | 1573 | if (!vpif_obj.sd[i]) { |
1574 | vpif_err("Error registering v4l2 subdevice\n"); | 1574 | vpif_err("Error registering v4l2 subdevice\n"); |
1575 | goto probe_subdev_out; | 1575 | goto probe_subdev_out; |
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 8a5ce818170a..bdb249bd9d5d 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -2372,55 +2372,55 @@ void em28xx_card_setup(struct em28xx *dev) | |||
2372 | 2372 | ||
2373 | /* request some modules */ | 2373 | /* request some modules */ |
2374 | if (dev->board.has_msp34xx) | 2374 | if (dev->board.has_msp34xx) |
2375 | v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2375 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2376 | "msp3400", "msp3400", msp3400_addrs); | 2376 | "msp3400", "msp3400", 0, msp3400_addrs); |
2377 | 2377 | ||
2378 | if (dev->board.decoder == EM28XX_SAA711X) | 2378 | if (dev->board.decoder == EM28XX_SAA711X) |
2379 | v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2379 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2380 | "saa7115", "saa7115_auto", saa711x_addrs); | 2380 | "saa7115", "saa7115_auto", 0, saa711x_addrs); |
2381 | 2381 | ||
2382 | if (dev->board.decoder == EM28XX_TVP5150) | 2382 | if (dev->board.decoder == EM28XX_TVP5150) |
2383 | v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2383 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2384 | "tvp5150", "tvp5150", tvp5150_addrs); | 2384 | "tvp5150", "tvp5150", 0, tvp5150_addrs); |
2385 | 2385 | ||
2386 | if (dev->em28xx_sensor == EM28XX_MT9V011) { | 2386 | if (dev->em28xx_sensor == EM28XX_MT9V011) { |
2387 | struct v4l2_subdev *sd; | 2387 | struct v4l2_subdev *sd; |
2388 | 2388 | ||
2389 | sd = v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, | 2389 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
2390 | &dev->i2c_adap, "mt9v011", "mt9v011", mt9v011_addrs); | 2390 | &dev->i2c_adap, "mt9v011", "mt9v011", 0, mt9v011_addrs); |
2391 | v4l2_subdev_call(sd, core, s_config, 0, &dev->sensor_xtal); | 2391 | v4l2_subdev_call(sd, core, s_config, 0, &dev->sensor_xtal); |
2392 | } | 2392 | } |
2393 | 2393 | ||
2394 | 2394 | ||
2395 | if (dev->board.adecoder == EM28XX_TVAUDIO) | 2395 | if (dev->board.adecoder == EM28XX_TVAUDIO) |
2396 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2396 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2397 | "tvaudio", "tvaudio", dev->board.tvaudio_addr); | 2397 | "tvaudio", "tvaudio", dev->board.tvaudio_addr, NULL); |
2398 | 2398 | ||
2399 | if (dev->board.tuner_type != TUNER_ABSENT) { | 2399 | if (dev->board.tuner_type != TUNER_ABSENT) { |
2400 | int has_demod = (dev->tda9887_conf & TDA9887_PRESENT); | 2400 | int has_demod = (dev->tda9887_conf & TDA9887_PRESENT); |
2401 | 2401 | ||
2402 | if (dev->board.radio.type) | 2402 | if (dev->board.radio.type) |
2403 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2403 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2404 | "tuner", "tuner", dev->board.radio_addr); | 2404 | "tuner", "tuner", dev->board.radio_addr, NULL); |
2405 | 2405 | ||
2406 | if (has_demod) | 2406 | if (has_demod) |
2407 | v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, | 2407 | v4l2_i2c_new_subdev(&dev->v4l2_dev, |
2408 | &dev->i2c_adap, "tuner", "tuner", | 2408 | &dev->i2c_adap, "tuner", "tuner", |
2409 | v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 2409 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); |
2410 | if (dev->tuner_addr == 0) { | 2410 | if (dev->tuner_addr == 0) { |
2411 | enum v4l2_i2c_tuner_type type = | 2411 | enum v4l2_i2c_tuner_type type = |
2412 | has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; | 2412 | has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; |
2413 | struct v4l2_subdev *sd; | 2413 | struct v4l2_subdev *sd; |
2414 | 2414 | ||
2415 | sd = v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, | 2415 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
2416 | &dev->i2c_adap, "tuner", "tuner", | 2416 | &dev->i2c_adap, "tuner", "tuner", |
2417 | v4l2_i2c_tuner_addrs(type)); | 2417 | 0, v4l2_i2c_tuner_addrs(type)); |
2418 | 2418 | ||
2419 | if (sd) | 2419 | if (sd) |
2420 | dev->tuner_addr = v4l2_i2c_subdev_addr(sd); | 2420 | dev->tuner_addr = v4l2_i2c_subdev_addr(sd); |
2421 | } else { | 2421 | } else { |
2422 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2422 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2423 | "tuner", "tuner", dev->tuner_addr); | 2423 | "tuner", "tuner", dev->tuner_addr, NULL); |
2424 | } | 2424 | } |
2425 | } | 2425 | } |
2426 | 2426 | ||
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index 8f15a31d3f66..b9c71e61f7d6 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.c +++ b/drivers/media/video/ivtv/ivtv-i2c.c | |||
@@ -161,19 +161,19 @@ 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(&itv->v4l2_dev, | 164 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, |
165 | adap, mod, type, | 165 | adap, mod, type, |
166 | itv->card_i2c->radio); | 166 | 0, itv->card_i2c->radio); |
167 | if (sd) | 167 | if (sd) |
168 | sd->grp_id = 1 << idx; | 168 | sd->grp_id = 1 << idx; |
169 | sd = v4l2_i2c_new_probed_subdev(&itv->v4l2_dev, | 169 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, |
170 | adap, mod, type, | 170 | adap, mod, type, |
171 | itv->card_i2c->demod); | 171 | 0, itv->card_i2c->demod); |
172 | if (sd) | 172 | if (sd) |
173 | sd->grp_id = 1 << idx; | 173 | sd->grp_id = 1 << idx; |
174 | sd = v4l2_i2c_new_probed_subdev(&itv->v4l2_dev, | 174 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, |
175 | adap, mod, type, | 175 | adap, mod, type, |
176 | itv->card_i2c->tv); | 176 | 0, itv->card_i2c->tv); |
177 | if (sd) | 177 | if (sd) |
178 | sd->grp_id = 1 << idx; | 178 | sd->grp_id = 1 << idx; |
179 | return sd ? 0 : -1; | 179 | return sd ? 0 : -1; |
@@ -181,11 +181,11 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx) | |||
181 | if (!hw_addrs[idx]) | 181 | if (!hw_addrs[idx]) |
182 | return -1; | 182 | return -1; |
183 | if (hw == IVTV_HW_UPD64031A || hw == IVTV_HW_UPD6408X) { | 183 | if (hw == IVTV_HW_UPD64031A || hw == IVTV_HW_UPD6408X) { |
184 | sd = v4l2_i2c_new_probed_subdev_addr(&itv->v4l2_dev, | 184 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, |
185 | adap, mod, type, hw_addrs[idx]); | 185 | adap, mod, type, 0, I2C_ADDRS(hw_addrs[idx])); |
186 | } else { | 186 | } else { |
187 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, | 187 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, |
188 | adap, mod, type, hw_addrs[idx]); | 188 | adap, mod, type, hw_addrs[idx], NULL); |
189 | } | 189 | } |
190 | if (sd) | 190 | if (sd) |
191 | sd->grp_id = 1 << idx; | 191 | sd->grp_id = 1 << idx; |
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c index 35890e8b2431..3454070e63f0 100644 --- a/drivers/media/video/mxb.c +++ b/drivers/media/video/mxb.c | |||
@@ -186,19 +186,19 @@ static int mxb_probe(struct saa7146_dev *dev) | |||
186 | } | 186 | } |
187 | 187 | ||
188 | mxb->saa7111a = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | 188 | mxb->saa7111a = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
189 | "saa7115", "saa7111", I2C_SAA7111A); | 189 | "saa7115", "saa7111", I2C_SAA7111A, NULL); |
190 | mxb->tea6420_1 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | 190 | mxb->tea6420_1 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
191 | "tea6420", "tea6420", I2C_TEA6420_1); | 191 | "tea6420", "tea6420", I2C_TEA6420_1, NULL); |
192 | mxb->tea6420_2 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | 192 | mxb->tea6420_2 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
193 | "tea6420", "tea6420", I2C_TEA6420_2); | 193 | "tea6420", "tea6420", I2C_TEA6420_2, NULL); |
194 | mxb->tea6415c = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | 194 | mxb->tea6415c = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
195 | "tea6415c", "tea6415c", I2C_TEA6415C); | 195 | "tea6415c", "tea6415c", I2C_TEA6415C, NULL); |
196 | mxb->tda9840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | 196 | mxb->tda9840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
197 | "tda9840", "tda9840", I2C_TDA9840); | 197 | "tda9840", "tda9840", I2C_TDA9840, NULL); |
198 | mxb->tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | 198 | mxb->tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
199 | "tuner", "tuner", I2C_TUNER); | 199 | "tuner", "tuner", I2C_TUNER, NULL); |
200 | if (v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | 200 | if (v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
201 | "saa5246a", "saa5246a", I2C_SAA5246A)) { | 201 | "saa5246a", "saa5246a", I2C_SAA5246A, NULL)) { |
202 | printk(KERN_INFO "mxb: found teletext decoder\n"); | 202 | printk(KERN_INFO "mxb: found teletext decoder\n"); |
203 | } | 203 | } |
204 | 204 | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index cbc388729d77..13639b302700 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -2063,8 +2063,8 @@ static int pvr2_hdw_load_subdev(struct pvr2_hdw *hdw, | |||
2063 | return -EINVAL; | 2063 | return -EINVAL; |
2064 | } | 2064 | } |
2065 | 2065 | ||
2066 | /* Note how the 2nd and 3rd arguments are the same for both | 2066 | /* Note how the 2nd and 3rd arguments are the same for |
2067 | * v4l2_i2c_new_subdev() and v4l2_i2c_new_probed_subdev(). Why? | 2067 | * v4l2_i2c_new_subdev(). Why? |
2068 | * Well the 2nd argument is the module name to load, while the 3rd | 2068 | * Well the 2nd argument is the module name to load, while the 3rd |
2069 | * argument is documented in the framework as being the "chipid" - | 2069 | * argument is documented in the framework as being the "chipid" - |
2070 | * and every other place where I can find examples of this, the | 2070 | * and every other place where I can find examples of this, the |
@@ -2077,15 +2077,15 @@ static int pvr2_hdw_load_subdev(struct pvr2_hdw *hdw, | |||
2077 | mid, i2caddr[0]); | 2077 | mid, i2caddr[0]); |
2078 | sd = v4l2_i2c_new_subdev(&hdw->v4l2_dev, &hdw->i2c_adap, | 2078 | sd = v4l2_i2c_new_subdev(&hdw->v4l2_dev, &hdw->i2c_adap, |
2079 | fname, fname, | 2079 | fname, fname, |
2080 | i2caddr[0]); | 2080 | i2caddr[0], NULL); |
2081 | } else { | 2081 | } else { |
2082 | pvr2_trace(PVR2_TRACE_INIT, | 2082 | pvr2_trace(PVR2_TRACE_INIT, |
2083 | "Module ID %u:" | 2083 | "Module ID %u:" |
2084 | " Setting up with address probe list", | 2084 | " Setting up with address probe list", |
2085 | mid); | 2085 | mid); |
2086 | sd = v4l2_i2c_new_probed_subdev(&hdw->v4l2_dev, &hdw->i2c_adap, | 2086 | sd = v4l2_i2c_new_subdev(&hdw->v4l2_dev, &hdw->i2c_adap, |
2087 | fname, fname, | 2087 | fname, fname, |
2088 | i2caddr); | 2088 | 0, i2caddr); |
2089 | } | 2089 | } |
2090 | 2090 | ||
2091 | if (!sd) { | 2091 | if (!sd) { |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 1b29487fd254..14b9ba4579b7 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -7208,22 +7208,22 @@ int saa7134_board_init2(struct saa7134_dev *dev) | |||
7208 | if (dev->radio_type != UNSET) | 7208 | if (dev->radio_type != UNSET) |
7209 | v4l2_i2c_new_subdev(&dev->v4l2_dev, | 7209 | v4l2_i2c_new_subdev(&dev->v4l2_dev, |
7210 | &dev->i2c_adap, "tuner", "tuner", | 7210 | &dev->i2c_adap, "tuner", "tuner", |
7211 | dev->radio_addr); | 7211 | dev->radio_addr, NULL); |
7212 | if (has_demod) | 7212 | if (has_demod) |
7213 | v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, | 7213 | v4l2_i2c_new_subdev(&dev->v4l2_dev, |
7214 | &dev->i2c_adap, "tuner", "tuner", | 7214 | &dev->i2c_adap, "tuner", "tuner", |
7215 | v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 7215 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); |
7216 | if (dev->tuner_addr == ADDR_UNSET) { | 7216 | if (dev->tuner_addr == ADDR_UNSET) { |
7217 | enum v4l2_i2c_tuner_type type = | 7217 | enum v4l2_i2c_tuner_type type = |
7218 | has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; | 7218 | has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; |
7219 | 7219 | ||
7220 | v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, | 7220 | v4l2_i2c_new_subdev(&dev->v4l2_dev, |
7221 | &dev->i2c_adap, "tuner", "tuner", | 7221 | &dev->i2c_adap, "tuner", "tuner", |
7222 | v4l2_i2c_tuner_addrs(type)); | 7222 | 0, v4l2_i2c_tuner_addrs(type)); |
7223 | } else { | 7223 | } else { |
7224 | v4l2_i2c_new_subdev(&dev->v4l2_dev, | 7224 | v4l2_i2c_new_subdev(&dev->v4l2_dev, |
7225 | &dev->i2c_adap, "tuner", "tuner", | 7225 | &dev->i2c_adap, "tuner", "tuner", |
7226 | dev->tuner_addr); | 7226 | dev->tuner_addr, NULL); |
7227 | } | 7227 | } |
7228 | } | 7228 | } |
7229 | 7229 | ||
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index cb78c956d810..f87757fccc72 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -1000,7 +1000,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
1000 | struct v4l2_subdev *sd = | 1000 | struct v4l2_subdev *sd = |
1001 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 1001 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
1002 | "saa6752hs", "saa6752hs", | 1002 | "saa6752hs", "saa6752hs", |
1003 | saa7134_boards[dev->board].empress_addr); | 1003 | saa7134_boards[dev->board].empress_addr, NULL); |
1004 | 1004 | ||
1005 | if (sd) | 1005 | if (sd) |
1006 | sd->grp_id = GRP_EMPRESS; | 1006 | sd->grp_id = GRP_EMPRESS; |
@@ -1009,9 +1009,9 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
1009 | if (saa7134_boards[dev->board].rds_addr) { | 1009 | if (saa7134_boards[dev->board].rds_addr) { |
1010 | struct v4l2_subdev *sd; | 1010 | struct v4l2_subdev *sd; |
1011 | 1011 | ||
1012 | sd = v4l2_i2c_new_probed_subdev_addr(&dev->v4l2_dev, | 1012 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
1013 | &dev->i2c_adap, "saa6588", "saa6588", | 1013 | &dev->i2c_adap, "saa6588", "saa6588", |
1014 | saa7134_boards[dev->board].rds_addr); | 1014 | 0, I2C_ADDRS(saa7134_boards[dev->board].rds_addr)); |
1015 | if (sd) { | 1015 | if (sd) { |
1016 | printk(KERN_INFO "%s: found RDS decoder\n", dev->name); | 1016 | printk(KERN_INFO "%s: found RDS decoder\n", dev->name); |
1017 | dev->has_rds = 1; | 1017 | dev->has_rds = 1; |
diff --git a/drivers/media/video/usbvision/usbvision-i2c.c b/drivers/media/video/usbvision/usbvision-i2c.c index 1fe5befbbf85..f97fd06d5948 100644 --- a/drivers/media/video/usbvision/usbvision-i2c.c +++ b/drivers/media/video/usbvision/usbvision-i2c.c | |||
@@ -246,9 +246,9 @@ int usbvision_i2c_register(struct usb_usbvision *usbvision) | |||
246 | switch (usbvision_device_data[usbvision->DevModel].Codec) { | 246 | switch (usbvision_device_data[usbvision->DevModel].Codec) { |
247 | case CODEC_SAA7113: | 247 | case CODEC_SAA7113: |
248 | case CODEC_SAA7111: | 248 | case CODEC_SAA7111: |
249 | v4l2_i2c_new_probed_subdev(&usbvision->v4l2_dev, | 249 | v4l2_i2c_new_subdev(&usbvision->v4l2_dev, |
250 | &usbvision->i2c_adap, "saa7115", | 250 | &usbvision->i2c_adap, "saa7115", |
251 | "saa7115_auto", saa711x_addrs); | 251 | "saa7115_auto", 0, saa711x_addrs); |
252 | break; | 252 | break; |
253 | } | 253 | } |
254 | if (usbvision_device_data[usbvision->DevModel].Tuner == 1) { | 254 | if (usbvision_device_data[usbvision->DevModel].Tuner == 1) { |
@@ -256,16 +256,16 @@ int usbvision_i2c_register(struct usb_usbvision *usbvision) | |||
256 | enum v4l2_i2c_tuner_type type; | 256 | enum v4l2_i2c_tuner_type type; |
257 | struct tuner_setup tun_setup; | 257 | struct tuner_setup tun_setup; |
258 | 258 | ||
259 | sd = v4l2_i2c_new_probed_subdev(&usbvision->v4l2_dev, | 259 | sd = v4l2_i2c_new_subdev(&usbvision->v4l2_dev, |
260 | &usbvision->i2c_adap, "tuner", | 260 | &usbvision->i2c_adap, "tuner", |
261 | "tuner", v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 261 | "tuner", 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); |
262 | /* depending on whether we found a demod or not, select | 262 | /* depending on whether we found a demod or not, select |
263 | the tuner type. */ | 263 | the tuner type. */ |
264 | type = sd ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; | 264 | type = sd ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; |
265 | 265 | ||
266 | sd = v4l2_i2c_new_probed_subdev(&usbvision->v4l2_dev, | 266 | sd = v4l2_i2c_new_subdev(&usbvision->v4l2_dev, |
267 | &usbvision->i2c_adap, "tuner", | 267 | &usbvision->i2c_adap, "tuner", |
268 | "tuner", v4l2_i2c_tuner_addrs(type)); | 268 | "tuner", 0, v4l2_i2c_tuner_addrs(type)); |
269 | 269 | ||
270 | if (usbvision->tuner_type != -1) { | 270 | if (usbvision->tuner_type != -1) { |
271 | tun_setup.mode_mask = T_ANALOG_TV | T_RADIO; | 271 | tun_setup.mode_mask = T_ANALOG_TV | T_RADIO; |
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 3a0c64935b0e..f5a93ae3cdf9 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -814,139 +814,6 @@ EXPORT_SYMBOL_GPL(v4l2_i2c_subdev_init); | |||
814 | 814 | ||
815 | 815 | ||
816 | /* Load an i2c sub-device. */ | 816 | /* Load an i2c sub-device. */ |
817 | struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev, | ||
818 | struct i2c_adapter *adapter, | ||
819 | const char *module_name, const char *client_type, u8 addr) | ||
820 | { | ||
821 | struct v4l2_subdev *sd = NULL; | ||
822 | struct i2c_client *client; | ||
823 | struct i2c_board_info info; | ||
824 | |||
825 | BUG_ON(!v4l2_dev); | ||
826 | |||
827 | if (module_name) | ||
828 | request_module(module_name); | ||
829 | |||
830 | /* Setup the i2c board info with the device type and | ||
831 | the device address. */ | ||
832 | memset(&info, 0, sizeof(info)); | ||
833 | strlcpy(info.type, client_type, sizeof(info.type)); | ||
834 | info.addr = addr; | ||
835 | |||
836 | /* Create the i2c client */ | ||
837 | client = i2c_new_device(adapter, &info); | ||
838 | /* Note: it is possible in the future that | ||
839 | c->driver is NULL if the driver is still being loaded. | ||
840 | We need better support from the kernel so that we | ||
841 | can easily wait for the load to finish. */ | ||
842 | if (client == NULL || client->driver == NULL) | ||
843 | goto error; | ||
844 | |||
845 | /* Lock the module so we can safely get the v4l2_subdev pointer */ | ||
846 | if (!try_module_get(client->driver->driver.owner)) | ||
847 | goto error; | ||
848 | sd = i2c_get_clientdata(client); | ||
849 | |||
850 | /* Register with the v4l2_device which increases the module's | ||
851 | use count as well. */ | ||
852 | if (v4l2_device_register_subdev(v4l2_dev, sd)) | ||
853 | sd = NULL; | ||
854 | /* Decrease the module use count to match the first try_module_get. */ | ||
855 | module_put(client->driver->driver.owner); | ||
856 | |||
857 | if (sd) { | ||
858 | /* We return errors from v4l2_subdev_call only if we have the | ||
859 | callback as the .s_config is not mandatory */ | ||
860 | int err = v4l2_subdev_call(sd, core, s_config, 0, NULL); | ||
861 | |||
862 | if (err && err != -ENOIOCTLCMD) { | ||
863 | v4l2_device_unregister_subdev(sd); | ||
864 | sd = NULL; | ||
865 | } | ||
866 | } | ||
867 | |||
868 | error: | ||
869 | /* If we have a client but no subdev, then something went wrong and | ||
870 | we must unregister the client. */ | ||
871 | if (client && sd == NULL) | ||
872 | i2c_unregister_device(client); | ||
873 | return sd; | ||
874 | } | ||
875 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev); | ||
876 | |||
877 | /* Probe and load an i2c sub-device. */ | ||
878 | struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct v4l2_device *v4l2_dev, | ||
879 | struct i2c_adapter *adapter, | ||
880 | const char *module_name, const char *client_type, | ||
881 | const unsigned short *addrs) | ||
882 | { | ||
883 | struct v4l2_subdev *sd = NULL; | ||
884 | struct i2c_client *client = NULL; | ||
885 | struct i2c_board_info info; | ||
886 | |||
887 | BUG_ON(!v4l2_dev); | ||
888 | |||
889 | if (module_name) | ||
890 | request_module(module_name); | ||
891 | |||
892 | /* Setup the i2c board info with the device type and | ||
893 | the device address. */ | ||
894 | memset(&info, 0, sizeof(info)); | ||
895 | strlcpy(info.type, client_type, sizeof(info.type)); | ||
896 | |||
897 | /* Probe and create the i2c client */ | ||
898 | client = i2c_new_probed_device(adapter, &info, addrs); | ||
899 | /* Note: it is possible in the future that | ||
900 | c->driver is NULL if the driver is still being loaded. | ||
901 | We need better support from the kernel so that we | ||
902 | can easily wait for the load to finish. */ | ||
903 | if (client == NULL || client->driver == NULL) | ||
904 | goto error; | ||
905 | |||
906 | /* Lock the module so we can safely get the v4l2_subdev pointer */ | ||
907 | if (!try_module_get(client->driver->driver.owner)) | ||
908 | goto error; | ||
909 | sd = i2c_get_clientdata(client); | ||
910 | |||
911 | /* Register with the v4l2_device which increases the module's | ||
912 | use count as well. */ | ||
913 | if (v4l2_device_register_subdev(v4l2_dev, sd)) | ||
914 | sd = NULL; | ||
915 | /* Decrease the module use count to match the first try_module_get. */ | ||
916 | module_put(client->driver->driver.owner); | ||
917 | |||
918 | if (sd) { | ||
919 | /* We return errors from v4l2_subdev_call only if we have the | ||
920 | callback as the .s_config is not mandatory */ | ||
921 | int err = v4l2_subdev_call(sd, core, s_config, 0, NULL); | ||
922 | |||
923 | if (err && err != -ENOIOCTLCMD) { | ||
924 | v4l2_device_unregister_subdev(sd); | ||
925 | sd = NULL; | ||
926 | } | ||
927 | } | ||
928 | |||
929 | error: | ||
930 | /* If we have a client but no subdev, then something went wrong and | ||
931 | we must unregister the client. */ | ||
932 | if (client && sd == NULL) | ||
933 | i2c_unregister_device(client); | ||
934 | return sd; | ||
935 | } | ||
936 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_probed_subdev); | ||
937 | |||
938 | struct v4l2_subdev *v4l2_i2c_new_probed_subdev_addr(struct v4l2_device *v4l2_dev, | ||
939 | struct i2c_adapter *adapter, | ||
940 | const char *module_name, const char *client_type, u8 addr) | ||
941 | { | ||
942 | unsigned short addrs[2] = { addr, I2C_CLIENT_END }; | ||
943 | |||
944 | return v4l2_i2c_new_probed_subdev(v4l2_dev, adapter, | ||
945 | module_name, client_type, addrs); | ||
946 | } | ||
947 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_probed_subdev_addr); | ||
948 | |||
949 | /* Load an i2c sub-device. */ | ||
950 | struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev, | 817 | struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev, |
951 | struct i2c_adapter *adapter, const char *module_name, | 818 | struct i2c_adapter *adapter, const char *module_name, |
952 | struct i2c_board_info *info, const unsigned short *probe_addrs) | 819 | struct i2c_board_info *info, const unsigned short *probe_addrs) |
diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c index f3b6e15d91f2..cd6a3446ab7e 100644 --- a/drivers/media/video/vino.c +++ b/drivers/media/video/vino.c | |||
@@ -4333,11 +4333,11 @@ static int __init vino_module_init(void) | |||
4333 | vino_init_stage++; | 4333 | vino_init_stage++; |
4334 | 4334 | ||
4335 | vino_drvdata->decoder = | 4335 | vino_drvdata->decoder = |
4336 | v4l2_i2c_new_probed_subdev_addr(&vino_drvdata->v4l2_dev, | 4336 | v4l2_i2c_new_subdev(&vino_drvdata->v4l2_dev, &vino_i2c_adapter, |
4337 | &vino_i2c_adapter, "saa7191", "saa7191", 0x45); | 4337 | "saa7191", "saa7191", 0, I2C_ADDRS(0x45)); |
4338 | vino_drvdata->camera = | 4338 | vino_drvdata->camera = |
4339 | v4l2_i2c_new_probed_subdev_addr(&vino_drvdata->v4l2_dev, | 4339 | v4l2_i2c_new_subdev(&vino_drvdata->v4l2_dev, &vino_i2c_adapter, |
4340 | &vino_i2c_adapter, "indycam", "indycam", 0x2b); | 4340 | "indycam", "indycam", 0, I2C_ADDRS(0x2b)); |
4341 | 4341 | ||
4342 | dprintk("init complete!\n"); | 4342 | dprintk("init complete!\n"); |
4343 | 4343 | ||
diff --git a/drivers/media/video/w9968cf.c b/drivers/media/video/w9968cf.c index 602484dd3da9..37fcdc447db5 100644 --- a/drivers/media/video/w9968cf.c +++ b/drivers/media/video/w9968cf.c | |||
@@ -3515,9 +3515,9 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
3515 | w9968cf_turn_on_led(cam); | 3515 | w9968cf_turn_on_led(cam); |
3516 | 3516 | ||
3517 | w9968cf_i2c_init(cam); | 3517 | w9968cf_i2c_init(cam); |
3518 | cam->sensor_sd = v4l2_i2c_new_probed_subdev(&cam->v4l2_dev, | 3518 | cam->sensor_sd = v4l2_i2c_new_subdev(&cam->v4l2_dev, |
3519 | &cam->i2c_adapter, | 3519 | &cam->i2c_adapter, |
3520 | "ovcamchip", "ovcamchip", addrs); | 3520 | "ovcamchip", "ovcamchip", 0, addrs); |
3521 | 3521 | ||
3522 | usb_set_intfdata(intf, cam); | 3522 | usb_set_intfdata(intf, cam); |
3523 | mutex_unlock(&cam->dev_mutex); | 3523 | mutex_unlock(&cam->dev_mutex); |
diff --git a/drivers/media/video/zoran/zoran_card.c b/drivers/media/video/zoran/zoran_card.c index 0c4d9b1f8e6f..be70574870de 100644 --- a/drivers/media/video/zoran/zoran_card.c +++ b/drivers/media/video/zoran/zoran_card.c | |||
@@ -1357,15 +1357,15 @@ static int __devinit zoran_probe(struct pci_dev *pdev, | |||
1357 | goto zr_free_irq; | 1357 | goto zr_free_irq; |
1358 | } | 1358 | } |
1359 | 1359 | ||
1360 | zr->decoder = v4l2_i2c_new_probed_subdev(&zr->v4l2_dev, | 1360 | zr->decoder = v4l2_i2c_new_subdev(&zr->v4l2_dev, |
1361 | &zr->i2c_adapter, zr->card.mod_decoder, zr->card.i2c_decoder, | 1361 | &zr->i2c_adapter, zr->card.mod_decoder, zr->card.i2c_decoder, |
1362 | zr->card.addrs_decoder); | 1362 | 0, zr->card.addrs_decoder); |
1363 | 1363 | ||
1364 | if (zr->card.mod_encoder) | 1364 | if (zr->card.mod_encoder) |
1365 | zr->encoder = v4l2_i2c_new_probed_subdev(&zr->v4l2_dev, | 1365 | zr->encoder = v4l2_i2c_new_subdev(&zr->v4l2_dev, |
1366 | &zr->i2c_adapter, | 1366 | &zr->i2c_adapter, |
1367 | zr->card.mod_encoder, zr->card.i2c_encoder, | 1367 | zr->card.mod_encoder, zr->card.i2c_encoder, |
1368 | zr->card.addrs_encoder); | 1368 | 0, zr->card.addrs_encoder); |
1369 | 1369 | ||
1370 | dprintk(2, | 1370 | dprintk(2, |
1371 | KERN_INFO "%s: Initializing videocodec bus...\n", | 1371 | KERN_INFO "%s: Initializing videocodec bus...\n", |
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 33a18426ab9b..1c25b10da34b 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h | |||
@@ -139,29 +139,23 @@ 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 v4l2_device *v4l2_dev, | 142 | struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev, |
143 | struct i2c_adapter *adapter, | ||
144 | const char *module_name, const char *client_type, u8 addr); | ||
145 | /* Probe and load an i2c module and return an initialized v4l2_subdev struct. | ||
146 | Only call request_module if module_name != NULL. | ||
147 | The client_type argument is the name of the chip that's on the adapter. */ | ||
148 | struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct v4l2_device *v4l2_dev, | ||
149 | struct i2c_adapter *adapter, | 143 | struct i2c_adapter *adapter, |
150 | const char *module_name, const char *client_type, | 144 | const char *module_name, const char *client_type, |
151 | const unsigned short *addrs); | 145 | int irq, void *platform_data, |
152 | /* Like v4l2_i2c_new_probed_subdev, except probe for a single address. */ | 146 | u8 addr, const unsigned short *probe_addrs); |
153 | struct v4l2_subdev *v4l2_i2c_new_probed_subdev_addr(struct v4l2_device *v4l2_dev, | ||
154 | struct i2c_adapter *adapter, | ||
155 | const char *module_name, const char *client_type, u8 addr); | ||
156 | 147 | ||
157 | /* Load an i2c module and return an initialized v4l2_subdev struct. | 148 | /* Load an i2c module and return an initialized v4l2_subdev struct. |
158 | Only call request_module if module_name != NULL. | 149 | Only call request_module if module_name != NULL. |
159 | The client_type argument is the name of the chip that's on the adapter. */ | 150 | The client_type argument is the name of the chip that's on the adapter. */ |
160 | struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev, | 151 | static inline struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev, |
161 | struct i2c_adapter *adapter, | 152 | struct i2c_adapter *adapter, |
162 | const char *module_name, const char *client_type, | 153 | const char *module_name, const char *client_type, |
163 | int irq, void *platform_data, | 154 | u8 addr, const unsigned short *probe_addrs) |
164 | u8 addr, const unsigned short *probe_addrs); | 155 | { |
156 | return v4l2_i2c_new_subdev_cfg(v4l2_dev, adapter, module_name, | ||
157 | client_type, 0, NULL, addr, probe_addrs); | ||
158 | } | ||
165 | 159 | ||
166 | struct i2c_board_info; | 160 | struct i2c_board_info; |
167 | 161 | ||