diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-11-14 07:49:34 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-12-01 17:10:09 -0500 |
commit | d2c998f7453af7ad416bc38d09ae9d453d2fac5e (patch) | |
tree | 31f177781cb93f254c80c8c412c2339c4973df57 /drivers | |
parent | 725ea8cf1c1f5ba53177d20d2d2f6dbc139b643e (diff) |
[media] typhoon: convert to unlocked_ioctl
Convert the typhoon driver from ioctl to unlocked_ioctl.
When doing this I noticed a bug where curfreq was not initialized correctly
to mutefreq (it wasn't multiplied by 16).
The initialization is now also done before the device node is created.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/radio/radio-typhoon.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/media/radio/radio-typhoon.c b/drivers/media/radio/radio-typhoon.c index b1f630527dc1..8dbbf08f2207 100644 --- a/drivers/media/radio/radio-typhoon.c +++ b/drivers/media/radio/radio-typhoon.c | |||
@@ -317,7 +317,7 @@ static int vidioc_log_status(struct file *file, void *priv) | |||
317 | 317 | ||
318 | static const struct v4l2_file_operations typhoon_fops = { | 318 | static const struct v4l2_file_operations typhoon_fops = { |
319 | .owner = THIS_MODULE, | 319 | .owner = THIS_MODULE, |
320 | .ioctl = video_ioctl2, | 320 | .unlocked_ioctl = video_ioctl2, |
321 | }; | 321 | }; |
322 | 322 | ||
323 | static const struct v4l2_ioctl_ops typhoon_ioctl_ops = { | 323 | static const struct v4l2_ioctl_ops typhoon_ioctl_ops = { |
@@ -344,18 +344,18 @@ static int __init typhoon_init(void) | |||
344 | 344 | ||
345 | strlcpy(v4l2_dev->name, "typhoon", sizeof(v4l2_dev->name)); | 345 | strlcpy(v4l2_dev->name, "typhoon", sizeof(v4l2_dev->name)); |
346 | dev->io = io; | 346 | dev->io = io; |
347 | dev->curfreq = dev->mutefreq = mutefreq; | ||
348 | 347 | ||
349 | if (dev->io == -1) { | 348 | if (dev->io == -1) { |
350 | v4l2_err(v4l2_dev, "You must set an I/O address with io=0x316 or io=0x336\n"); | 349 | v4l2_err(v4l2_dev, "You must set an I/O address with io=0x316 or io=0x336\n"); |
351 | return -EINVAL; | 350 | return -EINVAL; |
352 | } | 351 | } |
353 | 352 | ||
354 | if (dev->mutefreq < 87000 || dev->mutefreq > 108500) { | 353 | if (mutefreq < 87000 || mutefreq > 108500) { |
355 | v4l2_err(v4l2_dev, "You must set a frequency (in kHz) used when muting the card,\n"); | 354 | v4l2_err(v4l2_dev, "You must set a frequency (in kHz) used when muting the card,\n"); |
356 | v4l2_err(v4l2_dev, "e.g. with \"mutefreq=87500\" (87000 <= mutefreq <= 108500)\n"); | 355 | v4l2_err(v4l2_dev, "e.g. with \"mutefreq=87500\" (87000 <= mutefreq <= 108500)\n"); |
357 | return -EINVAL; | 356 | return -EINVAL; |
358 | } | 357 | } |
358 | dev->curfreq = dev->mutefreq = mutefreq << 4; | ||
359 | 359 | ||
360 | mutex_init(&dev->lock); | 360 | mutex_init(&dev->lock); |
361 | if (!request_region(dev->io, 8, "typhoon")) { | 361 | if (!request_region(dev->io, 8, "typhoon")) { |
@@ -378,17 +378,17 @@ static int __init typhoon_init(void) | |||
378 | dev->vdev.ioctl_ops = &typhoon_ioctl_ops; | 378 | dev->vdev.ioctl_ops = &typhoon_ioctl_ops; |
379 | dev->vdev.release = video_device_release_empty; | 379 | dev->vdev.release = video_device_release_empty; |
380 | video_set_drvdata(&dev->vdev, dev); | 380 | video_set_drvdata(&dev->vdev, dev); |
381 | |||
382 | /* mute card - prevents noisy bootups */ | ||
383 | typhoon_mute(dev); | ||
384 | |||
381 | if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | 385 | if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { |
382 | v4l2_device_unregister(&dev->v4l2_dev); | 386 | v4l2_device_unregister(&dev->v4l2_dev); |
383 | release_region(dev->io, 8); | 387 | release_region(dev->io, 8); |
384 | return -EINVAL; | 388 | return -EINVAL; |
385 | } | 389 | } |
386 | v4l2_info(v4l2_dev, "port 0x%x.\n", dev->io); | 390 | v4l2_info(v4l2_dev, "port 0x%x.\n", dev->io); |
387 | v4l2_info(v4l2_dev, "mute frequency is %lu kHz.\n", dev->mutefreq); | 391 | v4l2_info(v4l2_dev, "mute frequency is %lu kHz.\n", mutefreq); |
388 | dev->mutefreq <<= 4; | ||
389 | |||
390 | /* mute card - prevents noisy bootups */ | ||
391 | typhoon_mute(dev); | ||
392 | 392 | ||
393 | return 0; | 393 | return 0; |
394 | } | 394 | } |