diff options
author | Antonino A. Daplas <adaplas@gmail.com> | 2007-05-08 03:39:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:30 -0400 |
commit | 3f9b0880e4a96b02bc0131451f2f6231cd90bd94 (patch) | |
tree | a47339c46ab03918b24d501df54884c277326a74 | |
parent | 87b4884935d387acc4c4418da6a75387bfcc24b9 (diff) |
fbdev: pass struct fb_info to fb_read and fb_write
It is unnecessary to pass struct file to fb_read() and fb_write() in struct
fb_ops. For consistency with the other methods, pass struct fb_info instead.
Signed-off-by: Antonino Daplas <adaplas@gmail.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/video/arcfb.c | 14 | ||||
-rw-r--r-- | drivers/video/epson1355fb.c | 18 | ||||
-rw-r--r-- | drivers/video/fbmem.c | 4 | ||||
-rw-r--r-- | drivers/video/hecubafb.c | 12 | ||||
-rw-r--r-- | drivers/video/pvr2fb.c | 4 | ||||
-rw-r--r-- | include/linux/fb.h | 6 |
6 files changed, 13 insertions, 45 deletions
diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c index 740b83b4bd8c..c668e56c9272 100644 --- a/drivers/video/arcfb.c +++ b/drivers/video/arcfb.c | |||
@@ -440,14 +440,11 @@ static int arcfb_ioctl(struct fb_info *info, | |||
440 | * the fb. it's inefficient for them to do anything less than 64*8 | 440 | * the fb. it's inefficient for them to do anything less than 64*8 |
441 | * writes since we update the lcd in each write() anyway. | 441 | * writes since we update the lcd in each write() anyway. |
442 | */ | 442 | */ |
443 | static ssize_t arcfb_write(struct file *file, const char __user *buf, size_t count, | 443 | static ssize_t arcfb_write(struct fb_info *info, const char __user *buf, |
444 | loff_t *ppos) | 444 | size_t count, loff_t *ppos) |
445 | { | 445 | { |
446 | /* modded from epson 1355 */ | 446 | /* modded from epson 1355 */ |
447 | 447 | ||
448 | struct inode *inode; | ||
449 | int fbidx; | ||
450 | struct fb_info *info; | ||
451 | unsigned long p; | 448 | unsigned long p; |
452 | int err=-EINVAL; | 449 | int err=-EINVAL; |
453 | unsigned int fbmemlength,x,y,w,h, bitppos, startpos, endpos, bitcount; | 450 | unsigned int fbmemlength,x,y,w,h, bitppos, startpos, endpos, bitcount; |
@@ -455,13 +452,6 @@ static ssize_t arcfb_write(struct file *file, const char __user *buf, size_t cou | |||
455 | unsigned int xres; | 452 | unsigned int xres; |
456 | 453 | ||
457 | p = *ppos; | 454 | p = *ppos; |
458 | inode = file->f_path.dentry->d_inode; | ||
459 | fbidx = iminor(inode); | ||
460 | info = registered_fb[fbidx]; | ||
461 | |||
462 | if (!info || !info->screen_base) | ||
463 | return -ENODEV; | ||
464 | |||
465 | par = info->par; | 455 | par = info->par; |
466 | xres = info->var.xres; | 456 | xres = info->var.xres; |
467 | fbmemlength = (xres * info->var.yres)/8; | 457 | fbmemlength = (xres * info->var.yres)/8; |
diff --git a/drivers/video/epson1355fb.c b/drivers/video/epson1355fb.c index 37e297d7feb7..ca2c54ce508e 100644 --- a/drivers/video/epson1355fb.c +++ b/drivers/video/epson1355fb.c | |||
@@ -403,17 +403,10 @@ static inline unsigned long copy_to_user16(void *to, const void *from, | |||
403 | 403 | ||
404 | 404 | ||
405 | static ssize_t | 405 | static ssize_t |
406 | epson1355fb_read(struct file *file, char *buf, size_t count, loff_t * ppos) | 406 | epson1355fb_read(struct fb_info *info, char *buf, size_t count, loff_t * ppos) |
407 | { | 407 | { |
408 | struct inode *inode = file->f_path.dentry->d_inode; | ||
409 | int fbidx = iminor(inode); | ||
410 | struct fb_info *info = registered_fb[fbidx]; | ||
411 | unsigned long p = *ppos; | 408 | unsigned long p = *ppos; |
412 | 409 | ||
413 | /* from fbmem.c except for our own copy_*_user */ | ||
414 | if (!info || !info->screen_base) | ||
415 | return -ENODEV; | ||
416 | |||
417 | if (p >= info->fix.smem_len) | 410 | if (p >= info->fix.smem_len) |
418 | return 0; | 411 | return 0; |
419 | if (count >= info->fix.smem_len) | 412 | if (count >= info->fix.smem_len) |
@@ -434,20 +427,13 @@ epson1355fb_read(struct file *file, char *buf, size_t count, loff_t * ppos) | |||
434 | } | 427 | } |
435 | 428 | ||
436 | static ssize_t | 429 | static ssize_t |
437 | epson1355fb_write(struct file *file, const char *buf, | 430 | epson1355fb_write(struct fb_info *info, const char *buf, |
438 | size_t count, loff_t * ppos) | 431 | size_t count, loff_t * ppos) |
439 | { | 432 | { |
440 | struct inode *inode = file->f_path.dentry->d_inode; | ||
441 | int fbidx = iminor(inode); | ||
442 | struct fb_info *info = registered_fb[fbidx]; | ||
443 | unsigned long p = *ppos; | 433 | unsigned long p = *ppos; |
444 | int err; | 434 | int err; |
445 | 435 | ||
446 | /* from fbmem.c except for our own copy_*_user */ | 436 | /* from fbmem.c except for our own copy_*_user */ |
447 | if (!info || !info->screen_base) | ||
448 | return -ENODEV; | ||
449 | |||
450 | /* from fbmem.c except for our own copy_*_user */ | ||
451 | if (p > info->fix.smem_len) | 437 | if (p > info->fix.smem_len) |
452 | return -ENOSPC; | 438 | return -ENOSPC; |
453 | if (count >= info->fix.smem_len) | 439 | if (count >= info->fix.smem_len) |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 08c292d9c401..7b72841222df 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -588,7 +588,7 @@ fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
588 | return -EPERM; | 588 | return -EPERM; |
589 | 589 | ||
590 | if (info->fbops->fb_read) | 590 | if (info->fbops->fb_read) |
591 | return info->fbops->fb_read(file, buf, count, ppos); | 591 | return info->fbops->fb_read(info, buf, count, ppos); |
592 | 592 | ||
593 | total_size = info->screen_size; | 593 | total_size = info->screen_size; |
594 | 594 | ||
@@ -663,7 +663,7 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | |||
663 | return -EPERM; | 663 | return -EPERM; |
664 | 664 | ||
665 | if (info->fbops->fb_write) | 665 | if (info->fbops->fb_write) |
666 | return info->fbops->fb_write(file, buf, count, ppos); | 666 | return info->fbops->fb_write(info, buf, count, ppos); |
667 | 667 | ||
668 | total_size = info->screen_size; | 668 | total_size = info->screen_size; |
669 | 669 | ||
diff --git a/drivers/video/hecubafb.c b/drivers/video/hecubafb.c index 0ade72590998..3ec0e97f36e4 100644 --- a/drivers/video/hecubafb.c +++ b/drivers/video/hecubafb.c | |||
@@ -267,12 +267,9 @@ static void hecubafb_imageblit(struct fb_info *info, | |||
267 | * this is the slow path from userspace. they can seek and write to | 267 | * this is the slow path from userspace. they can seek and write to |
268 | * the fb. it's inefficient to do anything less than a full screen draw | 268 | * the fb. it's inefficient to do anything less than a full screen draw |
269 | */ | 269 | */ |
270 | static ssize_t hecubafb_write(struct file *file, const char __user *buf, | 270 | static ssize_t hecubafb_write(struct fb_info *info, const char __user *buf, |
271 | size_t count, loff_t *ppos) | 271 | size_t count, loff_t *ppos) |
272 | { | 272 | { |
273 | struct inode *inode; | ||
274 | int fbidx; | ||
275 | struct fb_info *info; | ||
276 | unsigned long p; | 273 | unsigned long p; |
277 | int err=-EINVAL; | 274 | int err=-EINVAL; |
278 | struct hecubafb_par *par; | 275 | struct hecubafb_par *par; |
@@ -280,13 +277,6 @@ static ssize_t hecubafb_write(struct file *file, const char __user *buf, | |||
280 | unsigned int fbmemlength; | 277 | unsigned int fbmemlength; |
281 | 278 | ||
282 | p = *ppos; | 279 | p = *ppos; |
283 | inode = file->f_dentry->d_inode; | ||
284 | fbidx = iminor(inode); | ||
285 | info = registered_fb[fbidx]; | ||
286 | |||
287 | if (!info || !info->screen_base) | ||
288 | return -ENODEV; | ||
289 | |||
290 | par = info->par; | 280 | par = info->par; |
291 | xres = info->var.xres; | 281 | xres = info->var.xres; |
292 | fbmemlength = (xres * info->var.yres)/8; | 282 | fbmemlength = (xres * info->var.yres)/8; |
diff --git a/drivers/video/pvr2fb.c b/drivers/video/pvr2fb.c index a93618bc9d27..df2909ae704c 100644 --- a/drivers/video/pvr2fb.c +++ b/drivers/video/pvr2fb.c | |||
@@ -214,7 +214,7 @@ static int pvr2_init_cable(void); | |||
214 | static int pvr2_get_param(const struct pvr2_params *p, const char *s, | 214 | static int pvr2_get_param(const struct pvr2_params *p, const char *s, |
215 | int val, int size); | 215 | int val, int size); |
216 | #ifdef CONFIG_SH_DMA | 216 | #ifdef CONFIG_SH_DMA |
217 | static ssize_t pvr2fb_write(struct file *file, const char *buf, | 217 | static ssize_t pvr2fb_write(struct fb_info *info, const char *buf, |
218 | size_t count, loff_t *ppos); | 218 | size_t count, loff_t *ppos); |
219 | #endif | 219 | #endif |
220 | 220 | ||
@@ -674,7 +674,7 @@ static int pvr2_init_cable(void) | |||
674 | } | 674 | } |
675 | 675 | ||
676 | #ifdef CONFIG_SH_DMA | 676 | #ifdef CONFIG_SH_DMA |
677 | static ssize_t pvr2fb_write(struct file *file, const char *buf, | 677 | static ssize_t pvr2fb_write(struct fb_info *info, const char *buf, |
678 | size_t count, loff_t *ppos) | 678 | size_t count, loff_t *ppos) |
679 | { | 679 | { |
680 | unsigned long dst, start, end, len; | 680 | unsigned long dst, start, end, len; |
diff --git a/include/linux/fb.h b/include/linux/fb.h index c4e1b3d2ecf9..acb6ddb68fa2 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
@@ -591,8 +591,10 @@ struct fb_ops { | |||
591 | /* For framebuffers with strange non linear layouts or that do not | 591 | /* For framebuffers with strange non linear layouts or that do not |
592 | * work with normal memory mapped access | 592 | * work with normal memory mapped access |
593 | */ | 593 | */ |
594 | ssize_t (*fb_read)(struct file *file, char __user *buf, size_t count, loff_t *ppos); | 594 | ssize_t (*fb_read)(struct fb_info *info, char __user *buf, |
595 | ssize_t (*fb_write)(struct file *file, const char __user *buf, size_t count, loff_t *ppos); | 595 | size_t count, loff_t *ppos); |
596 | ssize_t (*fb_write)(struct fb_info *info, const char __user *buf, | ||
597 | size_t count, loff_t *ppos); | ||
596 | 598 | ||
597 | /* checks var and eventually tweaks it to something supported, | 599 | /* checks var and eventually tweaks it to something supported, |
598 | * DO NOT MODIFY PAR */ | 600 | * DO NOT MODIFY PAR */ |