aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/ivtv
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2018-08-27 15:56:25 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-12 11:00:51 -0400
commit04b72322e85dd7987085a4d29a29ebc1a5ad5dd2 (patch)
tree0265a01fe624c143df6a4d4355fb6c8bba7b9bb4 /drivers/media/pci/ivtv
parent8a24280b11ea49ed13d384c7426419201600c3a9 (diff)
media: dvb: move compat handlers into drivers
The VIDEO_STILLPICTURE is only implemented by one driver, while VIDEO_GET_EVENT has two users in tree. In both cases, it is fairly easy to handle the compat ioctls in the native handler rather than relying on translation in fs/compat_ioctls. In effect, this means that now the drivers implement both structure layouts in both native and compat mode, but I don't see anything wrong with that. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/pci/ivtv')
-rw-r--r--drivers/media/pci/ivtv/ivtv-ioctl.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/ivtv-ioctl.c
index edb85ca9c0c2..a66f8b872520 100644
--- a/drivers/media/pci/ivtv/ivtv-ioctl.c
+++ b/drivers/media/pci/ivtv/ivtv-ioctl.c
@@ -36,6 +36,7 @@
36#include <media/tveeprom.h> 36#include <media/tveeprom.h>
37#include <media/v4l2-event.h> 37#include <media/v4l2-event.h>
38#ifdef CONFIG_VIDEO_IVTV_DEPRECATED_IOCTLS 38#ifdef CONFIG_VIDEO_IVTV_DEPRECATED_IOCTLS
39#include <linux/compat.h>
39#include <linux/dvb/audio.h> 40#include <linux/dvb/audio.h>
40#include <linux/dvb/video.h> 41#include <linux/dvb/video.h>
41#endif 42#endif
@@ -1627,6 +1628,21 @@ static __inline__ void warn_deprecated_ioctl(const char *name)
1627 pr_warn_once("warning: the %s ioctl is deprecated. Don't use it, as it will be removed soon\n", 1628 pr_warn_once("warning: the %s ioctl is deprecated. Don't use it, as it will be removed soon\n",
1628 name); 1629 name);
1629} 1630}
1631
1632#ifdef CONFIG_COMPAT
1633struct compat_video_event {
1634 __s32 type;
1635 /* unused, make sure to use atomic time for y2038 if it ever gets used */
1636 compat_long_t timestamp;
1637 union {
1638 video_size_t size;
1639 unsigned int frame_rate; /* in frames per 1000sec */
1640 unsigned char vsync_field; /* unknown/odd/even/progressive */
1641 } u;
1642};
1643#define VIDEO_GET_EVENT32 _IOR('o', 28, struct compat_video_event)
1644#endif
1645
1630#endif 1646#endif
1631 1647
1632static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg) 1648static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg)
@@ -1749,7 +1765,13 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg)
1749 return ivtv_video_command(itv, id, dc, try); 1765 return ivtv_video_command(itv, id, dc, try);
1750 } 1766 }
1751 1767
1768#ifdef CONFIG_COMPAT
1769 case VIDEO_GET_EVENT32:
1770#endif
1752 case VIDEO_GET_EVENT: { 1771 case VIDEO_GET_EVENT: {
1772#ifdef CONFIG_COMPAT
1773 struct compat_video_event *ev32 = arg;
1774#endif
1753 struct video_event *ev = arg; 1775 struct video_event *ev = arg;
1754 DEFINE_WAIT(wait); 1776 DEFINE_WAIT(wait);
1755 1777
@@ -1763,14 +1785,22 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg)
1763 if (test_and_clear_bit(IVTV_F_I_EV_DEC_STOPPED, &itv->i_flags)) 1785 if (test_and_clear_bit(IVTV_F_I_EV_DEC_STOPPED, &itv->i_flags))
1764 ev->type = VIDEO_EVENT_DECODER_STOPPED; 1786 ev->type = VIDEO_EVENT_DECODER_STOPPED;
1765 else if (test_and_clear_bit(IVTV_F_I_EV_VSYNC, &itv->i_flags)) { 1787 else if (test_and_clear_bit(IVTV_F_I_EV_VSYNC, &itv->i_flags)) {
1788 unsigned char vsync_field;
1789
1766 ev->type = VIDEO_EVENT_VSYNC; 1790 ev->type = VIDEO_EVENT_VSYNC;
1767 ev->u.vsync_field = test_bit(IVTV_F_I_EV_VSYNC_FIELD, &itv->i_flags) ? 1791 vsync_field = test_bit(IVTV_F_I_EV_VSYNC_FIELD, &itv->i_flags) ?
1768 VIDEO_VSYNC_FIELD_ODD : VIDEO_VSYNC_FIELD_EVEN; 1792 VIDEO_VSYNC_FIELD_ODD : VIDEO_VSYNC_FIELD_EVEN;
1769 if (itv->output_mode == OUT_UDMA_YUV && 1793 if (itv->output_mode == OUT_UDMA_YUV &&
1770 (itv->yuv_info.lace_mode & IVTV_YUV_MODE_MASK) == 1794 (itv->yuv_info.lace_mode & IVTV_YUV_MODE_MASK) ==
1771 IVTV_YUV_MODE_PROGRESSIVE) { 1795 IVTV_YUV_MODE_PROGRESSIVE) {
1772 ev->u.vsync_field = VIDEO_VSYNC_FIELD_PROGRESSIVE; 1796 vsync_field = VIDEO_VSYNC_FIELD_PROGRESSIVE;
1773 } 1797 }
1798#ifdef CONFIG_COMPAT
1799 if (cmd == VIDEO_GET_EVENT32)
1800 ev32->u.vsync_field = vsync_field;
1801 else
1802#endif
1803 ev->u.vsync_field = vsync_field;
1774 } 1804 }
1775 if (ev->type) 1805 if (ev->type)
1776 return 0; 1806 return 0;