diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2009-11-27 11:57:55 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-15 21:17:58 -0500 |
commit | 327ae59757f2e56fd3fc2b11acbd0a7c4070f4e8 (patch) | |
tree | e6d1f1b18e49560349194659cfb4b30ff40da9de /drivers/media | |
parent | 46b21094cee16bc7e531d7d6cd66fb5ea05065d4 (diff) |
V4L/DVB (13557): v4l: Remove unneeded video_device::minor usage in drivers
The video_device::minor field is used where it shouldn't, either to
- test for error conditions that can't happen anymore with the current
v4l-dvb core,
- store the value in a driver private field that isn't used anymore,
- check the video device type where video_device::vfl_type should be
used, or
- create the name of a kernel thread that should get a stable name.
Remove or fix those use cases.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/common/saa7146_fops.c | 19 | ||||
-rw-r--r-- | drivers/media/radio/radio-tea5764.c | 4 | ||||
-rw-r--r-- | drivers/media/video/bt8xx/bttv-driver.c | 15 | ||||
-rw-r--r-- | drivers/media/video/gspca/sn9c20x.c | 5 | ||||
-rw-r--r-- | drivers/media/video/omap24xxcam.c | 3 |
5 files changed, 8 insertions, 38 deletions
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index 3c11cff00475..7364b9642d00 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c | |||
@@ -1,7 +1,5 @@ | |||
1 | #include <media/saa7146_vv.h> | 1 | #include <media/saa7146_vv.h> |
2 | 2 | ||
3 | #define BOARD_CAN_DO_VBI(dev) (dev->revision != 0 && dev->vv_data->vbi_minor != -1) | ||
4 | |||
5 | /****************************************************************************/ | 3 | /****************************************************************************/ |
6 | /* resource management functions, shamelessly stolen from saa7134 driver */ | 4 | /* resource management functions, shamelessly stolen from saa7134 driver */ |
7 | 5 | ||
@@ -455,9 +453,6 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) | |||
455 | configuration data) */ | 453 | configuration data) */ |
456 | dev->ext_vv_data = ext_vv; | 454 | dev->ext_vv_data = ext_vv; |
457 | 455 | ||
458 | vv->video_minor = -1; | ||
459 | vv->vbi_minor = -1; | ||
460 | |||
461 | vv->d_clipping.cpu_addr = pci_alloc_consistent(dev->pci, SAA7146_CLIPPING_MEM, &vv->d_clipping.dma_handle); | 456 | vv->d_clipping.cpu_addr = pci_alloc_consistent(dev->pci, SAA7146_CLIPPING_MEM, &vv->d_clipping.dma_handle); |
462 | if( NULL == vv->d_clipping.cpu_addr ) { | 457 | if( NULL == vv->d_clipping.cpu_addr ) { |
463 | ERR(("out of memory. aborting.\n")); | 458 | ERR(("out of memory. aborting.\n")); |
@@ -496,7 +491,6 @@ EXPORT_SYMBOL_GPL(saa7146_vv_release); | |||
496 | int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, | 491 | int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, |
497 | char *name, int type) | 492 | char *name, int type) |
498 | { | 493 | { |
499 | struct saa7146_vv *vv = dev->vv_data; | ||
500 | struct video_device *vfd; | 494 | struct video_device *vfd; |
501 | int err; | 495 | int err; |
502 | int i; | 496 | int i; |
@@ -524,11 +518,6 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, | |||
524 | return err; | 518 | return err; |
525 | } | 519 | } |
526 | 520 | ||
527 | if (VFL_TYPE_GRABBER == type) | ||
528 | vv->video_minor = vfd->minor; | ||
529 | else | ||
530 | vv->vbi_minor = vfd->minor; | ||
531 | |||
532 | INFO(("%s: registered device %s [v4l2]\n", | 521 | INFO(("%s: registered device %s [v4l2]\n", |
533 | dev->name, video_device_node_name(vfd))); | 522 | dev->name, video_device_node_name(vfd))); |
534 | 523 | ||
@@ -539,16 +528,8 @@ EXPORT_SYMBOL_GPL(saa7146_register_device); | |||
539 | 528 | ||
540 | int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev) | 529 | int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev) |
541 | { | 530 | { |
542 | struct saa7146_vv *vv = dev->vv_data; | ||
543 | |||
544 | DEB_EE(("dev:%p\n",dev)); | 531 | DEB_EE(("dev:%p\n",dev)); |
545 | 532 | ||
546 | if ((*vid)->vfl_type == VFL_TYPE_GRABBER) { | ||
547 | vv->video_minor = -1; | ||
548 | } else { | ||
549 | vv->vbi_minor = -1; | ||
550 | } | ||
551 | |||
552 | video_unregister_device(*vid); | 533 | video_unregister_device(*vid); |
553 | *vid = NULL; | 534 | *vid = NULL; |
554 | 535 | ||
diff --git a/drivers/media/radio/radio-tea5764.c b/drivers/media/radio/radio-tea5764.c index 730ffd9cdd3e..1d357b79b2fd 100644 --- a/drivers/media/radio/radio-tea5764.c +++ b/drivers/media/radio/radio-tea5764.c | |||
@@ -460,12 +460,8 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
460 | static int tea5764_open(struct file *file) | 460 | static int tea5764_open(struct file *file) |
461 | { | 461 | { |
462 | /* Currently we support only one device */ | 462 | /* Currently we support only one device */ |
463 | int minor = video_devdata(file)->minor; | ||
464 | struct tea5764_device *radio = video_drvdata(file); | 463 | struct tea5764_device *radio = video_drvdata(file); |
465 | 464 | ||
466 | if (radio->videodev->minor != minor) | ||
467 | return -ENODEV; | ||
468 | |||
469 | mutex_lock(&radio->mutex); | 465 | mutex_lock(&radio->mutex); |
470 | /* Only exclusive access */ | 466 | /* Only exclusive access */ |
471 | if (radio->users) { | 467 | if (radio->users) { |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 410260a1c364..3182a406bdd1 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -3206,7 +3206,6 @@ err: | |||
3206 | 3206 | ||
3207 | static int bttv_open(struct file *file) | 3207 | static int bttv_open(struct file *file) |
3208 | { | 3208 | { |
3209 | int minor = video_devdata(file)->minor; | ||
3210 | struct video_device *vdev = video_devdata(file); | 3209 | struct video_device *vdev = video_devdata(file); |
3211 | struct bttv *btv = video_drvdata(file); | 3210 | struct bttv *btv = video_drvdata(file); |
3212 | struct bttv_fh *fh; | 3211 | struct bttv_fh *fh; |
@@ -3214,17 +3213,17 @@ static int bttv_open(struct file *file) | |||
3214 | 3213 | ||
3215 | dprintk(KERN_DEBUG "bttv: open dev=%s\n", video_device_node_name(vdev)); | 3214 | dprintk(KERN_DEBUG "bttv: open dev=%s\n", video_device_node_name(vdev)); |
3216 | 3215 | ||
3217 | lock_kernel(); | 3216 | if (vdev->vfl_type == VFL_TYPE_GRABBER) { |
3218 | if (btv->video_dev->minor == minor) { | ||
3219 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 3217 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
3220 | } else if (btv->vbi_dev->minor == minor) { | 3218 | } else if (vdev->vfl_type == VFL_TYPE_VBI) { |
3221 | type = V4L2_BUF_TYPE_VBI_CAPTURE; | 3219 | type = V4L2_BUF_TYPE_VBI_CAPTURE; |
3222 | } else { | 3220 | } else { |
3223 | WARN_ON(1); | 3221 | WARN_ON(1); |
3224 | unlock_kernel(); | ||
3225 | return -ENODEV; | 3222 | return -ENODEV; |
3226 | } | 3223 | } |
3227 | 3224 | ||
3225 | lock_kernel(); | ||
3226 | |||
3228 | dprintk(KERN_DEBUG "bttv%d: open called (type=%s)\n", | 3227 | dprintk(KERN_DEBUG "bttv%d: open called (type=%s)\n", |
3229 | btv->c.nr,v4l2_type_names[type]); | 3228 | btv->c.nr,v4l2_type_names[type]); |
3230 | 3229 | ||
@@ -3408,7 +3407,6 @@ static struct video_device bttv_video_template = { | |||
3408 | 3407 | ||
3409 | static int radio_open(struct file *file) | 3408 | static int radio_open(struct file *file) |
3410 | { | 3409 | { |
3411 | int minor = video_devdata(file)->minor; | ||
3412 | struct video_device *vdev = video_devdata(file); | 3410 | struct video_device *vdev = video_devdata(file); |
3413 | struct bttv *btv = video_drvdata(file); | 3411 | struct bttv *btv = video_drvdata(file); |
3414 | struct bttv_fh *fh; | 3412 | struct bttv_fh *fh; |
@@ -3416,11 +3414,6 @@ static int radio_open(struct file *file) | |||
3416 | dprintk("bttv: open dev=%s\n", video_device_node_name(vdev)); | 3414 | dprintk("bttv: open dev=%s\n", video_device_node_name(vdev)); |
3417 | 3415 | ||
3418 | lock_kernel(); | 3416 | lock_kernel(); |
3419 | WARN_ON(btv->radio_dev && btv->radio_dev->minor != minor); | ||
3420 | if (!btv->radio_dev || btv->radio_dev->minor != minor) { | ||
3421 | unlock_kernel(); | ||
3422 | return -ENODEV; | ||
3423 | } | ||
3424 | 3417 | ||
3425 | dprintk("bttv%d: open called (radio)\n",btv->c.nr); | 3418 | dprintk("bttv%d: open called (radio)\n",btv->c.nr); |
3426 | 3419 | ||
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index b1944a7cbb0f..a3d8f4675c04 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c | |||
@@ -1476,8 +1476,9 @@ static int sn9c20x_input_init(struct gspca_dev *gspca_dev) | |||
1476 | if (input_register_device(sd->input_dev)) | 1476 | if (input_register_device(sd->input_dev)) |
1477 | return -EINVAL; | 1477 | return -EINVAL; |
1478 | 1478 | ||
1479 | sd->input_task = kthread_run(input_kthread, gspca_dev, "sn9c20x/%d", | 1479 | sd->input_task = kthread_run(input_kthread, gspca_dev, "sn9c20x/%s-%s", |
1480 | gspca_dev->vdev.minor); | 1480 | gspca_dev->dev->bus->bus_name, |
1481 | gspca_dev->dev->devpath); | ||
1481 | 1482 | ||
1482 | if (IS_ERR(sd->input_task)) | 1483 | if (IS_ERR(sd->input_task)) |
1483 | return -EINVAL; | 1484 | return -EINVAL; |
diff --git a/drivers/media/video/omap24xxcam.c b/drivers/media/video/omap24xxcam.c index 71e08be7960c..7400eacb4d64 100644 --- a/drivers/media/video/omap24xxcam.c +++ b/drivers/media/video/omap24xxcam.c | |||
@@ -1450,12 +1450,11 @@ static int omap24xxcam_mmap(struct file *file, struct vm_area_struct *vma) | |||
1450 | 1450 | ||
1451 | static int omap24xxcam_open(struct file *file) | 1451 | static int omap24xxcam_open(struct file *file) |
1452 | { | 1452 | { |
1453 | int minor = video_devdata(file)->minor; | ||
1454 | struct omap24xxcam_device *cam = omap24xxcam.priv; | 1453 | struct omap24xxcam_device *cam = omap24xxcam.priv; |
1455 | struct omap24xxcam_fh *fh; | 1454 | struct omap24xxcam_fh *fh; |
1456 | struct v4l2_format format; | 1455 | struct v4l2_format format; |
1457 | 1456 | ||
1458 | if (!cam || !cam->vfd || (cam->vfd->minor != minor)) | 1457 | if (!cam || !cam->vfd) |
1459 | return -ENODEV; | 1458 | return -ENODEV; |
1460 | 1459 | ||
1461 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | 1460 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); |