[media] BKL: trivial BKL removal from V4L2 radio drivers
The patch converts a bunch of V4L2 radio drivers to unlocked_ioctl. These are all simple conversions: most already had a lock and so the ioctl fop could simply be replaced by unlocked_ioctl. radio-miropcm20.c was converted to use the new V4L2 core lock. While doing this work I noticed that many of these drivers initialized some more fields or muted audio or something like that *after* creating the device node. This should be done before the device node is created to prevent problems. Especially hal tends to grab a device node as soon as it is created. In one or two cases the mutex_init was even done after the device creation! Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:

committed by
Mauro Carvalho Chehab

parent
e53beacd23
commit
32958fdd16
@@ -377,7 +377,7 @@ static int vidioc_s_audio(struct file *file, void *priv,
|
||||
static const struct v4l2_file_operations zoltrix_fops =
|
||||
{
|
||||
.owner = THIS_MODULE,
|
||||
.ioctl = video_ioctl2,
|
||||
.unlocked_ioctl = video_ioctl2,
|
||||
};
|
||||
|
||||
static const struct v4l2_ioctl_ops zoltrix_ioctl_ops = {
|
||||
@@ -424,20 +424,6 @@ static int __init zoltrix_init(void)
|
||||
return res;
|
||||
}
|
||||
|
||||
strlcpy(zol->vdev.name, v4l2_dev->name, sizeof(zol->vdev.name));
|
||||
zol->vdev.v4l2_dev = v4l2_dev;
|
||||
zol->vdev.fops = &zoltrix_fops;
|
||||
zol->vdev.ioctl_ops = &zoltrix_ioctl_ops;
|
||||
zol->vdev.release = video_device_release_empty;
|
||||
video_set_drvdata(&zol->vdev, zol);
|
||||
|
||||
if (video_register_device(&zol->vdev, VFL_TYPE_RADIO, radio_nr) < 0) {
|
||||
v4l2_device_unregister(v4l2_dev);
|
||||
release_region(zol->io, 2);
|
||||
return -EINVAL;
|
||||
}
|
||||
v4l2_info(v4l2_dev, "Zoltrix Radio Plus card driver.\n");
|
||||
|
||||
mutex_init(&zol->lock);
|
||||
|
||||
/* mute card - prevents noisy bootups */
|
||||
@@ -452,6 +438,20 @@ static int __init zoltrix_init(void)
|
||||
zol->curvol = 0;
|
||||
zol->stereo = 1;
|
||||
|
||||
strlcpy(zol->vdev.name, v4l2_dev->name, sizeof(zol->vdev.name));
|
||||
zol->vdev.v4l2_dev = v4l2_dev;
|
||||
zol->vdev.fops = &zoltrix_fops;
|
||||
zol->vdev.ioctl_ops = &zoltrix_ioctl_ops;
|
||||
zol->vdev.release = video_device_release_empty;
|
||||
video_set_drvdata(&zol->vdev, zol);
|
||||
|
||||
if (video_register_device(&zol->vdev, VFL_TYPE_RADIO, radio_nr) < 0) {
|
||||
v4l2_device_unregister(v4l2_dev);
|
||||
release_region(zol->io, 2);
|
||||
return -EINVAL;
|
||||
}
|
||||
v4l2_info(v4l2_dev, "Zoltrix Radio Plus card driver.\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user