aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2005-11-12 15:11:12 -0500
committerDavid S. Miller <davem@davemloft.net>2005-11-12 15:11:12 -0500
commit9ffb83bcc5c5337f980dc0576bf13ac9bd4fd33d (patch)
tree51d71d16b65077943284408cd80b290f8c6596df /arch/sparc64/kernel
parent535f8d65d808421a6e1730990e39d41885b1f951 (diff)
[SBUSFB]: implement ->compat_ioctl
This patch adds a new function, sbusfb_compat_ioctl() to drivers/video/sbuslib.c and uses it as compat_ioctl in all sbus fb drivers This remove the last per-arch compat ioctl bits in arch/sparc64/kernel/ioctl32.c so it would be nice if people could test if this actually copiles and works and if yes apply it :) Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel')
-rw-r--r--arch/sparc64/kernel/ioctl32.c92
1 files changed, 0 insertions, 92 deletions
diff --git a/arch/sparc64/kernel/ioctl32.c b/arch/sparc64/kernel/ioctl32.c
index e62214354bb5..196b208665a2 100644
--- a/arch/sparc64/kernel/ioctl32.c
+++ b/arch/sparc64/kernel/ioctl32.c
@@ -12,86 +12,10 @@
12#define INCLUDES 12#define INCLUDES
13#include "compat_ioctl.c" 13#include "compat_ioctl.c"
14#include <linux/syscalls.h> 14#include <linux/syscalls.h>
15#include <asm/fbio.h>
16
17/* Use this to get at 32-bit user passed pointers.
18 * See sys_sparc32.c for description about it.
19 */
20#define A(__x) compat_ptr(__x)
21 15
22#define CODE 16#define CODE
23#include "compat_ioctl.c" 17#include "compat_ioctl.c"
24 18
25struct fbcmap32 {
26 int index; /* first element (0 origin) */
27 int count;
28 u32 red;
29 u32 green;
30 u32 blue;
31};
32
33#define FBIOPUTCMAP32 _IOW('F', 3, struct fbcmap32)
34#define FBIOGETCMAP32 _IOW('F', 4, struct fbcmap32)
35
36static int fbiogetputcmap(unsigned int fd, unsigned int cmd, unsigned long arg)
37{
38 struct fbcmap32 __user *argp = (void __user *)arg;
39 struct fbcmap __user *p = compat_alloc_user_space(sizeof(*p));
40 u32 addr;
41 int ret;
42
43 ret = copy_in_user(p, argp, 2 * sizeof(int));
44 ret |= get_user(addr, &argp->red);
45 ret |= put_user(compat_ptr(addr), &p->red);
46 ret |= get_user(addr, &argp->green);
47 ret |= put_user(compat_ptr(addr), &p->green);
48 ret |= get_user(addr, &argp->blue);
49 ret |= put_user(compat_ptr(addr), &p->blue);
50 if (ret)
51 return -EFAULT;
52 return sys_ioctl(fd, (cmd == FBIOPUTCMAP32) ? FBIOPUTCMAP_SPARC : FBIOGETCMAP_SPARC, (unsigned long)p);
53}
54
55struct fbcursor32 {
56 short set; /* what to set, choose from the list above */
57 short enable; /* cursor on/off */
58 struct fbcurpos pos; /* cursor position */
59 struct fbcurpos hot; /* cursor hot spot */
60 struct fbcmap32 cmap; /* color map info */
61 struct fbcurpos size; /* cursor bit map size */
62 u32 image; /* cursor image bits */
63 u32 mask; /* cursor mask bits */
64};
65
66#define FBIOSCURSOR32 _IOW('F', 24, struct fbcursor32)
67#define FBIOGCURSOR32 _IOW('F', 25, struct fbcursor32)
68
69static int fbiogscursor(unsigned int fd, unsigned int cmd, unsigned long arg)
70{
71 struct fbcursor __user *p = compat_alloc_user_space(sizeof(*p));
72 struct fbcursor32 __user *argp = (void __user *)arg;
73 compat_uptr_t addr;
74 int ret;
75
76 ret = copy_in_user(p, argp,
77 2 * sizeof (short) + 2 * sizeof(struct fbcurpos));
78 ret |= copy_in_user(&p->size, &argp->size, sizeof(struct fbcurpos));
79 ret |= copy_in_user(&p->cmap, &argp->cmap, 2 * sizeof(int));
80 ret |= get_user(addr, &argp->cmap.red);
81 ret |= put_user(compat_ptr(addr), &p->cmap.red);
82 ret |= get_user(addr, &argp->cmap.green);
83 ret |= put_user(compat_ptr(addr), &p->cmap.green);
84 ret |= get_user(addr, &argp->cmap.blue);
85 ret |= put_user(compat_ptr(addr), &p->cmap.blue);
86 ret |= get_user(addr, &argp->mask);
87 ret |= put_user(compat_ptr(addr), &p->mask);
88 ret |= get_user(addr, &argp->image);
89 ret |= put_user(compat_ptr(addr), &p->image);
90 if (ret)
91 return -EFAULT;
92 return sys_ioctl (fd, FBIOSCURSOR, (unsigned long)p);
93}
94
95#define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),sys_ioctl) 19#define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),sys_ioctl)
96#define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler), NULL }, 20#define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler), NULL },
97#define IOCTL_TABLE_START \ 21#define IOCTL_TABLE_START \
@@ -103,22 +27,6 @@ IOCTL_TABLE_START
103#include <linux/compat_ioctl.h> 27#include <linux/compat_ioctl.h>
104#define DECLARES 28#define DECLARES
105#include "compat_ioctl.c" 29#include "compat_ioctl.c"
106COMPATIBLE_IOCTL(FBIOGTYPE)
107COMPATIBLE_IOCTL(FBIOSATTR)
108COMPATIBLE_IOCTL(FBIOGATTR)
109COMPATIBLE_IOCTL(FBIOSVIDEO)
110COMPATIBLE_IOCTL(FBIOGVIDEO)
111COMPATIBLE_IOCTL(FBIOGCURSOR32) /* This is not implemented yet. Later it should be converted... */
112COMPATIBLE_IOCTL(FBIOSCURPOS)
113COMPATIBLE_IOCTL(FBIOGCURPOS)
114COMPATIBLE_IOCTL(FBIOGCURMAX)
115/* Little k */
116/* Little v, the video4linux ioctls */
117/* And these ioctls need translation */
118/* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */
119HANDLE_IOCTL(FBIOPUTCMAP32, fbiogetputcmap)
120HANDLE_IOCTL(FBIOGETCMAP32, fbiogetputcmap)
121HANDLE_IOCTL(FBIOSCURSOR32, fbiogscursor)
122#if 0 30#if 0
123HANDLE_IOCTL(RTC32_IRQP_READ, do_rtc_ioctl) 31HANDLE_IOCTL(RTC32_IRQP_READ, do_rtc_ioctl)
124HANDLE_IOCTL(RTC32_IRQP_SET, do_rtc_ioctl) 32HANDLE_IOCTL(RTC32_IRQP_SET, do_rtc_ioctl)