aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/dvb/cinergyT2/cinergyT2.c9
-rw-r--r--fs/compat_ioctl.c133
-rw-r--r--include/linux/compat_ioctl.h67
3 files changed, 205 insertions, 4 deletions
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c
index a1607e7d6d6b..fb394a0d838c 100644
--- a/drivers/media/dvb/cinergyT2/cinergyT2.c
+++ b/drivers/media/dvb/cinergyT2/cinergyT2.c
@@ -276,7 +276,7 @@ static void cinergyt2_free_stream_urbs (struct cinergyt2 *cinergyt2)
276 if (cinergyt2->stream_urb[i]) 276 if (cinergyt2->stream_urb[i])
277 usb_free_urb(cinergyt2->stream_urb[i]); 277 usb_free_urb(cinergyt2->stream_urb[i]);
278 278
279 pci_free_consistent(NULL, STREAM_URB_COUNT*STREAM_BUF_SIZE, 279 usb_buffer_free(cinergyt2->udev, STREAM_URB_COUNT*STREAM_BUF_SIZE,
280 cinergyt2->streambuf, cinergyt2->streambuf_dmahandle); 280 cinergyt2->streambuf, cinergyt2->streambuf_dmahandle);
281} 281}
282 282
@@ -284,9 +284,8 @@ static int cinergyt2_alloc_stream_urbs (struct cinergyt2 *cinergyt2)
284{ 284{
285 int i; 285 int i;
286 286
287 cinergyt2->streambuf = pci_alloc_consistent(NULL, 287 cinergyt2->streambuf = usb_buffer_alloc(cinergyt2->udev, STREAM_URB_COUNT*STREAM_BUF_SIZE,
288 STREAM_URB_COUNT*STREAM_BUF_SIZE, 288 SLAB_KERNEL, &cinergyt2->streambuf_dmahandle);
289 &cinergyt2->streambuf_dmahandle);
290 if (!cinergyt2->streambuf) { 289 if (!cinergyt2->streambuf) {
291 dprintk(1, "failed to alloc consistent stream memory area, bailing out!\n"); 290 dprintk(1, "failed to alloc consistent stream memory area, bailing out!\n");
292 return -ENOMEM; 291 return -ENOMEM;
@@ -780,6 +779,8 @@ static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2)
780 779
781 input_register_device(cinergyt2->rc_input_dev); 780 input_register_device(cinergyt2->rc_input_dev);
782 schedule_delayed_work(&cinergyt2->rc_query_work, HZ/2); 781 schedule_delayed_work(&cinergyt2->rc_query_work, HZ/2);
782
783 return 0;
783} 784}
784 785
785static void cinergyt2_unregister_rc(struct cinergyt2 *cinergyt2) 786static void cinergyt2_unregister_rc(struct cinergyt2 *cinergyt2)
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 26300fccb4fc..f07e60f9e102 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -121,6 +121,11 @@
121 121
122#include <linux/hiddev.h> 122#include <linux/hiddev.h>
123 123
124#include <linux/dvb/audio.h>
125#include <linux/dvb/dmx.h>
126#include <linux/dvb/frontend.h>
127#include <linux/dvb/video.h>
128
124#undef INCLUDES 129#undef INCLUDES
125#endif 130#endif
126 131
@@ -413,6 +418,128 @@ out:
413 return err; 418 return err;
414} 419}
415 420
421struct compat_dmx_event {
422 dmx_event_t event;
423 compat_time_t timeStamp;
424 union
425 {
426 dmx_scrambling_status_t scrambling;
427 } u;
428};
429
430static int do_dmx_get_event(unsigned int fd, unsigned int cmd, unsigned long arg)
431{
432 struct dmx_event kevent;
433 mm_segment_t old_fs = get_fs();
434 int err;
435
436 set_fs(KERNEL_DS);
437 err = sys_ioctl(fd, cmd, (unsigned long) &kevent);
438 set_fs(old_fs);
439
440 if (!err) {
441 struct compat_dmx_event __user *up = compat_ptr(arg);
442
443 err = put_user(kevent.event, &up->event);
444 err |= put_user(kevent.timeStamp, &up->timeStamp);
445 err |= put_user(kevent.u.scrambling, &up->u.scrambling);
446 if (err)
447 err = -EFAULT;
448 }
449
450 return err;
451}
452
453struct compat_video_event {
454 int32_t type;
455 compat_time_t timestamp;
456 union {
457 video_size_t size;
458 unsigned int frame_rate;
459 } u;
460};
461
462static int do_video_get_event(unsigned int fd, unsigned int cmd, unsigned long arg)
463{
464 struct video_event kevent;
465 mm_segment_t old_fs = get_fs();
466 int err;
467
468 set_fs(KERNEL_DS);
469 err = sys_ioctl(fd, cmd, (unsigned long) &kevent);
470 set_fs(old_fs);
471
472 if (!err) {
473 struct compat_video_event __user *up = compat_ptr(arg);
474
475 err = put_user(kevent.type, &up->type);
476 err |= put_user(kevent.timestamp, &up->timestamp);
477 err |= put_user(kevent.u.size.w, &up->u.size.w);
478 err |= put_user(kevent.u.size.h, &up->u.size.h);
479 err |= put_user(kevent.u.size.aspect_ratio,
480 &up->u.size.aspect_ratio);
481 if (err)
482 err = -EFAULT;
483 }
484
485 return err;
486}
487
488struct compat_video_still_picture {
489 compat_uptr_t iFrame;
490 int32_t size;
491};
492
493static int do_video_stillpicture(unsigned int fd, unsigned int cmd, unsigned long arg)
494{
495 struct compat_video_still_picture __user *up;
496 struct video_still_picture __user *up_native;
497 compat_uptr_t fp;
498 int32_t size;
499 int err;
500
501 up = (struct compat_video_still_picture __user *) arg;
502 err = get_user(fp, &up->iFrame);
503 err |= get_user(size, &up->size);
504 if (err)
505 return -EFAULT;
506
507 up_native =
508 compat_alloc_user_space(sizeof(struct video_still_picture));
509
510 put_user(compat_ptr(fp), &up_native->iFrame);
511 put_user(size, &up_native->size);
512
513 err = sys_ioctl(fd, cmd, (unsigned long) up_native);
514
515 return err;
516}
517
518struct compat_video_spu_palette {
519 int length;
520 compat_uptr_t palette;
521};
522
523static int do_video_set_spu_palette(unsigned int fd, unsigned int cmd, unsigned long arg)
524{
525 struct compat_video_spu_palette __user *up;
526 struct video_spu_palette __user *up_native;
527 compat_uptr_t palp;
528 int length, err;
529
530 up = (struct compat_video_spu_palette __user *) arg;
531 err = get_user(palp, &up->palette);
532 err |= get_user(length, &up->length);
533
534 up_native = compat_alloc_user_space(sizeof(struct video_spu_palette));
535 put_user(compat_ptr(palp), &up_native->palette);
536 put_user(length, &up_native->length);
537
538 err = sys_ioctl(fd, cmd, (unsigned long) up_native);
539
540 return err;
541}
542
416#ifdef CONFIG_NET 543#ifdef CONFIG_NET
417static int do_siocgstamp(unsigned int fd, unsigned int cmd, unsigned long arg) 544static int do_siocgstamp(unsigned int fd, unsigned int cmd, unsigned long arg)
418{ 545{
@@ -2954,5 +3081,11 @@ HANDLE_IOCTL(NCP_IOC_GETPRIVATEDATA_32, do_ncp_getprivatedata)
2954HANDLE_IOCTL(NCP_IOC_SETPRIVATEDATA_32, do_ncp_setprivatedata) 3081HANDLE_IOCTL(NCP_IOC_SETPRIVATEDATA_32, do_ncp_setprivatedata)
2955#endif 3082#endif
2956 3083
3084/* dvb */
3085HANDLE_IOCTL(DMX_GET_EVENT, do_dmx_get_event)
3086HANDLE_IOCTL(VIDEO_GET_EVENT, do_video_get_event)
3087HANDLE_IOCTL(VIDEO_STILLPICTURE, do_video_stillpicture)
3088HANDLE_IOCTL(VIDEO_SET_SPU_PALETTE, do_video_set_spu_palette)
3089
2957#undef DECLARES 3090#undef DECLARES
2958#endif 3091#endif
diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h
index 174f3379e5d9..119f9d064cc6 100644
--- a/include/linux/compat_ioctl.h
+++ b/include/linux/compat_ioctl.h
@@ -795,3 +795,70 @@ COMPATIBLE_IOCTL(HIDIOCGFLAG)
795COMPATIBLE_IOCTL(HIDIOCSFLAG) 795COMPATIBLE_IOCTL(HIDIOCSFLAG)
796COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINDEX) 796COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINDEX)
797COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINFO) 797COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINFO)
798/* dvb */
799COMPATIBLE_IOCTL(AUDIO_STOP)
800COMPATIBLE_IOCTL(AUDIO_PLAY)
801COMPATIBLE_IOCTL(AUDIO_PAUSE)
802COMPATIBLE_IOCTL(AUDIO_CONTINUE)
803COMPATIBLE_IOCTL(AUDIO_SELECT_SOURCE)
804COMPATIBLE_IOCTL(AUDIO_SET_MUTE)
805COMPATIBLE_IOCTL(AUDIO_SET_AV_SYNC)
806COMPATIBLE_IOCTL(AUDIO_SET_BYPASS_MODE)
807COMPATIBLE_IOCTL(AUDIO_CHANNEL_SELECT)
808COMPATIBLE_IOCTL(AUDIO_GET_STATUS)
809COMPATIBLE_IOCTL(AUDIO_GET_CAPABILITIES)
810COMPATIBLE_IOCTL(AUDIO_CLEAR_BUFFER)
811COMPATIBLE_IOCTL(AUDIO_SET_ID)
812COMPATIBLE_IOCTL(AUDIO_SET_MIXER)
813COMPATIBLE_IOCTL(AUDIO_SET_STREAMTYPE)
814COMPATIBLE_IOCTL(AUDIO_SET_EXT_ID)
815COMPATIBLE_IOCTL(AUDIO_SET_ATTRIBUTES)
816COMPATIBLE_IOCTL(AUDIO_SET_KARAOKE)
817COMPATIBLE_IOCTL(DMX_START)
818COMPATIBLE_IOCTL(DMX_STOP)
819COMPATIBLE_IOCTL(DMX_SET_FILTER)
820COMPATIBLE_IOCTL(DMX_SET_PES_FILTER)
821COMPATIBLE_IOCTL(DMX_SET_BUFFER_SIZE)
822COMPATIBLE_IOCTL(DMX_GET_PES_PIDS)
823COMPATIBLE_IOCTL(DMX_GET_CAPS)
824COMPATIBLE_IOCTL(DMX_SET_SOURCE)
825COMPATIBLE_IOCTL(DMX_GET_STC)
826COMPATIBLE_IOCTL(FE_GET_INFO)
827COMPATIBLE_IOCTL(FE_DISEQC_RESET_OVERLOAD)
828COMPATIBLE_IOCTL(FE_DISEQC_SEND_MASTER_CMD)
829COMPATIBLE_IOCTL(FE_DISEQC_RECV_SLAVE_REPLY)
830COMPATIBLE_IOCTL(FE_DISEQC_SEND_BURST)
831COMPATIBLE_IOCTL(FE_SET_TONE)
832COMPATIBLE_IOCTL(FE_SET_VOLTAGE)
833COMPATIBLE_IOCTL(FE_ENABLE_HIGH_LNB_VOLTAGE)
834COMPATIBLE_IOCTL(FE_READ_STATUS)
835COMPATIBLE_IOCTL(FE_READ_BER)
836COMPATIBLE_IOCTL(FE_READ_SIGNAL_STRENGTH)
837COMPATIBLE_IOCTL(FE_READ_SNR)
838COMPATIBLE_IOCTL(FE_READ_UNCORRECTED_BLOCKS)
839COMPATIBLE_IOCTL(FE_SET_FRONTEND)
840COMPATIBLE_IOCTL(FE_GET_FRONTEND)
841COMPATIBLE_IOCTL(FE_GET_EVENT)
842COMPATIBLE_IOCTL(FE_DISHNETWORK_SEND_LEGACY_CMD)
843COMPATIBLE_IOCTL(VIDEO_STOP)
844COMPATIBLE_IOCTL(VIDEO_PLAY)
845COMPATIBLE_IOCTL(VIDEO_FREEZE)
846COMPATIBLE_IOCTL(VIDEO_CONTINUE)
847COMPATIBLE_IOCTL(VIDEO_SELECT_SOURCE)
848COMPATIBLE_IOCTL(VIDEO_SET_BLANK)
849COMPATIBLE_IOCTL(VIDEO_GET_STATUS)
850COMPATIBLE_IOCTL(VIDEO_SET_DISPLAY_FORMAT)
851COMPATIBLE_IOCTL(VIDEO_FAST_FORWARD)
852COMPATIBLE_IOCTL(VIDEO_SLOWMOTION)
853COMPATIBLE_IOCTL(VIDEO_GET_CAPABILITIES)
854COMPATIBLE_IOCTL(VIDEO_CLEAR_BUFFER)
855COMPATIBLE_IOCTL(VIDEO_SET_ID)
856COMPATIBLE_IOCTL(VIDEO_SET_STREAMTYPE)
857COMPATIBLE_IOCTL(VIDEO_SET_FORMAT)
858COMPATIBLE_IOCTL(VIDEO_SET_SYSTEM)
859COMPATIBLE_IOCTL(VIDEO_SET_HIGHLIGHT)
860COMPATIBLE_IOCTL(VIDEO_SET_SPU)
861COMPATIBLE_IOCTL(VIDEO_GET_NAVI)
862COMPATIBLE_IOCTL(VIDEO_SET_ATTRIBUTES)
863COMPATIBLE_IOCTL(VIDEO_GET_SIZE)
864COMPATIBLE_IOCTL(VIDEO_GET_FRAME_RATE)