diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-11-14 07:36:23 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-12-01 17:10:05 -0500 |
commit | 32958fdd1663aeaa23b5edbfbb0db684ffd4e20e (patch) | |
tree | 849f927c20c352650b0d39110ac5d223941c4c44 /drivers | |
parent | e53beacd23d9cb47590da6a7a7f6d417b941a994 (diff) |
[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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/radio/radio-aimslab.c | 16 | ||||
-rw-r--r-- | drivers/media/radio/radio-aztech.c | 6 | ||||
-rw-r--r-- | drivers/media/radio/radio-gemtek-pci.c | 6 | ||||
-rw-r--r-- | drivers/media/radio/radio-gemtek.c | 14 | ||||
-rw-r--r-- | drivers/media/radio/radio-maestro.c | 14 | ||||
-rw-r--r-- | drivers/media/radio/radio-maxiradio.c | 2 | ||||
-rw-r--r-- | drivers/media/radio/radio-miropcm20.c | 6 | ||||
-rw-r--r-- | drivers/media/radio/radio-rtrack2.c | 10 | ||||
-rw-r--r-- | drivers/media/radio/radio-sf16fmi.c | 7 | ||||
-rw-r--r-- | drivers/media/radio/radio-sf16fmr2.c | 11 | ||||
-rw-r--r-- | drivers/media/radio/radio-terratec.c | 8 | ||||
-rw-r--r-- | drivers/media/radio/radio-trust.c | 18 | ||||
-rw-r--r-- | drivers/media/radio/radio-zoltrix.c | 30 |
13 files changed, 74 insertions, 74 deletions
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c index 5bf4985daede..05e832f61c3e 100644 --- a/drivers/media/radio/radio-aimslab.c +++ b/drivers/media/radio/radio-aimslab.c | |||
@@ -361,7 +361,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
361 | 361 | ||
362 | static const struct v4l2_file_operations rtrack_fops = { | 362 | static const struct v4l2_file_operations rtrack_fops = { |
363 | .owner = THIS_MODULE, | 363 | .owner = THIS_MODULE, |
364 | .ioctl = video_ioctl2, | 364 | .unlocked_ioctl = video_ioctl2, |
365 | }; | 365 | }; |
366 | 366 | ||
367 | static const struct v4l2_ioctl_ops rtrack_ioctl_ops = { | 367 | static const struct v4l2_ioctl_ops rtrack_ioctl_ops = { |
@@ -412,13 +412,6 @@ static int __init rtrack_init(void) | |||
412 | rt->vdev.release = video_device_release_empty; | 412 | rt->vdev.release = video_device_release_empty; |
413 | video_set_drvdata(&rt->vdev, rt); | 413 | video_set_drvdata(&rt->vdev, rt); |
414 | 414 | ||
415 | if (video_register_device(&rt->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
416 | v4l2_device_unregister(&rt->v4l2_dev); | ||
417 | release_region(rt->io, 2); | ||
418 | return -EINVAL; | ||
419 | } | ||
420 | v4l2_info(v4l2_dev, "AIMSlab RadioTrack/RadioReveal card driver.\n"); | ||
421 | |||
422 | /* Set up the I/O locking */ | 415 | /* Set up the I/O locking */ |
423 | 416 | ||
424 | mutex_init(&rt->lock); | 417 | mutex_init(&rt->lock); |
@@ -430,6 +423,13 @@ static int __init rtrack_init(void) | |||
430 | sleep_delay(2000000); /* make sure it's totally down */ | 423 | sleep_delay(2000000); /* make sure it's totally down */ |
431 | outb(0xc0, rt->io); /* steady volume, mute card */ | 424 | outb(0xc0, rt->io); /* steady volume, mute card */ |
432 | 425 | ||
426 | if (video_register_device(&rt->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
427 | v4l2_device_unregister(&rt->v4l2_dev); | ||
428 | release_region(rt->io, 2); | ||
429 | return -EINVAL; | ||
430 | } | ||
431 | v4l2_info(v4l2_dev, "AIMSlab RadioTrack/RadioReveal card driver.\n"); | ||
432 | |||
433 | return 0; | 433 | return 0; |
434 | } | 434 | } |
435 | 435 | ||
diff --git a/drivers/media/radio/radio-aztech.c b/drivers/media/radio/radio-aztech.c index c22311393624..dd8a6ab0d437 100644 --- a/drivers/media/radio/radio-aztech.c +++ b/drivers/media/radio/radio-aztech.c | |||
@@ -324,7 +324,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, | |||
324 | 324 | ||
325 | static const struct v4l2_file_operations aztech_fops = { | 325 | static const struct v4l2_file_operations aztech_fops = { |
326 | .owner = THIS_MODULE, | 326 | .owner = THIS_MODULE, |
327 | .ioctl = video_ioctl2, | 327 | .unlocked_ioctl = video_ioctl2, |
328 | }; | 328 | }; |
329 | 329 | ||
330 | static const struct v4l2_ioctl_ops aztech_ioctl_ops = { | 330 | static const struct v4l2_ioctl_ops aztech_ioctl_ops = { |
@@ -375,6 +375,8 @@ static int __init aztech_init(void) | |||
375 | az->vdev.ioctl_ops = &aztech_ioctl_ops; | 375 | az->vdev.ioctl_ops = &aztech_ioctl_ops; |
376 | az->vdev.release = video_device_release_empty; | 376 | az->vdev.release = video_device_release_empty; |
377 | video_set_drvdata(&az->vdev, az); | 377 | video_set_drvdata(&az->vdev, az); |
378 | /* mute card - prevents noisy bootups */ | ||
379 | outb(0, az->io); | ||
378 | 380 | ||
379 | if (video_register_device(&az->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | 381 | if (video_register_device(&az->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { |
380 | v4l2_device_unregister(v4l2_dev); | 382 | v4l2_device_unregister(v4l2_dev); |
@@ -383,8 +385,6 @@ static int __init aztech_init(void) | |||
383 | } | 385 | } |
384 | 386 | ||
385 | v4l2_info(v4l2_dev, "Aztech radio card driver v1.00/19990224 rkroll@exploits.org\n"); | 387 | v4l2_info(v4l2_dev, "Aztech radio card driver v1.00/19990224 rkroll@exploits.org\n"); |
386 | /* mute card - prevents noisy bootups */ | ||
387 | outb(0, az->io); | ||
388 | return 0; | 388 | return 0; |
389 | } | 389 | } |
390 | 390 | ||
diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c index 79039674a0e0..28fa85ba2087 100644 --- a/drivers/media/radio/radio-gemtek-pci.c +++ b/drivers/media/radio/radio-gemtek-pci.c | |||
@@ -361,7 +361,7 @@ MODULE_DEVICE_TABLE(pci, gemtek_pci_id); | |||
361 | 361 | ||
362 | static const struct v4l2_file_operations gemtek_pci_fops = { | 362 | static const struct v4l2_file_operations gemtek_pci_fops = { |
363 | .owner = THIS_MODULE, | 363 | .owner = THIS_MODULE, |
364 | .ioctl = video_ioctl2, | 364 | .unlocked_ioctl = video_ioctl2, |
365 | }; | 365 | }; |
366 | 366 | ||
367 | static const struct v4l2_ioctl_ops gemtek_pci_ioctl_ops = { | 367 | static const struct v4l2_ioctl_ops gemtek_pci_ioctl_ops = { |
@@ -422,11 +422,11 @@ static int __devinit gemtek_pci_probe(struct pci_dev *pdev, const struct pci_dev | |||
422 | card->vdev.release = video_device_release_empty; | 422 | card->vdev.release = video_device_release_empty; |
423 | video_set_drvdata(&card->vdev, card); | 423 | video_set_drvdata(&card->vdev, card); |
424 | 424 | ||
425 | gemtek_pci_mute(card); | ||
426 | |||
425 | if (video_register_device(&card->vdev, VFL_TYPE_RADIO, nr_radio) < 0) | 427 | if (video_register_device(&card->vdev, VFL_TYPE_RADIO, nr_radio) < 0) |
426 | goto err_video; | 428 | goto err_video; |
427 | 429 | ||
428 | gemtek_pci_mute(card); | ||
429 | |||
430 | v4l2_info(v4l2_dev, "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n", | 430 | v4l2_info(v4l2_dev, "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n", |
431 | pdev->revision, card->iobase, card->iobase + card->length - 1); | 431 | pdev->revision, card->iobase, card->iobase + card->length - 1); |
432 | 432 | ||
diff --git a/drivers/media/radio/radio-gemtek.c b/drivers/media/radio/radio-gemtek.c index 73985f641f07..259936422e49 100644 --- a/drivers/media/radio/radio-gemtek.c +++ b/drivers/media/radio/radio-gemtek.c | |||
@@ -378,7 +378,7 @@ static int gemtek_probe(struct gemtek *gt) | |||
378 | 378 | ||
379 | static const struct v4l2_file_operations gemtek_fops = { | 379 | static const struct v4l2_file_operations gemtek_fops = { |
380 | .owner = THIS_MODULE, | 380 | .owner = THIS_MODULE, |
381 | .ioctl = video_ioctl2, | 381 | .unlocked_ioctl = video_ioctl2, |
382 | }; | 382 | }; |
383 | 383 | ||
384 | static int vidioc_querycap(struct file *file, void *priv, | 384 | static int vidioc_querycap(struct file *file, void *priv, |
@@ -577,12 +577,6 @@ static int __init gemtek_init(void) | |||
577 | gt->vdev.release = video_device_release_empty; | 577 | gt->vdev.release = video_device_release_empty; |
578 | video_set_drvdata(>->vdev, gt); | 578 | video_set_drvdata(>->vdev, gt); |
579 | 579 | ||
580 | if (video_register_device(>->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
581 | v4l2_device_unregister(v4l2_dev); | ||
582 | release_region(gt->io, 1); | ||
583 | return -EBUSY; | ||
584 | } | ||
585 | |||
586 | /* Set defaults */ | 580 | /* Set defaults */ |
587 | gt->lastfreq = GEMTEK_LOWFREQ; | 581 | gt->lastfreq = GEMTEK_LOWFREQ; |
588 | gt->bu2614data = 0; | 582 | gt->bu2614data = 0; |
@@ -590,6 +584,12 @@ static int __init gemtek_init(void) | |||
590 | if (initmute) | 584 | if (initmute) |
591 | gemtek_mute(gt); | 585 | gemtek_mute(gt); |
592 | 586 | ||
587 | if (video_register_device(>->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
588 | v4l2_device_unregister(v4l2_dev); | ||
589 | release_region(gt->io, 1); | ||
590 | return -EBUSY; | ||
591 | } | ||
592 | |||
593 | return 0; | 593 | return 0; |
594 | } | 594 | } |
595 | 595 | ||
diff --git a/drivers/media/radio/radio-maestro.c b/drivers/media/radio/radio-maestro.c index 08f1051979ca..6af61bfeb178 100644 --- a/drivers/media/radio/radio-maestro.c +++ b/drivers/media/radio/radio-maestro.c | |||
@@ -299,7 +299,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
299 | 299 | ||
300 | static const struct v4l2_file_operations maestro_fops = { | 300 | static const struct v4l2_file_operations maestro_fops = { |
301 | .owner = THIS_MODULE, | 301 | .owner = THIS_MODULE, |
302 | .ioctl = video_ioctl2, | 302 | .unlocked_ioctl = video_ioctl2, |
303 | }; | 303 | }; |
304 | 304 | ||
305 | static const struct v4l2_ioctl_ops maestro_ioctl_ops = { | 305 | static const struct v4l2_ioctl_ops maestro_ioctl_ops = { |
@@ -383,22 +383,20 @@ static int __devinit maestro_probe(struct pci_dev *pdev, | |||
383 | dev->vdev.release = video_device_release_empty; | 383 | dev->vdev.release = video_device_release_empty; |
384 | video_set_drvdata(&dev->vdev, dev); | 384 | video_set_drvdata(&dev->vdev, dev); |
385 | 385 | ||
386 | if (!radio_power_on(dev)) { | ||
387 | retval = -EIO; | ||
388 | goto errfr1; | ||
389 | } | ||
390 | |||
386 | retval = video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr); | 391 | retval = video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr); |
387 | if (retval) { | 392 | if (retval) { |
388 | v4l2_err(v4l2_dev, "can't register video device!\n"); | 393 | v4l2_err(v4l2_dev, "can't register video device!\n"); |
389 | goto errfr1; | 394 | goto errfr1; |
390 | } | 395 | } |
391 | 396 | ||
392 | if (!radio_power_on(dev)) { | ||
393 | retval = -EIO; | ||
394 | goto errunr; | ||
395 | } | ||
396 | |||
397 | v4l2_info(v4l2_dev, "version " DRIVER_VERSION "\n"); | 397 | v4l2_info(v4l2_dev, "version " DRIVER_VERSION "\n"); |
398 | 398 | ||
399 | return 0; | 399 | return 0; |
400 | errunr: | ||
401 | video_unregister_device(&dev->vdev); | ||
402 | errfr1: | 400 | errfr1: |
403 | v4l2_device_unregister(v4l2_dev); | 401 | v4l2_device_unregister(v4l2_dev); |
404 | errfr: | 402 | errfr: |
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c index 255d40df4b46..6459a220b0dd 100644 --- a/drivers/media/radio/radio-maxiradio.c +++ b/drivers/media/radio/radio-maxiradio.c | |||
@@ -346,7 +346,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, | |||
346 | 346 | ||
347 | static const struct v4l2_file_operations maxiradio_fops = { | 347 | static const struct v4l2_file_operations maxiradio_fops = { |
348 | .owner = THIS_MODULE, | 348 | .owner = THIS_MODULE, |
349 | .ioctl = video_ioctl2, | 349 | .unlocked_ioctl = video_ioctl2, |
350 | }; | 350 | }; |
351 | 351 | ||
352 | static const struct v4l2_ioctl_ops maxiradio_ioctl_ops = { | 352 | static const struct v4l2_ioctl_ops maxiradio_ioctl_ops = { |
diff --git a/drivers/media/radio/radio-miropcm20.c b/drivers/media/radio/radio-miropcm20.c index 4ff885445fd4..3fb76e3834c9 100644 --- a/drivers/media/radio/radio-miropcm20.c +++ b/drivers/media/radio/radio-miropcm20.c | |||
@@ -33,6 +33,7 @@ struct pcm20 { | |||
33 | unsigned long freq; | 33 | unsigned long freq; |
34 | int muted; | 34 | int muted; |
35 | struct snd_miro_aci *aci; | 35 | struct snd_miro_aci *aci; |
36 | struct mutex lock; | ||
36 | }; | 37 | }; |
37 | 38 | ||
38 | static struct pcm20 pcm20_card = { | 39 | static struct pcm20 pcm20_card = { |
@@ -72,7 +73,7 @@ static int pcm20_setfreq(struct pcm20 *dev, unsigned long freq) | |||
72 | 73 | ||
73 | static const struct v4l2_file_operations pcm20_fops = { | 74 | static const struct v4l2_file_operations pcm20_fops = { |
74 | .owner = THIS_MODULE, | 75 | .owner = THIS_MODULE, |
75 | .ioctl = video_ioctl2, | 76 | .unlocked_ioctl = video_ioctl2, |
76 | }; | 77 | }; |
77 | 78 | ||
78 | static int vidioc_querycap(struct file *file, void *priv, | 79 | static int vidioc_querycap(struct file *file, void *priv, |
@@ -229,7 +230,7 @@ static int __init pcm20_init(void) | |||
229 | return -ENODEV; | 230 | return -ENODEV; |
230 | } | 231 | } |
231 | strlcpy(v4l2_dev->name, "miropcm20", sizeof(v4l2_dev->name)); | 232 | strlcpy(v4l2_dev->name, "miropcm20", sizeof(v4l2_dev->name)); |
232 | 233 | mutex_init(&dev->lock); | |
233 | 234 | ||
234 | res = v4l2_device_register(NULL, v4l2_dev); | 235 | res = v4l2_device_register(NULL, v4l2_dev); |
235 | if (res < 0) { | 236 | if (res < 0) { |
@@ -242,6 +243,7 @@ static int __init pcm20_init(void) | |||
242 | dev->vdev.fops = &pcm20_fops; | 243 | dev->vdev.fops = &pcm20_fops; |
243 | dev->vdev.ioctl_ops = &pcm20_ioctl_ops; | 244 | dev->vdev.ioctl_ops = &pcm20_ioctl_ops; |
244 | dev->vdev.release = video_device_release_empty; | 245 | dev->vdev.release = video_device_release_empty; |
246 | dev->vdev.lock = &dev->lock; | ||
245 | video_set_drvdata(&dev->vdev, dev); | 247 | video_set_drvdata(&dev->vdev, dev); |
246 | 248 | ||
247 | if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) | 249 | if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) |
diff --git a/drivers/media/radio/radio-rtrack2.c b/drivers/media/radio/radio-rtrack2.c index a79296aac9a9..8d6ea591bd18 100644 --- a/drivers/media/radio/radio-rtrack2.c +++ b/drivers/media/radio/radio-rtrack2.c | |||
@@ -266,7 +266,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
266 | 266 | ||
267 | static const struct v4l2_file_operations rtrack2_fops = { | 267 | static const struct v4l2_file_operations rtrack2_fops = { |
268 | .owner = THIS_MODULE, | 268 | .owner = THIS_MODULE, |
269 | .ioctl = video_ioctl2, | 269 | .unlocked_ioctl = video_ioctl2, |
270 | }; | 270 | }; |
271 | 271 | ||
272 | static const struct v4l2_ioctl_ops rtrack2_ioctl_ops = { | 272 | static const struct v4l2_ioctl_ops rtrack2_ioctl_ops = { |
@@ -315,6 +315,10 @@ static int __init rtrack2_init(void) | |||
315 | dev->vdev.release = video_device_release_empty; | 315 | dev->vdev.release = video_device_release_empty; |
316 | video_set_drvdata(&dev->vdev, dev); | 316 | video_set_drvdata(&dev->vdev, dev); |
317 | 317 | ||
318 | /* mute card - prevents noisy bootups */ | ||
319 | outb(1, dev->io); | ||
320 | dev->muted = 1; | ||
321 | |||
318 | mutex_init(&dev->lock); | 322 | mutex_init(&dev->lock); |
319 | if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | 323 | if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { |
320 | v4l2_device_unregister(v4l2_dev); | 324 | v4l2_device_unregister(v4l2_dev); |
@@ -324,10 +328,6 @@ static int __init rtrack2_init(void) | |||
324 | 328 | ||
325 | v4l2_info(v4l2_dev, "AIMSlab Radiotrack II card driver.\n"); | 329 | v4l2_info(v4l2_dev, "AIMSlab Radiotrack II card driver.\n"); |
326 | 330 | ||
327 | /* mute card - prevents noisy bootups */ | ||
328 | outb(1, dev->io); | ||
329 | dev->muted = 1; | ||
330 | |||
331 | return 0; | 331 | return 0; |
332 | } | 332 | } |
333 | 333 | ||
diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c index 985359d18aa5..b5a5f89e238a 100644 --- a/drivers/media/radio/radio-sf16fmi.c +++ b/drivers/media/radio/radio-sf16fmi.c | |||
@@ -260,7 +260,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
260 | 260 | ||
261 | static const struct v4l2_file_operations fmi_fops = { | 261 | static const struct v4l2_file_operations fmi_fops = { |
262 | .owner = THIS_MODULE, | 262 | .owner = THIS_MODULE, |
263 | .ioctl = video_ioctl2, | 263 | .unlocked_ioctl = video_ioctl2, |
264 | }; | 264 | }; |
265 | 265 | ||
266 | static const struct v4l2_ioctl_ops fmi_ioctl_ops = { | 266 | static const struct v4l2_ioctl_ops fmi_ioctl_ops = { |
@@ -382,6 +382,9 @@ static int __init fmi_init(void) | |||
382 | 382 | ||
383 | mutex_init(&fmi->lock); | 383 | mutex_init(&fmi->lock); |
384 | 384 | ||
385 | /* mute card - prevents noisy bootups */ | ||
386 | fmi_mute(fmi); | ||
387 | |||
385 | if (video_register_device(&fmi->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | 388 | if (video_register_device(&fmi->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { |
386 | v4l2_device_unregister(v4l2_dev); | 389 | v4l2_device_unregister(v4l2_dev); |
387 | release_region(fmi->io, 2); | 390 | release_region(fmi->io, 2); |
@@ -391,8 +394,6 @@ static int __init fmi_init(void) | |||
391 | } | 394 | } |
392 | 395 | ||
393 | v4l2_info(v4l2_dev, "card driver at 0x%x\n", fmi->io); | 396 | v4l2_info(v4l2_dev, "card driver at 0x%x\n", fmi->io); |
394 | /* mute card - prevents noisy bootups */ | ||
395 | fmi_mute(fmi); | ||
396 | return 0; | 397 | return 0; |
397 | } | 398 | } |
398 | 399 | ||
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c index 52c7bbb32b8b..dc3f04c52d5e 100644 --- a/drivers/media/radio/radio-sf16fmr2.c +++ b/drivers/media/radio/radio-sf16fmr2.c | |||
@@ -376,7 +376,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
376 | 376 | ||
377 | static const struct v4l2_file_operations fmr2_fops = { | 377 | static const struct v4l2_file_operations fmr2_fops = { |
378 | .owner = THIS_MODULE, | 378 | .owner = THIS_MODULE, |
379 | .ioctl = video_ioctl2, | 379 | .unlocked_ioctl = video_ioctl2, |
380 | }; | 380 | }; |
381 | 381 | ||
382 | static const struct v4l2_ioctl_ops fmr2_ioctl_ops = { | 382 | static const struct v4l2_ioctl_ops fmr2_ioctl_ops = { |
@@ -424,6 +424,10 @@ static int __init fmr2_init(void) | |||
424 | fmr2->vdev.release = video_device_release_empty; | 424 | fmr2->vdev.release = video_device_release_empty; |
425 | video_set_drvdata(&fmr2->vdev, fmr2); | 425 | video_set_drvdata(&fmr2->vdev, fmr2); |
426 | 426 | ||
427 | /* mute card - prevents noisy bootups */ | ||
428 | fmr2_mute(fmr2->io); | ||
429 | fmr2_product_info(fmr2); | ||
430 | |||
427 | if (video_register_device(&fmr2->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | 431 | if (video_register_device(&fmr2->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { |
428 | v4l2_device_unregister(v4l2_dev); | 432 | v4l2_device_unregister(v4l2_dev); |
429 | release_region(fmr2->io, 2); | 433 | release_region(fmr2->io, 2); |
@@ -431,11 +435,6 @@ static int __init fmr2_init(void) | |||
431 | } | 435 | } |
432 | 436 | ||
433 | v4l2_info(v4l2_dev, "SF16FMR2 radio card driver at 0x%x.\n", fmr2->io); | 437 | v4l2_info(v4l2_dev, "SF16FMR2 radio card driver at 0x%x.\n", fmr2->io); |
434 | /* mute card - prevents noisy bootups */ | ||
435 | mutex_lock(&fmr2->lock); | ||
436 | fmr2_mute(fmr2->io); | ||
437 | fmr2_product_info(fmr2); | ||
438 | mutex_unlock(&fmr2->lock); | ||
439 | debug_print((KERN_DEBUG "card_type %d\n", fmr2->card_type)); | 438 | debug_print((KERN_DEBUG "card_type %d\n", fmr2->card_type)); |
440 | return 0; | 439 | return 0; |
441 | } | 440 | } |
diff --git a/drivers/media/radio/radio-terratec.c b/drivers/media/radio/radio-terratec.c index fc1c860fd438..a32663917059 100644 --- a/drivers/media/radio/radio-terratec.c +++ b/drivers/media/radio/radio-terratec.c | |||
@@ -338,7 +338,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
338 | 338 | ||
339 | static const struct v4l2_file_operations terratec_fops = { | 339 | static const struct v4l2_file_operations terratec_fops = { |
340 | .owner = THIS_MODULE, | 340 | .owner = THIS_MODULE, |
341 | .ioctl = video_ioctl2, | 341 | .unlocked_ioctl = video_ioctl2, |
342 | }; | 342 | }; |
343 | 343 | ||
344 | static const struct v4l2_ioctl_ops terratec_ioctl_ops = { | 344 | static const struct v4l2_ioctl_ops terratec_ioctl_ops = { |
@@ -389,6 +389,9 @@ static int __init terratec_init(void) | |||
389 | 389 | ||
390 | mutex_init(&tt->lock); | 390 | mutex_init(&tt->lock); |
391 | 391 | ||
392 | /* mute card - prevents noisy bootups */ | ||
393 | tt_write_vol(tt, 0); | ||
394 | |||
392 | if (video_register_device(&tt->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | 395 | if (video_register_device(&tt->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { |
393 | v4l2_device_unregister(&tt->v4l2_dev); | 396 | v4l2_device_unregister(&tt->v4l2_dev); |
394 | release_region(tt->io, 2); | 397 | release_region(tt->io, 2); |
@@ -396,9 +399,6 @@ static int __init terratec_init(void) | |||
396 | } | 399 | } |
397 | 400 | ||
398 | v4l2_info(v4l2_dev, "TERRATEC ActivRadio Standalone card driver.\n"); | 401 | v4l2_info(v4l2_dev, "TERRATEC ActivRadio Standalone card driver.\n"); |
399 | |||
400 | /* mute card - prevents noisy bootups */ | ||
401 | tt_write_vol(tt, 0); | ||
402 | return 0; | 402 | return 0; |
403 | } | 403 | } |
404 | 404 | ||
diff --git a/drivers/media/radio/radio-trust.c b/drivers/media/radio/radio-trust.c index 9d6dcf8af5b0..22fa9cc28abe 100644 --- a/drivers/media/radio/radio-trust.c +++ b/drivers/media/radio/radio-trust.c | |||
@@ -344,7 +344,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
344 | 344 | ||
345 | static const struct v4l2_file_operations trust_fops = { | 345 | static const struct v4l2_file_operations trust_fops = { |
346 | .owner = THIS_MODULE, | 346 | .owner = THIS_MODULE, |
347 | .ioctl = video_ioctl2, | 347 | .unlocked_ioctl = video_ioctl2, |
348 | }; | 348 | }; |
349 | 349 | ||
350 | static const struct v4l2_ioctl_ops trust_ioctl_ops = { | 350 | static const struct v4l2_ioctl_ops trust_ioctl_ops = { |
@@ -396,14 +396,6 @@ static int __init trust_init(void) | |||
396 | tr->vdev.release = video_device_release_empty; | 396 | tr->vdev.release = video_device_release_empty; |
397 | video_set_drvdata(&tr->vdev, tr); | 397 | video_set_drvdata(&tr->vdev, tr); |
398 | 398 | ||
399 | if (video_register_device(&tr->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
400 | v4l2_device_unregister(v4l2_dev); | ||
401 | release_region(tr->io, 2); | ||
402 | return -EINVAL; | ||
403 | } | ||
404 | |||
405 | v4l2_info(v4l2_dev, "Trust FM Radio card driver v1.0.\n"); | ||
406 | |||
407 | write_i2c(tr, 2, TDA7318_ADDR, 0x80); /* speaker att. LF = 0 dB */ | 399 | write_i2c(tr, 2, TDA7318_ADDR, 0x80); /* speaker att. LF = 0 dB */ |
408 | write_i2c(tr, 2, TDA7318_ADDR, 0xa0); /* speaker att. RF = 0 dB */ | 400 | write_i2c(tr, 2, TDA7318_ADDR, 0xa0); /* speaker att. RF = 0 dB */ |
409 | write_i2c(tr, 2, TDA7318_ADDR, 0xc0); /* speaker att. LR = 0 dB */ | 401 | write_i2c(tr, 2, TDA7318_ADDR, 0xc0); /* speaker att. LR = 0 dB */ |
@@ -418,6 +410,14 @@ static int __init trust_init(void) | |||
418 | /* mute card - prevents noisy bootups */ | 410 | /* mute card - prevents noisy bootups */ |
419 | tr_setmute(tr, 1); | 411 | tr_setmute(tr, 1); |
420 | 412 | ||
413 | if (video_register_device(&tr->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
414 | v4l2_device_unregister(v4l2_dev); | ||
415 | release_region(tr->io, 2); | ||
416 | return -EINVAL; | ||
417 | } | ||
418 | |||
419 | v4l2_info(v4l2_dev, "Trust FM Radio card driver v1.0.\n"); | ||
420 | |||
421 | return 0; | 421 | return 0; |
422 | } | 422 | } |
423 | 423 | ||
diff --git a/drivers/media/radio/radio-zoltrix.c b/drivers/media/radio/radio-zoltrix.c index f31eab99c943..af99c5bd88c1 100644 --- a/drivers/media/radio/radio-zoltrix.c +++ b/drivers/media/radio/radio-zoltrix.c | |||
@@ -377,7 +377,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
377 | static const struct v4l2_file_operations zoltrix_fops = | 377 | static const struct v4l2_file_operations zoltrix_fops = |
378 | { | 378 | { |
379 | .owner = THIS_MODULE, | 379 | .owner = THIS_MODULE, |
380 | .ioctl = video_ioctl2, | 380 | .unlocked_ioctl = video_ioctl2, |
381 | }; | 381 | }; |
382 | 382 | ||
383 | static const struct v4l2_ioctl_ops zoltrix_ioctl_ops = { | 383 | static const struct v4l2_ioctl_ops zoltrix_ioctl_ops = { |
@@ -424,20 +424,6 @@ static int __init zoltrix_init(void) | |||
424 | return res; | 424 | return res; |
425 | } | 425 | } |
426 | 426 | ||
427 | strlcpy(zol->vdev.name, v4l2_dev->name, sizeof(zol->vdev.name)); | ||
428 | zol->vdev.v4l2_dev = v4l2_dev; | ||
429 | zol->vdev.fops = &zoltrix_fops; | ||
430 | zol->vdev.ioctl_ops = &zoltrix_ioctl_ops; | ||
431 | zol->vdev.release = video_device_release_empty; | ||
432 | video_set_drvdata(&zol->vdev, zol); | ||
433 | |||
434 | if (video_register_device(&zol->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
435 | v4l2_device_unregister(v4l2_dev); | ||
436 | release_region(zol->io, 2); | ||
437 | return -EINVAL; | ||
438 | } | ||
439 | v4l2_info(v4l2_dev, "Zoltrix Radio Plus card driver.\n"); | ||
440 | |||
441 | mutex_init(&zol->lock); | 427 | mutex_init(&zol->lock); |
442 | 428 | ||
443 | /* mute card - prevents noisy bootups */ | 429 | /* mute card - prevents noisy bootups */ |
@@ -452,6 +438,20 @@ static int __init zoltrix_init(void) | |||
452 | zol->curvol = 0; | 438 | zol->curvol = 0; |
453 | zol->stereo = 1; | 439 | zol->stereo = 1; |
454 | 440 | ||
441 | strlcpy(zol->vdev.name, v4l2_dev->name, sizeof(zol->vdev.name)); | ||
442 | zol->vdev.v4l2_dev = v4l2_dev; | ||
443 | zol->vdev.fops = &zoltrix_fops; | ||
444 | zol->vdev.ioctl_ops = &zoltrix_ioctl_ops; | ||
445 | zol->vdev.release = video_device_release_empty; | ||
446 | video_set_drvdata(&zol->vdev, zol); | ||
447 | |||
448 | if (video_register_device(&zol->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
449 | v4l2_device_unregister(v4l2_dev); | ||
450 | release_region(zol->io, 2); | ||
451 | return -EINVAL; | ||
452 | } | ||
453 | v4l2_info(v4l2_dev, "Zoltrix Radio Plus card driver.\n"); | ||
454 | |||
455 | return 0; | 455 | return 0; |
456 | } | 456 | } |
457 | 457 | ||