diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/bt8xx/bttv-i2c.c | 2 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-i2c.c | 3 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-i2c.c | 15 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-i2c.c | 19 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-cards.c | 2 | ||||
-rw-r--r-- | drivers/media/video/fsl-viu.c | 8 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-i2c.c | 9 | ||||
-rw-r--r-- | drivers/media/video/v4l2-common.c | 3 | ||||
-rw-r--r-- | drivers/media/video/v4l2-dev.c | 52 |
9 files changed, 38 insertions, 75 deletions
diff --git a/drivers/media/video/bt8xx/bttv-i2c.c b/drivers/media/video/bt8xx/bttv-i2c.c index 407fa61e4cda..685d6597ee79 100644 --- a/drivers/media/video/bt8xx/bttv-i2c.c +++ b/drivers/media/video/bt8xx/bttv-i2c.c | |||
@@ -411,7 +411,7 @@ void __devinit init_bttv_i2c_ir(struct bttv *btv) | |||
411 | 411 | ||
412 | memset(&info, 0, sizeof(struct i2c_board_info)); | 412 | memset(&info, 0, sizeof(struct i2c_board_info)); |
413 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); | 413 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); |
414 | i2c_new_probed_device(&btv->c.i2c_adap, &info, addr_list); | 414 | i2c_new_probed_device(&btv->c.i2c_adap, &info, addr_list, NULL); |
415 | } | 415 | } |
416 | } | 416 | } |
417 | 417 | ||
diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c index 809f7d37129c..73ce90c2f577 100644 --- a/drivers/media/video/cx18/cx18-i2c.c +++ b/drivers/media/video/cx18/cx18-i2c.c | |||
@@ -117,7 +117,8 @@ static int cx18_i2c_new_ir(struct cx18 *cx, struct i2c_adapter *adap, u32 hw, | |||
117 | break; | 117 | break; |
118 | } | 118 | } |
119 | 119 | ||
120 | return i2c_new_probed_device(adap, &info, addr_list) == NULL ? -1 : 0; | 120 | return i2c_new_probed_device(adap, &info, addr_list, NULL) == NULL ? |
121 | -1 : 0; | ||
121 | } | 122 | } |
122 | 123 | ||
123 | int cx18_i2c_register(struct cx18 *cx, unsigned idx) | 124 | int cx18_i2c_register(struct cx18 *cx, unsigned idx) |
diff --git a/drivers/media/video/cx23885/cx23885-i2c.c b/drivers/media/video/cx23885/cx23885-i2c.c index 1a391486e551..ed3d8f55029b 100644 --- a/drivers/media/video/cx23885/cx23885-i2c.c +++ b/drivers/media/video/cx23885/cx23885-i2c.c | |||
@@ -364,17 +364,10 @@ int cx23885_i2c_register(struct cx23885_i2c *bus) | |||
364 | 364 | ||
365 | memset(&info, 0, sizeof(struct i2c_board_info)); | 365 | memset(&info, 0, sizeof(struct i2c_board_info)); |
366 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); | 366 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); |
367 | /* | 367 | /* Use quick read command for probe, some IR chips don't |
368 | * We can't call i2c_new_probed_device() because it uses | 368 | * support writes */ |
369 | * quick writes for probing and the IR receiver device only | 369 | i2c_new_probed_device(&bus->i2c_adap, &info, addr_list, |
370 | * replies to reads. | 370 | i2c_probe_func_quick_read); |
371 | */ | ||
372 | if (i2c_smbus_xfer(&bus->i2c_adap, addr_list[0], 0, | ||
373 | I2C_SMBUS_READ, 0, I2C_SMBUS_QUICK, | ||
374 | NULL) >= 0) { | ||
375 | info.addr = addr_list[0]; | ||
376 | i2c_new_device(&bus->i2c_adap, &info); | ||
377 | } | ||
378 | } | 371 | } |
379 | 372 | ||
380 | return bus->i2c_rc; | 373 | return bus->i2c_rc; |
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c index 375ad53f7961..82db555b22dd 100644 --- a/drivers/media/video/cx88/cx88-i2c.c +++ b/drivers/media/video/cx88/cx88-i2c.c | |||
@@ -193,24 +193,13 @@ void cx88_i2c_init_ir(struct cx88_core *core) | |||
193 | 0x18, 0x6b, 0x71, | 193 | 0x18, 0x6b, 0x71, |
194 | I2C_CLIENT_END | 194 | I2C_CLIENT_END |
195 | }; | 195 | }; |
196 | const unsigned short *addrp; | ||
197 | 196 | ||
198 | memset(&info, 0, sizeof(struct i2c_board_info)); | 197 | memset(&info, 0, sizeof(struct i2c_board_info)); |
199 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); | 198 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); |
200 | /* | 199 | /* Use quick read command for probe, some IR chips don't |
201 | * We can't call i2c_new_probed_device() because it uses | 200 | * support writes */ |
202 | * quick writes for probing and at least some R receiver | 201 | i2c_new_probed_device(&core->i2c_adap, &info, addr_list, |
203 | * devices only reply to reads. | 202 | i2c_probe_func_quick_read); |
204 | */ | ||
205 | for (addrp = addr_list; *addrp != I2C_CLIENT_END; addrp++) { | ||
206 | if (i2c_smbus_xfer(&core->i2c_adap, *addrp, 0, | ||
207 | I2C_SMBUS_READ, 0, | ||
208 | I2C_SMBUS_QUICK, NULL) >= 0) { | ||
209 | info.addr = *addrp; | ||
210 | i2c_new_device(&core->i2c_adap, &info); | ||
211 | break; | ||
212 | } | ||
213 | } | ||
214 | } | 203 | } |
215 | } | 204 | } |
216 | 205 | ||
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index ffbe544e30f4..e7efb4bffabd 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -2385,7 +2385,7 @@ void em28xx_register_i2c_ir(struct em28xx *dev) | |||
2385 | 2385 | ||
2386 | if (dev->init_data.name) | 2386 | if (dev->init_data.name) |
2387 | info.platform_data = &dev->init_data; | 2387 | info.platform_data = &dev->init_data; |
2388 | i2c_new_probed_device(&dev->i2c_adap, &info, addr_list); | 2388 | i2c_new_probed_device(&dev->i2c_adap, &info, addr_list, NULL); |
2389 | } | 2389 | } |
2390 | 2390 | ||
2391 | void em28xx_card_setup(struct em28xx *dev) | 2391 | void em28xx_card_setup(struct em28xx *dev) |
diff --git a/drivers/media/video/fsl-viu.c b/drivers/media/video/fsl-viu.c index 8f1c94f7e00c..43d208f1f586 100644 --- a/drivers/media/video/fsl-viu.c +++ b/drivers/media/video/fsl-viu.c | |||
@@ -1418,7 +1418,7 @@ static struct video_device viu_template = { | |||
1418 | .current_norm = V4L2_STD_NTSC_M, | 1418 | .current_norm = V4L2_STD_NTSC_M, |
1419 | }; | 1419 | }; |
1420 | 1420 | ||
1421 | static int __devinit viu_of_probe(struct of_device *op, | 1421 | static int __devinit viu_of_probe(struct platform_device *op, |
1422 | const struct of_device_id *match) | 1422 | const struct of_device_id *match) |
1423 | { | 1423 | { |
1424 | struct viu_dev *viu_dev; | 1424 | struct viu_dev *viu_dev; |
@@ -1549,7 +1549,7 @@ err: | |||
1549 | return ret; | 1549 | return ret; |
1550 | } | 1550 | } |
1551 | 1551 | ||
1552 | static int __devexit viu_of_remove(struct of_device *op) | 1552 | static int __devexit viu_of_remove(struct platform_device *op) |
1553 | { | 1553 | { |
1554 | struct v4l2_device *v4l2_dev = dev_get_drvdata(&op->dev); | 1554 | struct v4l2_device *v4l2_dev = dev_get_drvdata(&op->dev); |
1555 | struct viu_dev *dev = container_of(v4l2_dev, struct viu_dev, v4l2_dev); | 1555 | struct viu_dev *dev = container_of(v4l2_dev, struct viu_dev, v4l2_dev); |
@@ -1570,7 +1570,7 @@ static int __devexit viu_of_remove(struct of_device *op) | |||
1570 | } | 1570 | } |
1571 | 1571 | ||
1572 | #ifdef CONFIG_PM | 1572 | #ifdef CONFIG_PM |
1573 | static int viu_suspend(struct of_device *op, pm_message_t state) | 1573 | static int viu_suspend(struct platform_device *op, pm_message_t state) |
1574 | { | 1574 | { |
1575 | struct v4l2_device *v4l2_dev = dev_get_drvdata(&op->dev); | 1575 | struct v4l2_device *v4l2_dev = dev_get_drvdata(&op->dev); |
1576 | struct viu_dev *dev = container_of(v4l2_dev, struct viu_dev, v4l2_dev); | 1576 | struct viu_dev *dev = container_of(v4l2_dev, struct viu_dev, v4l2_dev); |
@@ -1579,7 +1579,7 @@ static int viu_suspend(struct of_device *op, pm_message_t state) | |||
1579 | return 0; | 1579 | return 0; |
1580 | } | 1580 | } |
1581 | 1581 | ||
1582 | static int viu_resume(struct of_device *op) | 1582 | static int viu_resume(struct platform_device *op) |
1583 | { | 1583 | { |
1584 | struct v4l2_device *v4l2_dev = dev_get_drvdata(&op->dev); | 1584 | struct v4l2_device *v4l2_dev = dev_get_drvdata(&op->dev); |
1585 | struct viu_dev *dev = container_of(v4l2_dev, struct viu_dev, v4l2_dev); | 1585 | struct viu_dev *dev = container_of(v4l2_dev, struct viu_dev, v4l2_dev); |
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index d391bbdb0b8a..a74fa099c565 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.c +++ b/drivers/media/video/ivtv/ivtv-i2c.c | |||
@@ -183,8 +183,8 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) | |||
183 | return -1; | 183 | return -1; |
184 | memset(&info, 0, sizeof(struct i2c_board_info)); | 184 | memset(&info, 0, sizeof(struct i2c_board_info)); |
185 | strlcpy(info.type, type, I2C_NAME_SIZE); | 185 | strlcpy(info.type, type, I2C_NAME_SIZE); |
186 | return i2c_new_probed_device(adap, &info, addr_list) == NULL | 186 | return i2c_new_probed_device(adap, &info, addr_list, NULL) |
187 | ? -1 : 0; | 187 | == NULL ? -1 : 0; |
188 | } | 188 | } |
189 | 189 | ||
190 | /* Only allow one IR receiver to be registered per board */ | 190 | /* Only allow one IR receiver to be registered per board */ |
@@ -221,7 +221,8 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) | |||
221 | info.platform_data = init_data; | 221 | info.platform_data = init_data; |
222 | strlcpy(info.type, type, I2C_NAME_SIZE); | 222 | strlcpy(info.type, type, I2C_NAME_SIZE); |
223 | 223 | ||
224 | return i2c_new_probed_device(adap, &info, addr_list) == NULL ? -1 : 0; | 224 | return i2c_new_probed_device(adap, &info, addr_list, NULL) == NULL ? |
225 | -1 : 0; | ||
225 | } | 226 | } |
226 | 227 | ||
227 | /* Instantiate the IR receiver device using probing -- undesirable */ | 228 | /* Instantiate the IR receiver device using probing -- undesirable */ |
@@ -249,7 +250,7 @@ struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv) | |||
249 | 250 | ||
250 | memset(&info, 0, sizeof(struct i2c_board_info)); | 251 | memset(&info, 0, sizeof(struct i2c_board_info)); |
251 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); | 252 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); |
252 | return i2c_new_probed_device(&itv->i2c_adap, &info, addr_list); | 253 | return i2c_new_probed_device(&itv->i2c_adap, &info, addr_list, NULL); |
253 | } | 254 | } |
254 | 255 | ||
255 | int ivtv_i2c_register(struct ivtv *itv, unsigned idx) | 256 | int ivtv_i2c_register(struct ivtv *itv, unsigned idx) |
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 3ce7c64e5789..8ee1179be926 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -381,7 +381,8 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev, | |||
381 | 381 | ||
382 | /* Create the i2c client */ | 382 | /* Create the i2c client */ |
383 | if (info->addr == 0 && probe_addrs) | 383 | if (info->addr == 0 && probe_addrs) |
384 | client = i2c_new_probed_device(adapter, info, probe_addrs); | 384 | client = i2c_new_probed_device(adapter, info, probe_addrs, |
385 | NULL); | ||
385 | else | 386 | else |
386 | client = i2c_new_device(adapter, info); | 387 | client = i2c_new_device(adapter, info); |
387 | 388 | ||
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 21ffd030611e..cb77197d480e 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/kmod.h> | 26 | #include <linux/kmod.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/smp_lock.h> | ||
28 | #include <asm/uaccess.h> | 29 | #include <asm/uaccess.h> |
29 | #include <asm/system.h> | 30 | #include <asm/system.h> |
30 | 31 | ||
@@ -215,28 +216,24 @@ static unsigned int v4l2_poll(struct file *filp, struct poll_table_struct *poll) | |||
215 | return vdev->fops->poll(filp, poll); | 216 | return vdev->fops->poll(filp, poll); |
216 | } | 217 | } |
217 | 218 | ||
218 | static int v4l2_ioctl(struct inode *inode, struct file *filp, | 219 | static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
219 | unsigned int cmd, unsigned long arg) | ||
220 | { | 220 | { |
221 | struct video_device *vdev = video_devdata(filp); | 221 | struct video_device *vdev = video_devdata(filp); |
222 | int ret; | ||
222 | 223 | ||
223 | if (!vdev->fops->ioctl) | ||
224 | return -ENOTTY; | ||
225 | /* Allow ioctl to continue even if the device was unregistered. | 224 | /* Allow ioctl to continue even if the device was unregistered. |
226 | Things like dequeueing buffers might still be useful. */ | 225 | Things like dequeueing buffers might still be useful. */ |
227 | return vdev->fops->ioctl(filp, cmd, arg); | 226 | if (vdev->fops->unlocked_ioctl) { |
228 | } | 227 | ret = vdev->fops->unlocked_ioctl(filp, cmd, arg); |
229 | 228 | } else if (vdev->fops->ioctl) { | |
230 | static long v4l2_unlocked_ioctl(struct file *filp, | 229 | /* TODO: convert all drivers to unlocked_ioctl */ |
231 | unsigned int cmd, unsigned long arg) | 230 | lock_kernel(); |
232 | { | 231 | ret = vdev->fops->ioctl(filp, cmd, arg); |
233 | struct video_device *vdev = video_devdata(filp); | 232 | unlock_kernel(); |
233 | } else | ||
234 | ret = -ENOTTY; | ||
234 | 235 | ||
235 | if (!vdev->fops->unlocked_ioctl) | 236 | return ret; |
236 | return -ENOTTY; | ||
237 | /* Allow ioctl to continue even if the device was unregistered. | ||
238 | Things like dequeueing buffers might still be useful. */ | ||
239 | return vdev->fops->unlocked_ioctl(filp, cmd, arg); | ||
240 | } | 237 | } |
241 | 238 | ||
242 | #ifdef CONFIG_MMU | 239 | #ifdef CONFIG_MMU |
@@ -307,22 +304,6 @@ static int v4l2_release(struct inode *inode, struct file *filp) | |||
307 | return ret; | 304 | return ret; |
308 | } | 305 | } |
309 | 306 | ||
310 | static const struct file_operations v4l2_unlocked_fops = { | ||
311 | .owner = THIS_MODULE, | ||
312 | .read = v4l2_read, | ||
313 | .write = v4l2_write, | ||
314 | .open = v4l2_open, | ||
315 | .get_unmapped_area = v4l2_get_unmapped_area, | ||
316 | .mmap = v4l2_mmap, | ||
317 | .unlocked_ioctl = v4l2_unlocked_ioctl, | ||
318 | #ifdef CONFIG_COMPAT | ||
319 | .compat_ioctl = v4l2_compat_ioctl32, | ||
320 | #endif | ||
321 | .release = v4l2_release, | ||
322 | .poll = v4l2_poll, | ||
323 | .llseek = no_llseek, | ||
324 | }; | ||
325 | |||
326 | static const struct file_operations v4l2_fops = { | 307 | static const struct file_operations v4l2_fops = { |
327 | .owner = THIS_MODULE, | 308 | .owner = THIS_MODULE, |
328 | .read = v4l2_read, | 309 | .read = v4l2_read, |
@@ -330,7 +311,7 @@ static const struct file_operations v4l2_fops = { | |||
330 | .open = v4l2_open, | 311 | .open = v4l2_open, |
331 | .get_unmapped_area = v4l2_get_unmapped_area, | 312 | .get_unmapped_area = v4l2_get_unmapped_area, |
332 | .mmap = v4l2_mmap, | 313 | .mmap = v4l2_mmap, |
333 | .ioctl = v4l2_ioctl, | 314 | .unlocked_ioctl = v4l2_ioctl, |
334 | #ifdef CONFIG_COMPAT | 315 | #ifdef CONFIG_COMPAT |
335 | .compat_ioctl = v4l2_compat_ioctl32, | 316 | .compat_ioctl = v4l2_compat_ioctl32, |
336 | #endif | 317 | #endif |
@@ -525,10 +506,7 @@ static int __video_register_device(struct video_device *vdev, int type, int nr, | |||
525 | ret = -ENOMEM; | 506 | ret = -ENOMEM; |
526 | goto cleanup; | 507 | goto cleanup; |
527 | } | 508 | } |
528 | if (vdev->fops->unlocked_ioctl) | 509 | vdev->cdev->ops = &v4l2_fops; |
529 | vdev->cdev->ops = &v4l2_unlocked_fops; | ||
530 | else | ||
531 | vdev->cdev->ops = &v4l2_fops; | ||
532 | vdev->cdev->owner = vdev->fops->owner; | 510 | vdev->cdev->owner = vdev->fops->owner; |
533 | ret = cdev_add(vdev->cdev, MKDEV(VIDEO_MAJOR, vdev->minor), 1); | 511 | ret = cdev_add(vdev->cdev, MKDEV(VIDEO_MAJOR, vdev->minor), 1); |
534 | if (ret < 0) { | 512 | if (ret < 0) { |