diff options
-rw-r--r-- | drivers/media/dvb/cinergyT2/cinergyT2.c | 9 | ||||
-rw-r--r-- | fs/compat_ioctl.c | 133 | ||||
-rw-r--r-- | include/linux/compat_ioctl.h | 67 |
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 | ||
785 | static void cinergyt2_unregister_rc(struct cinergyt2 *cinergyt2) | 786 | static 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 | ||
421 | struct 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 | |||
430 | static 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 | |||
453 | struct 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 | |||
462 | static 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 | |||
488 | struct compat_video_still_picture { | ||
489 | compat_uptr_t iFrame; | ||
490 | int32_t size; | ||
491 | }; | ||
492 | |||
493 | static 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 | |||
518 | struct compat_video_spu_palette { | ||
519 | int length; | ||
520 | compat_uptr_t palette; | ||
521 | }; | ||
522 | |||
523 | static 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 |
417 | static int do_siocgstamp(unsigned int fd, unsigned int cmd, unsigned long arg) | 544 | static 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) | |||
2954 | HANDLE_IOCTL(NCP_IOC_SETPRIVATEDATA_32, do_ncp_setprivatedata) | 3081 | HANDLE_IOCTL(NCP_IOC_SETPRIVATEDATA_32, do_ncp_setprivatedata) |
2955 | #endif | 3082 | #endif |
2956 | 3083 | ||
3084 | /* dvb */ | ||
3085 | HANDLE_IOCTL(DMX_GET_EVENT, do_dmx_get_event) | ||
3086 | HANDLE_IOCTL(VIDEO_GET_EVENT, do_video_get_event) | ||
3087 | HANDLE_IOCTL(VIDEO_STILLPICTURE, do_video_stillpicture) | ||
3088 | HANDLE_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) | |||
795 | COMPATIBLE_IOCTL(HIDIOCSFLAG) | 795 | COMPATIBLE_IOCTL(HIDIOCSFLAG) |
796 | COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINDEX) | 796 | COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINDEX) |
797 | COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINFO) | 797 | COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINFO) |
798 | /* dvb */ | ||
799 | COMPATIBLE_IOCTL(AUDIO_STOP) | ||
800 | COMPATIBLE_IOCTL(AUDIO_PLAY) | ||
801 | COMPATIBLE_IOCTL(AUDIO_PAUSE) | ||
802 | COMPATIBLE_IOCTL(AUDIO_CONTINUE) | ||
803 | COMPATIBLE_IOCTL(AUDIO_SELECT_SOURCE) | ||
804 | COMPATIBLE_IOCTL(AUDIO_SET_MUTE) | ||
805 | COMPATIBLE_IOCTL(AUDIO_SET_AV_SYNC) | ||
806 | COMPATIBLE_IOCTL(AUDIO_SET_BYPASS_MODE) | ||
807 | COMPATIBLE_IOCTL(AUDIO_CHANNEL_SELECT) | ||
808 | COMPATIBLE_IOCTL(AUDIO_GET_STATUS) | ||
809 | COMPATIBLE_IOCTL(AUDIO_GET_CAPABILITIES) | ||
810 | COMPATIBLE_IOCTL(AUDIO_CLEAR_BUFFER) | ||
811 | COMPATIBLE_IOCTL(AUDIO_SET_ID) | ||
812 | COMPATIBLE_IOCTL(AUDIO_SET_MIXER) | ||
813 | COMPATIBLE_IOCTL(AUDIO_SET_STREAMTYPE) | ||
814 | COMPATIBLE_IOCTL(AUDIO_SET_EXT_ID) | ||
815 | COMPATIBLE_IOCTL(AUDIO_SET_ATTRIBUTES) | ||
816 | COMPATIBLE_IOCTL(AUDIO_SET_KARAOKE) | ||
817 | COMPATIBLE_IOCTL(DMX_START) | ||
818 | COMPATIBLE_IOCTL(DMX_STOP) | ||
819 | COMPATIBLE_IOCTL(DMX_SET_FILTER) | ||
820 | COMPATIBLE_IOCTL(DMX_SET_PES_FILTER) | ||
821 | COMPATIBLE_IOCTL(DMX_SET_BUFFER_SIZE) | ||
822 | COMPATIBLE_IOCTL(DMX_GET_PES_PIDS) | ||
823 | COMPATIBLE_IOCTL(DMX_GET_CAPS) | ||
824 | COMPATIBLE_IOCTL(DMX_SET_SOURCE) | ||
825 | COMPATIBLE_IOCTL(DMX_GET_STC) | ||
826 | COMPATIBLE_IOCTL(FE_GET_INFO) | ||
827 | COMPATIBLE_IOCTL(FE_DISEQC_RESET_OVERLOAD) | ||
828 | COMPATIBLE_IOCTL(FE_DISEQC_SEND_MASTER_CMD) | ||
829 | COMPATIBLE_IOCTL(FE_DISEQC_RECV_SLAVE_REPLY) | ||
830 | COMPATIBLE_IOCTL(FE_DISEQC_SEND_BURST) | ||
831 | COMPATIBLE_IOCTL(FE_SET_TONE) | ||
832 | COMPATIBLE_IOCTL(FE_SET_VOLTAGE) | ||
833 | COMPATIBLE_IOCTL(FE_ENABLE_HIGH_LNB_VOLTAGE) | ||
834 | COMPATIBLE_IOCTL(FE_READ_STATUS) | ||
835 | COMPATIBLE_IOCTL(FE_READ_BER) | ||
836 | COMPATIBLE_IOCTL(FE_READ_SIGNAL_STRENGTH) | ||
837 | COMPATIBLE_IOCTL(FE_READ_SNR) | ||
838 | COMPATIBLE_IOCTL(FE_READ_UNCORRECTED_BLOCKS) | ||
839 | COMPATIBLE_IOCTL(FE_SET_FRONTEND) | ||
840 | COMPATIBLE_IOCTL(FE_GET_FRONTEND) | ||
841 | COMPATIBLE_IOCTL(FE_GET_EVENT) | ||
842 | COMPATIBLE_IOCTL(FE_DISHNETWORK_SEND_LEGACY_CMD) | ||
843 | COMPATIBLE_IOCTL(VIDEO_STOP) | ||
844 | COMPATIBLE_IOCTL(VIDEO_PLAY) | ||
845 | COMPATIBLE_IOCTL(VIDEO_FREEZE) | ||
846 | COMPATIBLE_IOCTL(VIDEO_CONTINUE) | ||
847 | COMPATIBLE_IOCTL(VIDEO_SELECT_SOURCE) | ||
848 | COMPATIBLE_IOCTL(VIDEO_SET_BLANK) | ||
849 | COMPATIBLE_IOCTL(VIDEO_GET_STATUS) | ||
850 | COMPATIBLE_IOCTL(VIDEO_SET_DISPLAY_FORMAT) | ||
851 | COMPATIBLE_IOCTL(VIDEO_FAST_FORWARD) | ||
852 | COMPATIBLE_IOCTL(VIDEO_SLOWMOTION) | ||
853 | COMPATIBLE_IOCTL(VIDEO_GET_CAPABILITIES) | ||
854 | COMPATIBLE_IOCTL(VIDEO_CLEAR_BUFFER) | ||
855 | COMPATIBLE_IOCTL(VIDEO_SET_ID) | ||
856 | COMPATIBLE_IOCTL(VIDEO_SET_STREAMTYPE) | ||
857 | COMPATIBLE_IOCTL(VIDEO_SET_FORMAT) | ||
858 | COMPATIBLE_IOCTL(VIDEO_SET_SYSTEM) | ||
859 | COMPATIBLE_IOCTL(VIDEO_SET_HIGHLIGHT) | ||
860 | COMPATIBLE_IOCTL(VIDEO_SET_SPU) | ||
861 | COMPATIBLE_IOCTL(VIDEO_GET_NAVI) | ||
862 | COMPATIBLE_IOCTL(VIDEO_SET_ATTRIBUTES) | ||
863 | COMPATIBLE_IOCTL(VIDEO_GET_SIZE) | ||
864 | COMPATIBLE_IOCTL(VIDEO_GET_FRAME_RATE) | ||