diff options
Diffstat (limited to 'drivers/media/radio')
-rw-r--r-- | drivers/media/radio/dsbr100.c | 88 | ||||
-rw-r--r-- | drivers/media/radio/radio-aimslab.c | 12 | ||||
-rw-r--r-- | drivers/media/radio/radio-aztech.c | 12 | ||||
-rw-r--r-- | drivers/media/radio/radio-gemtek-pci.c | 12 | ||||
-rw-r--r-- | drivers/media/radio/radio-gemtek.c | 11 | ||||
-rw-r--r-- | drivers/media/radio/radio-maestro.c | 12 | ||||
-rw-r--r-- | drivers/media/radio/radio-maxiradio.c | 12 | ||||
-rw-r--r-- | drivers/media/radio/radio-mr800.c | 85 | ||||
-rw-r--r-- | drivers/media/radio/radio-rtrack2.c | 12 | ||||
-rw-r--r-- | drivers/media/radio/radio-sf16fmi.c | 12 | ||||
-rw-r--r-- | drivers/media/radio/radio-sf16fmr2.c | 12 | ||||
-rw-r--r-- | drivers/media/radio/radio-si470x.c | 9 | ||||
-rw-r--r-- | drivers/media/radio/radio-terratec.c | 12 | ||||
-rw-r--r-- | drivers/media/radio/radio-trust.c | 12 | ||||
-rw-r--r-- | drivers/media/radio/radio-typhoon.c | 12 | ||||
-rw-r--r-- | drivers/media/radio/radio-zoltrix.c | 12 |
16 files changed, 72 insertions, 265 deletions
diff --git a/drivers/media/radio/dsbr100.c b/drivers/media/radio/dsbr100.c index cc54ed4efc48..613576202294 100644 --- a/drivers/media/radio/dsbr100.c +++ b/drivers/media/radio/dsbr100.c | |||
@@ -33,6 +33,9 @@ | |||
33 | 33 | ||
34 | History: | 34 | History: |
35 | 35 | ||
36 | Version 0.45: | ||
37 | Converted to v4l2_device. | ||
38 | |||
36 | Version 0.44: | 39 | Version 0.44: |
37 | Add suspend/resume functions, fix unplug of device, | 40 | Add suspend/resume functions, fix unplug of device, |
38 | a lot of cleanups and fixes by Alexey Klimov <klimov.linux@gmail.com> | 41 | a lot of cleanups and fixes by Alexey Klimov <klimov.linux@gmail.com> |
@@ -88,7 +91,7 @@ | |||
88 | #include <linux/slab.h> | 91 | #include <linux/slab.h> |
89 | #include <linux/input.h> | 92 | #include <linux/input.h> |
90 | #include <linux/videodev2.h> | 93 | #include <linux/videodev2.h> |
91 | #include <media/v4l2-common.h> | 94 | #include <media/v4l2-device.h> |
92 | #include <media/v4l2-ioctl.h> | 95 | #include <media/v4l2-ioctl.h> |
93 | #include <linux/usb.h> | 96 | #include <linux/usb.h> |
94 | 97 | ||
@@ -97,39 +100,8 @@ | |||
97 | */ | 100 | */ |
98 | #include <linux/version.h> /* for KERNEL_VERSION MACRO */ | 101 | #include <linux/version.h> /* for KERNEL_VERSION MACRO */ |
99 | 102 | ||
100 | #define DRIVER_VERSION "v0.44" | 103 | #define DRIVER_VERSION "v0.45" |
101 | #define RADIO_VERSION KERNEL_VERSION(0, 4, 4) | 104 | #define RADIO_VERSION KERNEL_VERSION(0, 4, 5) |
102 | |||
103 | static struct v4l2_queryctrl radio_qctrl[] = { | ||
104 | { | ||
105 | .id = V4L2_CID_AUDIO_MUTE, | ||
106 | .name = "Mute", | ||
107 | .minimum = 0, | ||
108 | .maximum = 1, | ||
109 | .default_value = 1, | ||
110 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
111 | }, | ||
112 | /* HINT: the disabled controls are only here to satify kradio and such apps */ | ||
113 | { .id = V4L2_CID_AUDIO_VOLUME, | ||
114 | .flags = V4L2_CTRL_FLAG_DISABLED, | ||
115 | }, | ||
116 | { | ||
117 | .id = V4L2_CID_AUDIO_BALANCE, | ||
118 | .flags = V4L2_CTRL_FLAG_DISABLED, | ||
119 | }, | ||
120 | { | ||
121 | .id = V4L2_CID_AUDIO_BASS, | ||
122 | .flags = V4L2_CTRL_FLAG_DISABLED, | ||
123 | }, | ||
124 | { | ||
125 | .id = V4L2_CID_AUDIO_TREBLE, | ||
126 | .flags = V4L2_CTRL_FLAG_DISABLED, | ||
127 | }, | ||
128 | { | ||
129 | .id = V4L2_CID_AUDIO_LOUDNESS, | ||
130 | .flags = V4L2_CTRL_FLAG_DISABLED, | ||
131 | }, | ||
132 | }; | ||
133 | 105 | ||
134 | #define DRIVER_AUTHOR "Markus Demleitner <msdemlei@tucana.harvard.edu>" | 106 | #define DRIVER_AUTHOR "Markus Demleitner <msdemlei@tucana.harvard.edu>" |
135 | #define DRIVER_DESC "D-Link DSB-R100 USB FM radio driver" | 107 | #define DRIVER_DESC "D-Link DSB-R100 USB FM radio driver" |
@@ -167,6 +139,8 @@ module_param(radio_nr, int, 0); | |||
167 | struct dsbr100_device { | 139 | struct dsbr100_device { |
168 | struct usb_device *usbdev; | 140 | struct usb_device *usbdev; |
169 | struct video_device videodev; | 141 | struct video_device videodev; |
142 | struct v4l2_device v4l2_dev; | ||
143 | |||
170 | u8 *transfer_buffer; | 144 | u8 *transfer_buffer; |
171 | struct mutex lock; /* buffer locking */ | 145 | struct mutex lock; /* buffer locking */ |
172 | int curfreq; | 146 | int curfreq; |
@@ -384,6 +358,7 @@ static void usb_dsbr100_disconnect(struct usb_interface *intf) | |||
384 | mutex_unlock(&radio->lock); | 358 | mutex_unlock(&radio->lock); |
385 | 359 | ||
386 | video_unregister_device(&radio->videodev); | 360 | video_unregister_device(&radio->videodev); |
361 | v4l2_device_disconnect(&radio->v4l2_dev); | ||
387 | } | 362 | } |
388 | 363 | ||
389 | 364 | ||
@@ -479,14 +454,11 @@ static int vidioc_g_frequency(struct file *file, void *priv, | |||
479 | static int vidioc_queryctrl(struct file *file, void *priv, | 454 | static int vidioc_queryctrl(struct file *file, void *priv, |
480 | struct v4l2_queryctrl *qc) | 455 | struct v4l2_queryctrl *qc) |
481 | { | 456 | { |
482 | int i; | 457 | switch (qc->id) { |
483 | 458 | case V4L2_CID_AUDIO_MUTE: | |
484 | for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { | 459 | return v4l2_ctrl_query_fill(qc, 0, 1, 1, 1); |
485 | if (qc->id && qc->id == radio_qctrl[i].id) { | ||
486 | memcpy(qc, &(radio_qctrl[i]), sizeof(*qc)); | ||
487 | return 0; | ||
488 | } | ||
489 | } | 460 | } |
461 | |||
490 | return -EINVAL; | 462 | return -EINVAL; |
491 | } | 463 | } |
492 | 464 | ||
@@ -656,6 +628,7 @@ static void usb_dsbr100_video_device_release(struct video_device *videodev) | |||
656 | { | 628 | { |
657 | struct dsbr100_device *radio = videodev_to_radio(videodev); | 629 | struct dsbr100_device *radio = videodev_to_radio(videodev); |
658 | 630 | ||
631 | v4l2_device_unregister(&radio->v4l2_dev); | ||
659 | kfree(radio->transfer_buffer); | 632 | kfree(radio->transfer_buffer); |
660 | kfree(radio); | 633 | kfree(radio); |
661 | } | 634 | } |
@@ -683,22 +656,15 @@ static const struct v4l2_ioctl_ops usb_dsbr100_ioctl_ops = { | |||
683 | .vidioc_s_input = vidioc_s_input, | 656 | .vidioc_s_input = vidioc_s_input, |
684 | }; | 657 | }; |
685 | 658 | ||
686 | /* V4L2 interface */ | ||
687 | static struct video_device dsbr100_videodev_data = { | ||
688 | .name = "D-Link DSB-R 100", | ||
689 | .fops = &usb_dsbr100_fops, | ||
690 | .ioctl_ops = &usb_dsbr100_ioctl_ops, | ||
691 | .release = usb_dsbr100_video_device_release, | ||
692 | }; | ||
693 | |||
694 | /* check if the device is present and register with v4l and usb if it is */ | 659 | /* check if the device is present and register with v4l and usb if it is */ |
695 | static int usb_dsbr100_probe(struct usb_interface *intf, | 660 | static int usb_dsbr100_probe(struct usb_interface *intf, |
696 | const struct usb_device_id *id) | 661 | const struct usb_device_id *id) |
697 | { | 662 | { |
698 | struct dsbr100_device *radio; | 663 | struct dsbr100_device *radio; |
664 | struct v4l2_device *v4l2_dev; | ||
699 | int retval; | 665 | int retval; |
700 | 666 | ||
701 | radio = kmalloc(sizeof(struct dsbr100_device), GFP_KERNEL); | 667 | radio = kzalloc(sizeof(struct dsbr100_device), GFP_KERNEL); |
702 | 668 | ||
703 | if (!radio) | 669 | if (!radio) |
704 | return -ENOMEM; | 670 | return -ENOMEM; |
@@ -710,17 +676,35 @@ static int usb_dsbr100_probe(struct usb_interface *intf, | |||
710 | return -ENOMEM; | 676 | return -ENOMEM; |
711 | } | 677 | } |
712 | 678 | ||
679 | v4l2_dev = &radio->v4l2_dev; | ||
680 | |||
681 | retval = v4l2_device_register(&intf->dev, v4l2_dev); | ||
682 | if (retval < 0) { | ||
683 | v4l2_err(v4l2_dev, "couldn't register v4l2_device\n"); | ||
684 | kfree(radio->transfer_buffer); | ||
685 | kfree(radio); | ||
686 | return retval; | ||
687 | } | ||
688 | |||
689 | strlcpy(radio->videodev.name, v4l2_dev->name, sizeof(radio->videodev.name)); | ||
690 | radio->videodev.v4l2_dev = v4l2_dev; | ||
691 | radio->videodev.fops = &usb_dsbr100_fops; | ||
692 | radio->videodev.ioctl_ops = &usb_dsbr100_ioctl_ops; | ||
693 | radio->videodev.release = usb_dsbr100_video_device_release; | ||
694 | |||
713 | mutex_init(&radio->lock); | 695 | mutex_init(&radio->lock); |
714 | radio->videodev = dsbr100_videodev_data; | ||
715 | 696 | ||
716 | radio->removed = 0; | 697 | radio->removed = 0; |
717 | radio->users = 0; | 698 | radio->users = 0; |
718 | radio->usbdev = interface_to_usbdev(intf); | 699 | radio->usbdev = interface_to_usbdev(intf); |
719 | radio->curfreq = FREQ_MIN * FREQ_MUL; | 700 | radio->curfreq = FREQ_MIN * FREQ_MUL; |
701 | |||
720 | video_set_drvdata(&radio->videodev, radio); | 702 | video_set_drvdata(&radio->videodev, radio); |
703 | |||
721 | retval = video_register_device(&radio->videodev, VFL_TYPE_RADIO, radio_nr); | 704 | retval = video_register_device(&radio->videodev, VFL_TYPE_RADIO, radio_nr); |
722 | if (retval < 0) { | 705 | if (retval < 0) { |
723 | dev_err(&intf->dev, "couldn't register video device\n"); | 706 | v4l2_err(v4l2_dev, "couldn't register video device\n"); |
707 | v4l2_device_unregister(v4l2_dev); | ||
724 | kfree(radio->transfer_buffer); | 708 | kfree(radio->transfer_buffer); |
725 | kfree(radio); | 709 | kfree(radio); |
726 | return -EIO; | 710 | return -EIO; |
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c index ac82e33cb6fc..35edee009ba8 100644 --- a/drivers/media/radio/radio-aimslab.c +++ b/drivers/media/radio/radio-aimslab.c | |||
@@ -355,20 +355,8 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
355 | return a->index ? -EINVAL : 0; | 355 | return a->index ? -EINVAL : 0; |
356 | } | 356 | } |
357 | 357 | ||
358 | static int rtrack_open(struct file *file) | ||
359 | { | ||
360 | return 0; | ||
361 | } | ||
362 | |||
363 | static int rtrack_release(struct file *file) | ||
364 | { | ||
365 | return 0; | ||
366 | } | ||
367 | |||
368 | static const struct v4l2_file_operations rtrack_fops = { | 358 | static const struct v4l2_file_operations rtrack_fops = { |
369 | .owner = THIS_MODULE, | 359 | .owner = THIS_MODULE, |
370 | .open = rtrack_open, | ||
371 | .release = rtrack_release, | ||
372 | .ioctl = video_ioctl2, | 360 | .ioctl = video_ioctl2, |
373 | }; | 361 | }; |
374 | 362 | ||
diff --git a/drivers/media/radio/radio-aztech.c b/drivers/media/radio/radio-aztech.c index 49299f7fd834..8daf809eb01a 100644 --- a/drivers/media/radio/radio-aztech.c +++ b/drivers/media/radio/radio-aztech.c | |||
@@ -318,20 +318,8 @@ static int vidioc_s_ctrl(struct file *file, void *priv, | |||
318 | return -EINVAL; | 318 | return -EINVAL; |
319 | } | 319 | } |
320 | 320 | ||
321 | static int aztech_open(struct file *file) | ||
322 | { | ||
323 | return 0; | ||
324 | } | ||
325 | |||
326 | static int aztech_release(struct file *file) | ||
327 | { | ||
328 | return 0; | ||
329 | } | ||
330 | |||
331 | static const struct v4l2_file_operations aztech_fops = { | 321 | static const struct v4l2_file_operations aztech_fops = { |
332 | .owner = THIS_MODULE, | 322 | .owner = THIS_MODULE, |
333 | .open = aztech_open, | ||
334 | .release = aztech_release, | ||
335 | .ioctl = video_ioctl2, | 323 | .ioctl = video_ioctl2, |
336 | }; | 324 | }; |
337 | 325 | ||
diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c index 09265d25725e..c3f579de6e71 100644 --- a/drivers/media/radio/radio-gemtek-pci.c +++ b/drivers/media/radio/radio-gemtek-pci.c | |||
@@ -356,20 +356,8 @@ static struct pci_device_id gemtek_pci_id[] = | |||
356 | 356 | ||
357 | MODULE_DEVICE_TABLE(pci, gemtek_pci_id); | 357 | MODULE_DEVICE_TABLE(pci, gemtek_pci_id); |
358 | 358 | ||
359 | static int gemtek_pci_open(struct file *file) | ||
360 | { | ||
361 | return 0; | ||
362 | } | ||
363 | |||
364 | static int gemtek_pci_release(struct file *file) | ||
365 | { | ||
366 | return 0; | ||
367 | } | ||
368 | |||
369 | static const struct v4l2_file_operations gemtek_pci_fops = { | 359 | static const struct v4l2_file_operations gemtek_pci_fops = { |
370 | .owner = THIS_MODULE, | 360 | .owner = THIS_MODULE, |
371 | .open = gemtek_pci_open, | ||
372 | .release = gemtek_pci_release, | ||
373 | .ioctl = video_ioctl2, | 361 | .ioctl = video_ioctl2, |
374 | }; | 362 | }; |
375 | 363 | ||
diff --git a/drivers/media/radio/radio-gemtek.c b/drivers/media/radio/radio-gemtek.c index 150464426d1d..73985f641f07 100644 --- a/drivers/media/radio/radio-gemtek.c +++ b/drivers/media/radio/radio-gemtek.c | |||
@@ -375,20 +375,9 @@ static int gemtek_probe(struct gemtek *gt) | |||
375 | /* | 375 | /* |
376 | * Video 4 Linux stuff. | 376 | * Video 4 Linux stuff. |
377 | */ | 377 | */ |
378 | static int gemtek_open(struct file *file) | ||
379 | { | ||
380 | return 0; | ||
381 | } | ||
382 | |||
383 | static int gemtek_release(struct file *file) | ||
384 | { | ||
385 | return 0; | ||
386 | } | ||
387 | 378 | ||
388 | static const struct v4l2_file_operations gemtek_fops = { | 379 | static const struct v4l2_file_operations gemtek_fops = { |
389 | .owner = THIS_MODULE, | 380 | .owner = THIS_MODULE, |
390 | .open = gemtek_open, | ||
391 | .release = gemtek_release, | ||
392 | .ioctl = video_ioctl2, | 381 | .ioctl = video_ioctl2, |
393 | }; | 382 | }; |
394 | 383 | ||
diff --git a/drivers/media/radio/radio-maestro.c b/drivers/media/radio/radio-maestro.c index 01a6d22950ad..64d737c35acf 100644 --- a/drivers/media/radio/radio-maestro.c +++ b/drivers/media/radio/radio-maestro.c | |||
@@ -292,20 +292,8 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
292 | return a->index ? -EINVAL : 0; | 292 | return a->index ? -EINVAL : 0; |
293 | } | 293 | } |
294 | 294 | ||
295 | static int maestro_open(struct file *file) | ||
296 | { | ||
297 | return 0; | ||
298 | } | ||
299 | |||
300 | static int maestro_release(struct file *file) | ||
301 | { | ||
302 | return 0; | ||
303 | } | ||
304 | |||
305 | static const struct v4l2_file_operations maestro_fops = { | 295 | static const struct v4l2_file_operations maestro_fops = { |
306 | .owner = THIS_MODULE, | 296 | .owner = THIS_MODULE, |
307 | .open = maestro_open, | ||
308 | .release = maestro_release, | ||
309 | .ioctl = video_ioctl2, | 297 | .ioctl = video_ioctl2, |
310 | }; | 298 | }; |
311 | 299 | ||
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c index 2606f0b30355..3da51fe8fb93 100644 --- a/drivers/media/radio/radio-maxiradio.c +++ b/drivers/media/radio/radio-maxiradio.c | |||
@@ -339,20 +339,8 @@ static int vidioc_s_ctrl(struct file *file, void *priv, | |||
339 | return -EINVAL; | 339 | return -EINVAL; |
340 | } | 340 | } |
341 | 341 | ||
342 | static int maxiradio_open(struct file *file) | ||
343 | { | ||
344 | return 0; | ||
345 | } | ||
346 | |||
347 | static int maxiradio_release(struct file *file) | ||
348 | { | ||
349 | return 0; | ||
350 | } | ||
351 | |||
352 | static const struct v4l2_file_operations maxiradio_fops = { | 342 | static const struct v4l2_file_operations maxiradio_fops = { |
353 | .owner = THIS_MODULE, | 343 | .owner = THIS_MODULE, |
354 | .open = maxiradio_open, | ||
355 | .release = maxiradio_release, | ||
356 | .ioctl = video_ioctl2, | 344 | .ioctl = video_ioctl2, |
357 | }; | 345 | }; |
358 | 346 | ||
diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c index ded25bfb366e..cab19d05e02f 100644 --- a/drivers/media/radio/radio-mr800.c +++ b/drivers/media/radio/radio-mr800.c | |||
@@ -43,6 +43,7 @@ | |||
43 | * Douglas Schilling Landgraf <dougsland@gmail.com> and | 43 | * Douglas Schilling Landgraf <dougsland@gmail.com> and |
44 | * David Ellingsworth <david@identd.dyndns.org> | 44 | * David Ellingsworth <david@identd.dyndns.org> |
45 | * for discussion, help and support. | 45 | * for discussion, help and support. |
46 | * Version 0.11: Converted to v4l2_device. | ||
46 | * | 47 | * |
47 | * Many things to do: | 48 | * Many things to do: |
48 | * - Correct power managment of device (suspend & resume) | 49 | * - Correct power managment of device (suspend & resume) |
@@ -59,7 +60,7 @@ | |||
59 | #include <linux/slab.h> | 60 | #include <linux/slab.h> |
60 | #include <linux/input.h> | 61 | #include <linux/input.h> |
61 | #include <linux/videodev2.h> | 62 | #include <linux/videodev2.h> |
62 | #include <media/v4l2-common.h> | 63 | #include <media/v4l2-device.h> |
63 | #include <media/v4l2-ioctl.h> | 64 | #include <media/v4l2-ioctl.h> |
64 | #include <linux/usb.h> | 65 | #include <linux/usb.h> |
65 | #include <linux/version.h> /* for KERNEL_VERSION MACRO */ | 66 | #include <linux/version.h> /* for KERNEL_VERSION MACRO */ |
@@ -67,8 +68,8 @@ | |||
67 | /* driver and module definitions */ | 68 | /* driver and module definitions */ |
68 | #define DRIVER_AUTHOR "Alexey Klimov <klimov.linux@gmail.com>" | 69 | #define DRIVER_AUTHOR "Alexey Klimov <klimov.linux@gmail.com>" |
69 | #define DRIVER_DESC "AverMedia MR 800 USB FM radio driver" | 70 | #define DRIVER_DESC "AverMedia MR 800 USB FM radio driver" |
70 | #define DRIVER_VERSION "0.10" | 71 | #define DRIVER_VERSION "0.11" |
71 | #define RADIO_VERSION KERNEL_VERSION(0, 1, 0) | 72 | #define RADIO_VERSION KERNEL_VERSION(0, 1, 1) |
72 | 73 | ||
73 | MODULE_AUTHOR(DRIVER_AUTHOR); | 74 | MODULE_AUTHOR(DRIVER_AUTHOR); |
74 | MODULE_DESCRIPTION(DRIVER_DESC); | 75 | MODULE_DESCRIPTION(DRIVER_DESC); |
@@ -113,38 +114,6 @@ static int radio_nr = -1; | |||
113 | module_param(radio_nr, int, 0); | 114 | module_param(radio_nr, int, 0); |
114 | MODULE_PARM_DESC(radio_nr, "Radio Nr"); | 115 | MODULE_PARM_DESC(radio_nr, "Radio Nr"); |
115 | 116 | ||
116 | static struct v4l2_queryctrl radio_qctrl[] = { | ||
117 | { | ||
118 | .id = V4L2_CID_AUDIO_MUTE, | ||
119 | .name = "Mute", | ||
120 | .minimum = 0, | ||
121 | .maximum = 1, | ||
122 | .step = 1, | ||
123 | .default_value = 1, | ||
124 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
125 | }, | ||
126 | /* HINT: the disabled controls are only here to satify kradio and such apps */ | ||
127 | { .id = V4L2_CID_AUDIO_VOLUME, | ||
128 | .flags = V4L2_CTRL_FLAG_DISABLED, | ||
129 | }, | ||
130 | { | ||
131 | .id = V4L2_CID_AUDIO_BALANCE, | ||
132 | .flags = V4L2_CTRL_FLAG_DISABLED, | ||
133 | }, | ||
134 | { | ||
135 | .id = V4L2_CID_AUDIO_BASS, | ||
136 | .flags = V4L2_CTRL_FLAG_DISABLED, | ||
137 | }, | ||
138 | { | ||
139 | .id = V4L2_CID_AUDIO_TREBLE, | ||
140 | .flags = V4L2_CTRL_FLAG_DISABLED, | ||
141 | }, | ||
142 | { | ||
143 | .id = V4L2_CID_AUDIO_LOUDNESS, | ||
144 | .flags = V4L2_CTRL_FLAG_DISABLED, | ||
145 | }, | ||
146 | }; | ||
147 | |||
148 | static int usb_amradio_probe(struct usb_interface *intf, | 117 | static int usb_amradio_probe(struct usb_interface *intf, |
149 | const struct usb_device_id *id); | 118 | const struct usb_device_id *id); |
150 | static void usb_amradio_disconnect(struct usb_interface *intf); | 119 | static void usb_amradio_disconnect(struct usb_interface *intf); |
@@ -159,6 +128,7 @@ struct amradio_device { | |||
159 | /* reference to USB and video device */ | 128 | /* reference to USB and video device */ |
160 | struct usb_device *usbdev; | 129 | struct usb_device *usbdev; |
161 | struct video_device *videodev; | 130 | struct video_device *videodev; |
131 | struct v4l2_device v4l2_dev; | ||
162 | 132 | ||
163 | unsigned char *buffer; | 133 | unsigned char *buffer; |
164 | struct mutex lock; /* buffer locking */ | 134 | struct mutex lock; /* buffer locking */ |
@@ -329,6 +299,7 @@ static void usb_amradio_disconnect(struct usb_interface *intf) | |||
329 | 299 | ||
330 | usb_set_intfdata(intf, NULL); | 300 | usb_set_intfdata(intf, NULL); |
331 | video_unregister_device(radio->videodev); | 301 | video_unregister_device(radio->videodev); |
302 | v4l2_device_disconnect(&radio->v4l2_dev); | ||
332 | } | 303 | } |
333 | 304 | ||
334 | /* vidioc_querycap - query device capabilities */ | 305 | /* vidioc_querycap - query device capabilities */ |
@@ -463,14 +434,11 @@ static int vidioc_g_frequency(struct file *file, void *priv, | |||
463 | static int vidioc_queryctrl(struct file *file, void *priv, | 434 | static int vidioc_queryctrl(struct file *file, void *priv, |
464 | struct v4l2_queryctrl *qc) | 435 | struct v4l2_queryctrl *qc) |
465 | { | 436 | { |
466 | int i; | 437 | switch (qc->id) { |
467 | 438 | case V4L2_CID_AUDIO_MUTE: | |
468 | for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { | 439 | return v4l2_ctrl_query_fill(qc, 0, 1, 1, 1); |
469 | if (qc->id && qc->id == radio_qctrl[i].id) { | ||
470 | memcpy(qc, &(radio_qctrl[i]), sizeof(*qc)); | ||
471 | return 0; | ||
472 | } | ||
473 | } | 440 | } |
441 | |||
474 | return -EINVAL; | 442 | return -EINVAL; |
475 | } | 443 | } |
476 | 444 | ||
@@ -671,34 +639,29 @@ static const struct v4l2_ioctl_ops usb_amradio_ioctl_ops = { | |||
671 | .vidioc_s_input = vidioc_s_input, | 639 | .vidioc_s_input = vidioc_s_input, |
672 | }; | 640 | }; |
673 | 641 | ||
674 | static void usb_amradio_device_release(struct video_device *videodev) | 642 | static void usb_amradio_video_device_release(struct video_device *videodev) |
675 | { | 643 | { |
676 | struct amradio_device *radio = video_get_drvdata(videodev); | 644 | struct amradio_device *radio = video_get_drvdata(videodev); |
677 | 645 | ||
678 | /* we call v4l to free radio->videodev */ | 646 | /* we call v4l to free radio->videodev */ |
679 | video_device_release(videodev); | 647 | video_device_release(videodev); |
680 | 648 | ||
649 | v4l2_device_unregister(&radio->v4l2_dev); | ||
650 | |||
681 | /* free rest memory */ | 651 | /* free rest memory */ |
682 | kfree(radio->buffer); | 652 | kfree(radio->buffer); |
683 | kfree(radio); | 653 | kfree(radio); |
684 | } | 654 | } |
685 | 655 | ||
686 | /* V4L2 interface */ | ||
687 | static struct video_device amradio_videodev_template = { | ||
688 | .name = "AverMedia MR 800 USB FM Radio", | ||
689 | .fops = &usb_amradio_fops, | ||
690 | .ioctl_ops = &usb_amradio_ioctl_ops, | ||
691 | .release = usb_amradio_device_release, | ||
692 | }; | ||
693 | |||
694 | /* check if the device is present and register with v4l and usb if it is */ | 656 | /* check if the device is present and register with v4l and usb if it is */ |
695 | static int usb_amradio_probe(struct usb_interface *intf, | 657 | static int usb_amradio_probe(struct usb_interface *intf, |
696 | const struct usb_device_id *id) | 658 | const struct usb_device_id *id) |
697 | { | 659 | { |
698 | struct amradio_device *radio; | 660 | struct amradio_device *radio; |
661 | struct v4l2_device *v4l2_dev; | ||
699 | int retval; | 662 | int retval; |
700 | 663 | ||
701 | radio = kmalloc(sizeof(struct amradio_device), GFP_KERNEL); | 664 | radio = kzalloc(sizeof(struct amradio_device), GFP_KERNEL); |
702 | 665 | ||
703 | if (!radio) { | 666 | if (!radio) { |
704 | dev_err(&intf->dev, "kmalloc for amradio_device failed\n"); | 667 | dev_err(&intf->dev, "kmalloc for amradio_device failed\n"); |
@@ -713,6 +676,15 @@ static int usb_amradio_probe(struct usb_interface *intf, | |||
713 | return -ENOMEM; | 676 | return -ENOMEM; |
714 | } | 677 | } |
715 | 678 | ||
679 | v4l2_dev = &radio->v4l2_dev; | ||
680 | retval = v4l2_device_register(&intf->dev, v4l2_dev); | ||
681 | if (retval < 0) { | ||
682 | dev_err(&intf->dev, "couldn't register v4l2_device\n"); | ||
683 | kfree(radio->buffer); | ||
684 | kfree(radio); | ||
685 | return retval; | ||
686 | } | ||
687 | |||
716 | radio->videodev = video_device_alloc(); | 688 | radio->videodev = video_device_alloc(); |
717 | 689 | ||
718 | if (!radio->videodev) { | 690 | if (!radio->videodev) { |
@@ -722,8 +694,11 @@ static int usb_amradio_probe(struct usb_interface *intf, | |||
722 | return -ENOMEM; | 694 | return -ENOMEM; |
723 | } | 695 | } |
724 | 696 | ||
725 | memcpy(radio->videodev, &amradio_videodev_template, | 697 | strlcpy(radio->videodev->name, v4l2_dev->name, sizeof(radio->videodev->name)); |
726 | sizeof(amradio_videodev_template)); | 698 | radio->videodev->v4l2_dev = v4l2_dev; |
699 | radio->videodev->fops = &usb_amradio_fops; | ||
700 | radio->videodev->ioctl_ops = &usb_amradio_ioctl_ops; | ||
701 | radio->videodev->release = usb_amradio_video_device_release; | ||
727 | 702 | ||
728 | radio->removed = 0; | 703 | radio->removed = 0; |
729 | radio->users = 0; | 704 | radio->users = 0; |
@@ -734,10 +709,12 @@ static int usb_amradio_probe(struct usb_interface *intf, | |||
734 | mutex_init(&radio->lock); | 709 | mutex_init(&radio->lock); |
735 | 710 | ||
736 | video_set_drvdata(radio->videodev, radio); | 711 | video_set_drvdata(radio->videodev, radio); |
712 | |||
737 | retval = video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr); | 713 | retval = video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr); |
738 | if (retval < 0) { | 714 | if (retval < 0) { |
739 | dev_err(&intf->dev, "could not register video device\n"); | 715 | dev_err(&intf->dev, "could not register video device\n"); |
740 | video_device_release(radio->videodev); | 716 | video_device_release(radio->videodev); |
717 | v4l2_device_unregister(v4l2_dev); | ||
741 | kfree(radio->buffer); | 718 | kfree(radio->buffer); |
742 | kfree(radio); | 719 | kfree(radio); |
743 | return -EIO; | 720 | return -EIO; |
diff --git a/drivers/media/radio/radio-rtrack2.c b/drivers/media/radio/radio-rtrack2.c index d1e6b01d4eca..9cb193fa6e33 100644 --- a/drivers/media/radio/radio-rtrack2.c +++ b/drivers/media/radio/radio-rtrack2.c | |||
@@ -260,20 +260,8 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
260 | return a->index ? -EINVAL : 0; | 260 | return a->index ? -EINVAL : 0; |
261 | } | 261 | } |
262 | 262 | ||
263 | static int rtrack2_open(struct file *file) | ||
264 | { | ||
265 | return 0; | ||
266 | } | ||
267 | |||
268 | static int rtrack2_release(struct file *file) | ||
269 | { | ||
270 | return 0; | ||
271 | } | ||
272 | |||
273 | static const struct v4l2_file_operations rtrack2_fops = { | 263 | static const struct v4l2_file_operations rtrack2_fops = { |
274 | .owner = THIS_MODULE, | 264 | .owner = THIS_MODULE, |
275 | .open = rtrack2_open, | ||
276 | .release = rtrack2_release, | ||
277 | .ioctl = video_ioctl2, | 265 | .ioctl = video_ioctl2, |
278 | }; | 266 | }; |
279 | 267 | ||
diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c index f4784f0d1a88..1dba8f0832a0 100644 --- a/drivers/media/radio/radio-sf16fmi.c +++ b/drivers/media/radio/radio-sf16fmi.c | |||
@@ -260,20 +260,8 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
260 | return a->index ? -EINVAL : 0; | 260 | return a->index ? -EINVAL : 0; |
261 | } | 261 | } |
262 | 262 | ||
263 | static int fmi_open(struct file *file) | ||
264 | { | ||
265 | return 0; | ||
266 | } | ||
267 | |||
268 | static int fmi_release(struct file *file) | ||
269 | { | ||
270 | return 0; | ||
271 | } | ||
272 | |||
273 | static const struct v4l2_file_operations fmi_fops = { | 263 | static const struct v4l2_file_operations fmi_fops = { |
274 | .owner = THIS_MODULE, | 264 | .owner = THIS_MODULE, |
275 | .open = fmi_open, | ||
276 | .release = fmi_release, | ||
277 | .ioctl = video_ioctl2, | 265 | .ioctl = video_ioctl2, |
278 | }; | 266 | }; |
279 | 267 | ||
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c index 0ba9d88a80fc..c09ca8600ea1 100644 --- a/drivers/media/radio/radio-sf16fmr2.c +++ b/drivers/media/radio/radio-sf16fmr2.c | |||
@@ -377,20 +377,8 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
377 | return a->index ? -EINVAL : 0; | 377 | return a->index ? -EINVAL : 0; |
378 | } | 378 | } |
379 | 379 | ||
380 | static int fmr2_open(struct file *file) | ||
381 | { | ||
382 | return 0; | ||
383 | } | ||
384 | |||
385 | static int fmr2_release(struct file *file) | ||
386 | { | ||
387 | return 0; | ||
388 | } | ||
389 | |||
390 | static const struct v4l2_file_operations fmr2_fops = { | 380 | static const struct v4l2_file_operations fmr2_fops = { |
391 | .owner = THIS_MODULE, | 381 | .owner = THIS_MODULE, |
392 | .open = fmr2_open, | ||
393 | .release = fmr2_release, | ||
394 | .ioctl = video_ioctl2, | 382 | .ioctl = video_ioctl2, |
395 | }; | 383 | }; |
396 | 384 | ||
diff --git a/drivers/media/radio/radio-si470x.c b/drivers/media/radio/radio-si470x.c index 713e242ba8b2..92c297796a9f 100644 --- a/drivers/media/radio/radio-si470x.c +++ b/drivers/media/radio/radio-si470x.c | |||
@@ -1686,7 +1686,7 @@ static int si470x_usb_driver_probe(struct usb_interface *intf, | |||
1686 | /* show some infos about the specific si470x device */ | 1686 | /* show some infos about the specific si470x device */ |
1687 | if (si470x_get_all_registers(radio) < 0) { | 1687 | if (si470x_get_all_registers(radio) < 0) { |
1688 | retval = -EIO; | 1688 | retval = -EIO; |
1689 | goto err_all; | 1689 | goto err_video; |
1690 | } | 1690 | } |
1691 | printk(KERN_INFO DRIVER_NAME ": DeviceID=0x%4.4hx ChipID=0x%4.4hx\n", | 1691 | printk(KERN_INFO DRIVER_NAME ": DeviceID=0x%4.4hx ChipID=0x%4.4hx\n", |
1692 | radio->registers[DEVICEID], radio->registers[CHIPID]); | 1692 | radio->registers[DEVICEID], radio->registers[CHIPID]); |
@@ -1694,7 +1694,7 @@ static int si470x_usb_driver_probe(struct usb_interface *intf, | |||
1694 | /* get software and hardware versions */ | 1694 | /* get software and hardware versions */ |
1695 | if (si470x_get_scratch_page_versions(radio) < 0) { | 1695 | if (si470x_get_scratch_page_versions(radio) < 0) { |
1696 | retval = -EIO; | 1696 | retval = -EIO; |
1697 | goto err_all; | 1697 | goto err_video; |
1698 | } | 1698 | } |
1699 | printk(KERN_INFO DRIVER_NAME | 1699 | printk(KERN_INFO DRIVER_NAME |
1700 | ": software version %d, hardware version %d\n", | 1700 | ": software version %d, hardware version %d\n", |
@@ -1727,7 +1727,7 @@ static int si470x_usb_driver_probe(struct usb_interface *intf, | |||
1727 | radio->buffer = kmalloc(radio->buf_size, GFP_KERNEL); | 1727 | radio->buffer = kmalloc(radio->buf_size, GFP_KERNEL); |
1728 | if (!radio->buffer) { | 1728 | if (!radio->buffer) { |
1729 | retval = -EIO; | 1729 | retval = -EIO; |
1730 | goto err_all; | 1730 | goto err_video; |
1731 | } | 1731 | } |
1732 | 1732 | ||
1733 | /* rds buffer configuration */ | 1733 | /* rds buffer configuration */ |
@@ -1749,8 +1749,9 @@ static int si470x_usb_driver_probe(struct usb_interface *intf, | |||
1749 | 1749 | ||
1750 | return 0; | 1750 | return 0; |
1751 | err_all: | 1751 | err_all: |
1752 | video_device_release(radio->videodev); | ||
1753 | kfree(radio->buffer); | 1752 | kfree(radio->buffer); |
1753 | err_video: | ||
1754 | video_device_release(radio->videodev); | ||
1754 | err_radio: | 1755 | err_radio: |
1755 | kfree(radio); | 1756 | kfree(radio); |
1756 | err_initial: | 1757 | err_initial: |
diff --git a/drivers/media/radio/radio-terratec.c b/drivers/media/radio/radio-terratec.c index 5b007f5c74b2..699db9acaaf7 100644 --- a/drivers/media/radio/radio-terratec.c +++ b/drivers/media/radio/radio-terratec.c | |||
@@ -332,20 +332,8 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
332 | return a->index ? -EINVAL : 0; | 332 | return a->index ? -EINVAL : 0; |
333 | } | 333 | } |
334 | 334 | ||
335 | static int terratec_open(struct file *file) | ||
336 | { | ||
337 | return 0; | ||
338 | } | ||
339 | |||
340 | static int terratec_release(struct file *file) | ||
341 | { | ||
342 | return 0; | ||
343 | } | ||
344 | |||
345 | static const struct v4l2_file_operations terratec_fops = { | 335 | static const struct v4l2_file_operations terratec_fops = { |
346 | .owner = THIS_MODULE, | 336 | .owner = THIS_MODULE, |
347 | .open = terratec_open, | ||
348 | .release = terratec_release, | ||
349 | .ioctl = video_ioctl2, | 337 | .ioctl = video_ioctl2, |
350 | }; | 338 | }; |
351 | 339 | ||
diff --git a/drivers/media/radio/radio-trust.c b/drivers/media/radio/radio-trust.c index d1be6492a07b..6f9ecc359356 100644 --- a/drivers/media/radio/radio-trust.c +++ b/drivers/media/radio/radio-trust.c | |||
@@ -338,20 +338,8 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
338 | return a->index ? -EINVAL : 0; | 338 | return a->index ? -EINVAL : 0; |
339 | } | 339 | } |
340 | 340 | ||
341 | static int trust_open(struct file *file) | ||
342 | { | ||
343 | return 0; | ||
344 | } | ||
345 | |||
346 | static int trust_release(struct file *file) | ||
347 | { | ||
348 | return 0; | ||
349 | } | ||
350 | |||
351 | static const struct v4l2_file_operations trust_fops = { | 341 | static const struct v4l2_file_operations trust_fops = { |
352 | .owner = THIS_MODULE, | 342 | .owner = THIS_MODULE, |
353 | .open = trust_open, | ||
354 | .release = trust_release, | ||
355 | .ioctl = video_ioctl2, | 343 | .ioctl = video_ioctl2, |
356 | }; | 344 | }; |
357 | 345 | ||
diff --git a/drivers/media/radio/radio-typhoon.c b/drivers/media/radio/radio-typhoon.c index 92d923c7f360..3a98f1399495 100644 --- a/drivers/media/radio/radio-typhoon.c +++ b/drivers/media/radio/radio-typhoon.c | |||
@@ -314,20 +314,8 @@ static int vidioc_log_status(struct file *file, void *priv) | |||
314 | return 0; | 314 | return 0; |
315 | } | 315 | } |
316 | 316 | ||
317 | static int typhoon_open(struct file *file) | ||
318 | { | ||
319 | return 0; | ||
320 | } | ||
321 | |||
322 | static int typhoon_release(struct file *file) | ||
323 | { | ||
324 | return 0; | ||
325 | } | ||
326 | |||
327 | static const struct v4l2_file_operations typhoon_fops = { | 317 | static const struct v4l2_file_operations typhoon_fops = { |
328 | .owner = THIS_MODULE, | 318 | .owner = THIS_MODULE, |
329 | .open = typhoon_open, | ||
330 | .release = typhoon_release, | ||
331 | .ioctl = video_ioctl2, | 319 | .ioctl = video_ioctl2, |
332 | }; | 320 | }; |
333 | 321 | ||
diff --git a/drivers/media/radio/radio-zoltrix.c b/drivers/media/radio/radio-zoltrix.c index 1f85f2024dc0..80e98b6422fe 100644 --- a/drivers/media/radio/radio-zoltrix.c +++ b/drivers/media/radio/radio-zoltrix.c | |||
@@ -370,21 +370,9 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
370 | return a->index ? -EINVAL : 0; | 370 | return a->index ? -EINVAL : 0; |
371 | } | 371 | } |
372 | 372 | ||
373 | static int zoltrix_open(struct file *file) | ||
374 | { | ||
375 | return 0; | ||
376 | } | ||
377 | |||
378 | static int zoltrix_release(struct file *file) | ||
379 | { | ||
380 | return 0; | ||
381 | } | ||
382 | |||
383 | static const struct v4l2_file_operations zoltrix_fops = | 373 | static const struct v4l2_file_operations zoltrix_fops = |
384 | { | 374 | { |
385 | .owner = THIS_MODULE, | 375 | .owner = THIS_MODULE, |
386 | .open = zoltrix_open, | ||
387 | .release = zoltrix_release, | ||
388 | .ioctl = video_ioctl2, | 376 | .ioctl = video_ioctl2, |
389 | }; | 377 | }; |
390 | 378 | ||