diff options
author | Christoph Hellwig <hch@lst.de> | 2005-11-12 15:11:12 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-11-12 15:11:12 -0500 |
commit | 9ffb83bcc5c5337f980dc0576bf13ac9bd4fd33d (patch) | |
tree | 51d71d16b65077943284408cd80b290f8c6596df /drivers/video | |
parent | 535f8d65d808421a6e1730990e39d41885b1f951 (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 'drivers/video')
-rw-r--r-- | drivers/video/bw2.c | 3 | ||||
-rw-r--r-- | drivers/video/cg14.c | 3 | ||||
-rw-r--r-- | drivers/video/cg3.c | 3 | ||||
-rw-r--r-- | drivers/video/cg6.c | 3 | ||||
-rw-r--r-- | drivers/video/ffb.c | 3 | ||||
-rw-r--r-- | drivers/video/leo.c | 3 | ||||
-rw-r--r-- | drivers/video/p9100.c | 3 | ||||
-rw-r--r-- | drivers/video/sbuslib.c | 107 | ||||
-rw-r--r-- | drivers/video/sbuslib.h | 2 | ||||
-rw-r--r-- | drivers/video/tcx.c | 3 |
10 files changed, 133 insertions, 0 deletions
diff --git a/drivers/video/bw2.c b/drivers/video/bw2.c index f53bf3ba1278..d3728f60961e 100644 --- a/drivers/video/bw2.c +++ b/drivers/video/bw2.c | |||
@@ -51,6 +51,9 @@ static struct fb_ops bw2_ops = { | |||
51 | .fb_imageblit = cfb_imageblit, | 51 | .fb_imageblit = cfb_imageblit, |
52 | .fb_mmap = bw2_mmap, | 52 | .fb_mmap = bw2_mmap, |
53 | .fb_ioctl = bw2_ioctl, | 53 | .fb_ioctl = bw2_ioctl, |
54 | #ifdef CONFIG_COMPAT | ||
55 | .fb_compat_ioctl = sbusfb_compat_ioctl, | ||
56 | #endif | ||
54 | }; | 57 | }; |
55 | 58 | ||
56 | /* OBio addresses for the bwtwo registers */ | 59 | /* OBio addresses for the bwtwo registers */ |
diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c index 030d4b13b1c2..1bed50f2a276 100644 --- a/drivers/video/cg14.c +++ b/drivers/video/cg14.c | |||
@@ -49,6 +49,9 @@ static struct fb_ops cg14_ops = { | |||
49 | .fb_imageblit = cfb_imageblit, | 49 | .fb_imageblit = cfb_imageblit, |
50 | .fb_mmap = cg14_mmap, | 50 | .fb_mmap = cg14_mmap, |
51 | .fb_ioctl = cg14_ioctl, | 51 | .fb_ioctl = cg14_ioctl, |
52 | #ifdef CONFIG_COMPAT | ||
53 | .fb_compat_ioctl = sbusfb_compat_ioctl, | ||
54 | #endif | ||
52 | }; | 55 | }; |
53 | 56 | ||
54 | #define CG14_MCR_INTENABLE_SHIFT 7 | 57 | #define CG14_MCR_INTENABLE_SHIFT 7 |
diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c index b94eee8c42d5..a1354e7e0513 100644 --- a/drivers/video/cg3.c +++ b/drivers/video/cg3.c | |||
@@ -50,6 +50,9 @@ static struct fb_ops cg3_ops = { | |||
50 | .fb_imageblit = cfb_imageblit, | 50 | .fb_imageblit = cfb_imageblit, |
51 | .fb_mmap = cg3_mmap, | 51 | .fb_mmap = cg3_mmap, |
52 | .fb_ioctl = cg3_ioctl, | 52 | .fb_ioctl = cg3_ioctl, |
53 | #ifdef CONFIG_COMPAT | ||
54 | .fb_compat_ioctl = sbusfb_compat_ioctl, | ||
55 | #endif | ||
53 | }; | 56 | }; |
54 | 57 | ||
55 | 58 | ||
diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c index 414c4409e924..9debe642fd2f 100644 --- a/drivers/video/cg6.c +++ b/drivers/video/cg6.c | |||
@@ -54,6 +54,9 @@ static struct fb_ops cg6_ops = { | |||
54 | .fb_sync = cg6_sync, | 54 | .fb_sync = cg6_sync, |
55 | .fb_mmap = cg6_mmap, | 55 | .fb_mmap = cg6_mmap, |
56 | .fb_ioctl = cg6_ioctl, | 56 | .fb_ioctl = cg6_ioctl, |
57 | #ifdef CONFIG_COMPAT | ||
58 | .fb_compat_ioctl = sbusfb_compat_ioctl, | ||
59 | #endif | ||
57 | }; | 60 | }; |
58 | 61 | ||
59 | /* Offset of interesting structures in the OBIO space */ | 62 | /* Offset of interesting structures in the OBIO space */ |
diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c index 04417dc16c2e..2584daec7bbf 100644 --- a/drivers/video/ffb.c +++ b/drivers/video/ffb.c | |||
@@ -57,6 +57,9 @@ static struct fb_ops ffb_ops = { | |||
57 | .fb_sync = ffb_sync, | 57 | .fb_sync = ffb_sync, |
58 | .fb_mmap = ffb_mmap, | 58 | .fb_mmap = ffb_mmap, |
59 | .fb_ioctl = ffb_ioctl, | 59 | .fb_ioctl = ffb_ioctl, |
60 | #ifdef CONFIG_COMPAT | ||
61 | .fb_compat_ioctl = sbusfb_compat_ioctl, | ||
62 | #endif | ||
60 | }; | 63 | }; |
61 | 64 | ||
62 | /* Register layout and definitions */ | 65 | /* Register layout and definitions */ |
diff --git a/drivers/video/leo.c b/drivers/video/leo.c index 84a7fe435bb8..376d4a171ec7 100644 --- a/drivers/video/leo.c +++ b/drivers/video/leo.c | |||
@@ -51,6 +51,9 @@ static struct fb_ops leo_ops = { | |||
51 | .fb_imageblit = cfb_imageblit, | 51 | .fb_imageblit = cfb_imageblit, |
52 | .fb_mmap = leo_mmap, | 52 | .fb_mmap = leo_mmap, |
53 | .fb_ioctl = leo_ioctl, | 53 | .fb_ioctl = leo_ioctl, |
54 | #ifdef CONFIG_COMPAT | ||
55 | .fb_compat_ioctl = sbusfb_compat_ioctl, | ||
56 | #endif | ||
54 | }; | 57 | }; |
55 | 58 | ||
56 | #define LEO_OFF_LC_SS0_KRN 0x00200000UL | 59 | #define LEO_OFF_LC_SS0_KRN 0x00200000UL |
diff --git a/drivers/video/p9100.c b/drivers/video/p9100.c index 9aaf65fb623a..18bcda23d2cf 100644 --- a/drivers/video/p9100.c +++ b/drivers/video/p9100.c | |||
@@ -48,6 +48,9 @@ static struct fb_ops p9100_ops = { | |||
48 | .fb_imageblit = cfb_imageblit, | 48 | .fb_imageblit = cfb_imageblit, |
49 | .fb_mmap = p9100_mmap, | 49 | .fb_mmap = p9100_mmap, |
50 | .fb_ioctl = p9100_ioctl, | 50 | .fb_ioctl = p9100_ioctl, |
51 | #ifdef CONFIG_COMPAT | ||
52 | .fb_compat_ioctl = sbusfb_compat_ioctl, | ||
53 | #endif | ||
51 | }; | 54 | }; |
52 | 55 | ||
53 | /* P9100 control registers */ | 56 | /* P9100 control registers */ |
diff --git a/drivers/video/sbuslib.c b/drivers/video/sbuslib.c index 34f72edba820..646c43f921c5 100644 --- a/drivers/video/sbuslib.c +++ b/drivers/video/sbuslib.c | |||
@@ -3,6 +3,7 @@ | |||
3 | * Copyright (C) 2003 David S. Miller (davem@redhat.com) | 3 | * Copyright (C) 2003 David S. Miller (davem@redhat.com) |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/compat.h> | ||
6 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
7 | #include <linux/module.h> | 8 | #include <linux/module.h> |
8 | #include <linux/string.h> | 9 | #include <linux/string.h> |
@@ -182,3 +183,109 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, | |||
182 | }; | 183 | }; |
183 | } | 184 | } |
184 | EXPORT_SYMBOL(sbusfb_ioctl_helper); | 185 | EXPORT_SYMBOL(sbusfb_ioctl_helper); |
186 | |||
187 | #ifdef CONFIG_COMPAT | ||
188 | struct fbcmap32 { | ||
189 | int index; /* first element (0 origin) */ | ||
190 | int count; | ||
191 | u32 red; | ||
192 | u32 green; | ||
193 | u32 blue; | ||
194 | }; | ||
195 | |||
196 | #define FBIOPUTCMAP32 _IOW('F', 3, struct fbcmap32) | ||
197 | #define FBIOGETCMAP32 _IOW('F', 4, struct fbcmap32) | ||
198 | |||
199 | static int fbiogetputcmap(struct file *file, struct fb_info *info, | ||
200 | unsigned int cmd, unsigned long arg) | ||
201 | { | ||
202 | struct fbcmap32 __user *argp = (void __user *)arg; | ||
203 | struct fbcmap __user *p = compat_alloc_user_space(sizeof(*p)); | ||
204 | u32 addr; | ||
205 | int ret; | ||
206 | |||
207 | ret = copy_in_user(p, argp, 2 * sizeof(int)); | ||
208 | ret |= get_user(addr, &argp->red); | ||
209 | ret |= put_user(compat_ptr(addr), &p->red); | ||
210 | ret |= get_user(addr, &argp->green); | ||
211 | ret |= put_user(compat_ptr(addr), &p->green); | ||
212 | ret |= get_user(addr, &argp->blue); | ||
213 | ret |= put_user(compat_ptr(addr), &p->blue); | ||
214 | if (ret) | ||
215 | return -EFAULT; | ||
216 | return info->fbops->fb_ioctl(file->f_dentry->d_inode, file, | ||
217 | (cmd == FBIOPUTCMAP32) ? | ||
218 | FBIOPUTCMAP_SPARC : FBIOGETCMAP_SPARC, | ||
219 | (unsigned long)p, info); | ||
220 | } | ||
221 | |||
222 | struct fbcursor32 { | ||
223 | short set; /* what to set, choose from the list above */ | ||
224 | short enable; /* cursor on/off */ | ||
225 | struct fbcurpos pos; /* cursor position */ | ||
226 | struct fbcurpos hot; /* cursor hot spot */ | ||
227 | struct fbcmap32 cmap; /* color map info */ | ||
228 | struct fbcurpos size; /* cursor bit map size */ | ||
229 | u32 image; /* cursor image bits */ | ||
230 | u32 mask; /* cursor mask bits */ | ||
231 | }; | ||
232 | |||
233 | #define FBIOSCURSOR32 _IOW('F', 24, struct fbcursor32) | ||
234 | #define FBIOGCURSOR32 _IOW('F', 25, struct fbcursor32) | ||
235 | |||
236 | static int fbiogscursor(struct file *file, struct fb_info *info, | ||
237 | unsigned long arg) | ||
238 | { | ||
239 | struct fbcursor __user *p = compat_alloc_user_space(sizeof(*p)); | ||
240 | struct fbcursor32 __user *argp = (void __user *)arg; | ||
241 | compat_uptr_t addr; | ||
242 | int ret; | ||
243 | |||
244 | ret = copy_in_user(p, argp, | ||
245 | 2 * sizeof (short) + 2 * sizeof(struct fbcurpos)); | ||
246 | ret |= copy_in_user(&p->size, &argp->size, sizeof(struct fbcurpos)); | ||
247 | ret |= copy_in_user(&p->cmap, &argp->cmap, 2 * sizeof(int)); | ||
248 | ret |= get_user(addr, &argp->cmap.red); | ||
249 | ret |= put_user(compat_ptr(addr), &p->cmap.red); | ||
250 | ret |= get_user(addr, &argp->cmap.green); | ||
251 | ret |= put_user(compat_ptr(addr), &p->cmap.green); | ||
252 | ret |= get_user(addr, &argp->cmap.blue); | ||
253 | ret |= put_user(compat_ptr(addr), &p->cmap.blue); | ||
254 | ret |= get_user(addr, &argp->mask); | ||
255 | ret |= put_user(compat_ptr(addr), &p->mask); | ||
256 | ret |= get_user(addr, &argp->image); | ||
257 | ret |= put_user(compat_ptr(addr), &p->image); | ||
258 | if (ret) | ||
259 | return -EFAULT; | ||
260 | return info->fbops->fb_ioctl(file->f_dentry->d_inode, file, | ||
261 | FBIOSCURSOR, (unsigned long)p, info); | ||
262 | } | ||
263 | |||
264 | long sbusfb_compat_ioctl(struct file *file, unsigned int cmd, | ||
265 | unsigned long arg, struct fb_info *info) | ||
266 | { | ||
267 | switch (cmd) { | ||
268 | case FBIOGTYPE: | ||
269 | case FBIOSATTR: | ||
270 | case FBIOGATTR: | ||
271 | case FBIOSVIDEO: | ||
272 | case FBIOGVIDEO: | ||
273 | case FBIOGCURSOR32: /* This is not implemented yet. | ||
274 | Later it should be converted... */ | ||
275 | case FBIOSCURPOS: | ||
276 | case FBIOGCURPOS: | ||
277 | case FBIOGCURMAX: | ||
278 | return info->fbops->fb_ioctl(file->f_dentry->d_inode, | ||
279 | file, cmd, arg, info); | ||
280 | case FBIOPUTCMAP32: | ||
281 | return fbiogetputcmap(file, info, cmd, arg); | ||
282 | case FBIOGETCMAP32: | ||
283 | return fbiogetputcmap(file, info, cmd, arg); | ||
284 | case FBIOSCURSOR32: | ||
285 | return fbiogscursor(file, info, arg); | ||
286 | default: | ||
287 | return -ENOIOCTLCMD; | ||
288 | } | ||
289 | } | ||
290 | EXPORT_SYMBOL(sbusfb_compat_ioctl); | ||
291 | #endif | ||
diff --git a/drivers/video/sbuslib.h b/drivers/video/sbuslib.h index a6aa33ba09d6..b470e52ce9e2 100644 --- a/drivers/video/sbuslib.h +++ b/drivers/video/sbuslib.h | |||
@@ -20,5 +20,7 @@ extern int sbusfb_mmap_helper(struct sbus_mmap_map *map, | |||
20 | int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, | 20 | int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, |
21 | struct fb_info *info, | 21 | struct fb_info *info, |
22 | int type, int fb_depth, unsigned long fb_size); | 22 | int type, int fb_depth, unsigned long fb_size); |
23 | long sbusfb_compat_ioctl(struct file *file, unsigned int cmd, | ||
24 | unsigned long arg, struct fb_info *info); | ||
23 | 25 | ||
24 | #endif /* _SBUSLIB_H */ | 26 | #endif /* _SBUSLIB_H */ |
diff --git a/drivers/video/tcx.c b/drivers/video/tcx.c index 59fff29bc02e..fe4f63f3849d 100644 --- a/drivers/video/tcx.c +++ b/drivers/video/tcx.c | |||
@@ -52,6 +52,9 @@ static struct fb_ops tcx_ops = { | |||
52 | .fb_imageblit = cfb_imageblit, | 52 | .fb_imageblit = cfb_imageblit, |
53 | .fb_mmap = tcx_mmap, | 53 | .fb_mmap = tcx_mmap, |
54 | .fb_ioctl = tcx_ioctl, | 54 | .fb_ioctl = tcx_ioctl, |
55 | #ifdef CONFIG_COMPAT | ||
56 | .fb_compat_ioctl = sbusfb_compat_ioctl, | ||
57 | #endif | ||
55 | }; | 58 | }; |
56 | 59 | ||
57 | /* THC definitions */ | 60 | /* THC definitions */ |