V4L/DVB (13553): v4l: Use the video_is_registered function in device drivers
Fix all device drivers to use the video_is_registered function instead of checking video_device::minor. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Родитель
957b4aa9f7
Коммит
f0813b4c9f
|
@ -4208,21 +4208,21 @@ static struct video_device *vdev_init(struct bttv *btv,
|
|||
static void bttv_unregister_video(struct bttv *btv)
|
||||
{
|
||||
if (btv->video_dev) {
|
||||
if (-1 != btv->video_dev->minor)
|
||||
if (video_is_registered(btv->video_dev))
|
||||
video_unregister_device(btv->video_dev);
|
||||
else
|
||||
video_device_release(btv->video_dev);
|
||||
btv->video_dev = NULL;
|
||||
}
|
||||
if (btv->vbi_dev) {
|
||||
if (-1 != btv->vbi_dev->minor)
|
||||
if (video_is_registered(btv->vbi_dev))
|
||||
video_unregister_device(btv->vbi_dev);
|
||||
else
|
||||
video_device_release(btv->vbi_dev);
|
||||
btv->vbi_dev = NULL;
|
||||
}
|
||||
if (btv->radio_dev) {
|
||||
if (-1 != btv->radio_dev->minor)
|
||||
if (video_is_registered(btv->radio_dev))
|
||||
video_unregister_device(btv->radio_dev);
|
||||
else
|
||||
video_device_release(btv->radio_dev);
|
||||
|
|
|
@ -2020,7 +2020,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev)
|
|||
/*FIXME: I2C IR should be disconnected */
|
||||
|
||||
if (dev->radio_dev) {
|
||||
if (-1 != dev->radio_dev->minor)
|
||||
if (video_is_registered(dev->radio_dev))
|
||||
video_unregister_device(dev->radio_dev);
|
||||
else
|
||||
video_device_release(dev->radio_dev);
|
||||
|
@ -2029,7 +2029,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev)
|
|||
if (dev->vbi_dev) {
|
||||
cx231xx_info("V4L2 device %s deregistered\n",
|
||||
video_device_node_name(dev->vbi_dev));
|
||||
if (-1 != dev->vbi_dev->minor)
|
||||
if (video_is_registered(dev->vbi_dev))
|
||||
video_unregister_device(dev->vbi_dev);
|
||||
else
|
||||
video_device_release(dev->vbi_dev);
|
||||
|
@ -2038,7 +2038,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev)
|
|||
if (dev->vdev) {
|
||||
cx231xx_info("V4L2 device %s deregistered\n",
|
||||
video_device_node_name(dev->vdev));
|
||||
if (-1 != dev->vdev->minor)
|
||||
if (video_is_registered(dev->vdev))
|
||||
video_unregister_device(dev->vdev);
|
||||
else
|
||||
video_device_release(dev->vdev);
|
||||
|
|
|
@ -1746,7 +1746,7 @@ void cx23885_417_unregister(struct cx23885_dev *dev)
|
|||
dprintk(1, "%s()\n", __func__);
|
||||
|
||||
if (dev->v4l_device) {
|
||||
if (-1 != dev->v4l_device->minor)
|
||||
if (video_is_registered(dev->v4l_device))
|
||||
video_unregister_device(dev->v4l_device);
|
||||
else
|
||||
video_device_release(dev->v4l_device);
|
||||
|
|
|
@ -1461,7 +1461,7 @@ void cx23885_video_unregister(struct cx23885_dev *dev)
|
|||
cx_clear(PCI_INT_MSK, 1);
|
||||
|
||||
if (dev->video_dev) {
|
||||
if (-1 != dev->video_dev->minor)
|
||||
if (video_is_registered(dev->video_dev))
|
||||
video_unregister_device(dev->video_dev);
|
||||
else
|
||||
video_device_release(dev->video_dev);
|
||||
|
|
|
@ -1276,7 +1276,7 @@ static int cx8802_blackbird_advise_release(struct cx8802_driver *drv)
|
|||
static void blackbird_unregister_video(struct cx8802_dev *dev)
|
||||
{
|
||||
if (dev->mpeg_dev) {
|
||||
if (-1 != dev->mpeg_dev->minor)
|
||||
if (video_is_registered(dev->mpeg_dev))
|
||||
video_unregister_device(dev->mpeg_dev);
|
||||
else
|
||||
video_device_release(dev->mpeg_dev);
|
||||
|
|
|
@ -1778,21 +1778,21 @@ static struct video_device cx8800_radio_template = {
|
|||
static void cx8800_unregister_video(struct cx8800_dev *dev)
|
||||
{
|
||||
if (dev->radio_dev) {
|
||||
if (-1 != dev->radio_dev->minor)
|
||||
if (video_is_registered(dev->radio_dev))
|
||||
video_unregister_device(dev->radio_dev);
|
||||
else
|
||||
video_device_release(dev->radio_dev);
|
||||
dev->radio_dev = NULL;
|
||||
}
|
||||
if (dev->vbi_dev) {
|
||||
if (-1 != dev->vbi_dev->minor)
|
||||
if (video_is_registered(dev->vbi_dev))
|
||||
video_unregister_device(dev->vbi_dev);
|
||||
else
|
||||
video_device_release(dev->vbi_dev);
|
||||
dev->vbi_dev = NULL;
|
||||
}
|
||||
if (dev->video_dev) {
|
||||
if (-1 != dev->video_dev->minor)
|
||||
if (video_is_registered(dev->video_dev))
|
||||
video_unregister_device(dev->video_dev);
|
||||
else
|
||||
video_device_release(dev->video_dev);
|
||||
|
|
|
@ -2071,7 +2071,7 @@ probe_out_video_unregister:
|
|||
probe_out_v4l2_unregister:
|
||||
v4l2_device_unregister(&vpfe_dev->v4l2_dev);
|
||||
probe_out_video_release:
|
||||
if (vpfe_dev->video_dev->minor == -1)
|
||||
if (!video_is_registered(vpfe_dev->video_dev))
|
||||
video_device_release(vpfe_dev->video_dev);
|
||||
probe_out_release_irq:
|
||||
free_irq(vpfe_dev->ccdc_irq0, vpfe_dev);
|
||||
|
|
|
@ -2160,7 +2160,7 @@ void em28xx_release_analog_resources(struct em28xx *dev)
|
|||
/*FIXME: I2C IR should be disconnected */
|
||||
|
||||
if (dev->radio_dev) {
|
||||
if (-1 != dev->radio_dev->minor)
|
||||
if (video_is_registered(dev->radio_dev))
|
||||
video_unregister_device(dev->radio_dev);
|
||||
else
|
||||
video_device_release(dev->radio_dev);
|
||||
|
@ -2169,7 +2169,7 @@ void em28xx_release_analog_resources(struct em28xx *dev)
|
|||
if (dev->vbi_dev) {
|
||||
em28xx_info("V4L2 device %s deregistered\n",
|
||||
video_device_node_name(dev->vbi_dev));
|
||||
if (-1 != dev->vbi_dev->minor)
|
||||
if (video_is_registered(dev->vbi_dev))
|
||||
video_unregister_device(dev->vbi_dev);
|
||||
else
|
||||
video_device_release(dev->vbi_dev);
|
||||
|
@ -2178,7 +2178,7 @@ void em28xx_release_analog_resources(struct em28xx *dev)
|
|||
if (dev->vdev) {
|
||||
em28xx_info("V4L2 device %s deregistered\n",
|
||||
video_device_node_name(dev->vdev));
|
||||
if (-1 != dev->vdev->minor)
|
||||
if (video_is_registered(dev->vdev))
|
||||
video_unregister_device(dev->vdev);
|
||||
else
|
||||
video_device_release(dev->vdev);
|
||||
|
|
|
@ -1696,7 +1696,7 @@ static void omap24xxcam_device_unregister(struct v4l2_int_device *s)
|
|||
omap24xxcam_sensor_exit(cam);
|
||||
|
||||
if (cam->vfd) {
|
||||
if (cam->vfd->minor == -1) {
|
||||
if (!video_is_registered(cam->vfd)) {
|
||||
/*
|
||||
* The device was never registered, so release the
|
||||
* video_device struct directly.
|
||||
|
|
|
@ -5884,7 +5884,7 @@ ov51x_probe(struct usb_interface *intf, const struct usb_device_id *id)
|
|||
|
||||
error:
|
||||
if (ov->vdev) {
|
||||
if (-1 == ov->vdev->minor)
|
||||
if (!video_is_registered(ov->vdev))
|
||||
video_device_release(ov->vdev);
|
||||
else
|
||||
video_unregister_device(ov->vdev);
|
||||
|
|
|
@ -1880,7 +1880,7 @@ static void s2255_exit_v4l(struct s2255_dev *dev)
|
|||
|
||||
int i;
|
||||
for (i = 0; i < MAX_CHANNELS; i++) {
|
||||
if (-1 != dev->vdev[i]->minor) {
|
||||
if (video_is_registered(dev->vdev[i])) {
|
||||
video_unregister_device(dev->vdev[i]);
|
||||
printk(KERN_INFO "s2255 unregistered\n");
|
||||
} else {
|
||||
|
|
|
@ -803,21 +803,21 @@ static struct video_device *vdev_init(struct saa7134_dev *dev,
|
|||
static void saa7134_unregister_video(struct saa7134_dev *dev)
|
||||
{
|
||||
if (dev->video_dev) {
|
||||
if (-1 != dev->video_dev->minor)
|
||||
if (video_is_registered(dev->video_dev))
|
||||
video_unregister_device(dev->video_dev);
|
||||
else
|
||||
video_device_release(dev->video_dev);
|
||||
dev->video_dev = NULL;
|
||||
}
|
||||
if (dev->vbi_dev) {
|
||||
if (-1 != dev->vbi_dev->minor)
|
||||
if (video_is_registered(dev->vbi_dev))
|
||||
video_unregister_device(dev->vbi_dev);
|
||||
else
|
||||
video_device_release(dev->vbi_dev);
|
||||
dev->vbi_dev = NULL;
|
||||
}
|
||||
if (dev->radio_dev) {
|
||||
if (-1 != dev->radio_dev->minor)
|
||||
if (video_is_registered(dev->radio_dev))
|
||||
video_unregister_device(dev->radio_dev);
|
||||
else
|
||||
video_device_release(dev->radio_dev);
|
||||
|
|
|
@ -2134,7 +2134,7 @@ static void stradis_release_saa(struct pci_dev *pdev)
|
|||
free_irq(saa->irq, saa);
|
||||
if (saa->saa7146_mem)
|
||||
iounmap(saa->saa7146_mem);
|
||||
if (saa->video_dev.minor != -1)
|
||||
if (video_is_registered(&saa->video_dev))
|
||||
video_unregister_device(&saa->video_dev);
|
||||
}
|
||||
|
||||
|
|
|
@ -1418,7 +1418,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision)
|
|||
if (usbvision->vbi) {
|
||||
PDEBUG(DBG_PROBE, "unregister %s [v4l2]",
|
||||
video_device_node_name(usbvision->vbi));
|
||||
if (usbvision->vbi->minor != -1) {
|
||||
if (video_is_registered(usbvision->vbi)) {
|
||||
video_unregister_device(usbvision->vbi);
|
||||
} else {
|
||||
video_device_release(usbvision->vbi);
|
||||
|
@ -1430,7 +1430,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision)
|
|||
if (usbvision->rdev) {
|
||||
PDEBUG(DBG_PROBE, "unregister %s [v4l2]",
|
||||
video_device_node_name(usbvision->rdev));
|
||||
if (usbvision->rdev->minor != -1) {
|
||||
if (video_is_registered(usbvision->rdev)) {
|
||||
video_unregister_device(usbvision->rdev);
|
||||
} else {
|
||||
video_device_release(usbvision->rdev);
|
||||
|
@ -1442,7 +1442,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision)
|
|||
if (usbvision->vdev) {
|
||||
PDEBUG(DBG_PROBE, "unregister %s [v4l2]",
|
||||
video_device_node_name(usbvision->vdev));
|
||||
if (usbvision->vdev->minor != -1) {
|
||||
if (video_is_registered(usbvision->vdev)) {
|
||||
video_unregister_device(usbvision->vdev);
|
||||
} else {
|
||||
video_device_release(usbvision->vdev);
|
||||
|
|
|
@ -424,7 +424,7 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status)
|
|||
void cx25821_videoioctl_unregister(struct cx25821_dev *dev)
|
||||
{
|
||||
if (dev->ioctl_dev) {
|
||||
if (dev->ioctl_dev->minor != -1)
|
||||
if (video_is_registered(dev->ioctl_dev))
|
||||
video_unregister_device(dev->ioctl_dev);
|
||||
else
|
||||
video_device_release(dev->ioctl_dev);
|
||||
|
@ -438,7 +438,7 @@ void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num)
|
|||
cx_clear(PCI_INT_MSK, 1);
|
||||
|
||||
if (dev->video_dev[chan_num]) {
|
||||
if (-1 != dev->video_dev[chan_num]->minor)
|
||||
if (video_is_registered(dev->video_dev[chan_num]))
|
||||
video_unregister_device(dev->video_dev[chan_num]);
|
||||
else
|
||||
video_device_release(dev->video_dev[chan_num]);
|
||||
|
|
Загрузка…
Ссылка в новой задаче