Commit 290c0cfa authored by Devin Heitmueller's avatar Devin Heitmueller Committed by Mauro Carvalho Chehab

V4L/DVB (12746): em28xx: do not create /dev/vbiX device if VBI not supported

Do not create the VBI device in cases where VBI is not supported on the target
em28xx chip.

This work was sponsored by EyeMagnet Limited.
Signed-off-by: default avatarDevin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 365adee8
...@@ -1131,7 +1131,7 @@ struct em28xx *em28xx_get_device(int minor, ...@@ -1131,7 +1131,7 @@ struct em28xx *em28xx_get_device(int minor,
list_for_each_entry(h, &em28xx_devlist, devlist) { list_for_each_entry(h, &em28xx_devlist, devlist) {
if (h->vdev->minor == minor) if (h->vdev->minor == minor)
dev = h; dev = h;
if (h->vbi_dev->minor == minor) { if (h->vbi_dev && h->vbi_dev->minor == minor) {
dev = h; dev = h;
*fh_type = V4L2_BUF_TYPE_VBI_CAPTURE; *fh_type = V4L2_BUF_TYPE_VBI_CAPTURE;
} }
......
...@@ -2504,7 +2504,9 @@ int em28xx_register_analog_devices(struct em28xx *dev) ...@@ -2504,7 +2504,9 @@ int em28xx_register_analog_devices(struct em28xx *dev)
} }
/* Allocate and fill vbi video_device struct */ /* Allocate and fill vbi video_device struct */
dev->vbi_dev = em28xx_vdev_init(dev, &em28xx_video_template, "vbi"); if (em28xx_vbi_supported(dev) == 1) {
dev->vbi_dev = em28xx_vdev_init(dev, &em28xx_video_template,
"vbi");
/* register v4l2 vbi video_device */ /* register v4l2 vbi video_device */
ret = video_register_device(dev->vbi_dev, VFL_TYPE_VBI, ret = video_register_device(dev->vbi_dev, VFL_TYPE_VBI,
...@@ -2513,6 +2515,7 @@ int em28xx_register_analog_devices(struct em28xx *dev) ...@@ -2513,6 +2515,7 @@ int em28xx_register_analog_devices(struct em28xx *dev)
em28xx_errdev("unable to register vbi device\n"); em28xx_errdev("unable to register vbi device\n");
return ret; return ret;
} }
}
if (em28xx_boards[dev->model].radio.type == EM28XX_RADIO) { if (em28xx_boards[dev->model].radio.type == EM28XX_RADIO) {
dev->radio_dev = em28xx_vdev_init(dev, &em28xx_radio_template, dev->radio_dev = em28xx_vdev_init(dev, &em28xx_radio_template,
...@@ -2531,8 +2534,12 @@ int em28xx_register_analog_devices(struct em28xx *dev) ...@@ -2531,8 +2534,12 @@ int em28xx_register_analog_devices(struct em28xx *dev)
dev->radio_dev->num); dev->radio_dev->num);
} }
em28xx_info("V4L2 device registered as /dev/video%d and /dev/vbi%d\n", em28xx_info("V4L2 video device registered as /dev/video%d\n",
dev->vdev->num, dev->vbi_dev->num); dev->vdev->num);
if (dev->vbi_dev)
em28xx_info("V4L2 VBI device registered as /dev/vbi%d\n",
dev->vbi_dev->num);
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment