diff options
Diffstat (limited to 'drivers/video/fbmem.c')
-rw-r--r-- | drivers/video/fbmem.c | 63 |
1 files changed, 44 insertions, 19 deletions
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 0c1461b26dd6..776f7fcd2fbf 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/linux_logo.h> | 27 | #include <linux/linux_logo.h> |
28 | #include <linux/proc_fs.h> | 28 | #include <linux/proc_fs.h> |
29 | #include <linux/seq_file.h> | ||
29 | #include <linux/console.h> | 30 | #include <linux/console.h> |
30 | #ifdef CONFIG_KMOD | 31 | #ifdef CONFIG_KMOD |
31 | #include <linux/kmod.h> | 32 | #include <linux/kmod.h> |
@@ -632,27 +633,51 @@ int fb_prepare_logo(struct fb_info *info, int rotate) { return 0; } | |||
632 | int fb_show_logo(struct fb_info *info, int rotate) { return 0; } | 633 | int fb_show_logo(struct fb_info *info, int rotate) { return 0; } |
633 | #endif /* CONFIG_LOGO */ | 634 | #endif /* CONFIG_LOGO */ |
634 | 635 | ||
635 | static int fbmem_read_proc(char *buf, char **start, off_t offset, | 636 | static void *fb_seq_start(struct seq_file *m, loff_t *pos) |
636 | int len, int *eof, void *private) | 637 | { |
638 | return (*pos < FB_MAX) ? pos : NULL; | ||
639 | } | ||
640 | |||
641 | static void *fb_seq_next(struct seq_file *m, void *v, loff_t *pos) | ||
642 | { | ||
643 | (*pos)++; | ||
644 | return (*pos < FB_MAX) ? pos : NULL; | ||
645 | } | ||
646 | |||
647 | static void fb_seq_stop(struct seq_file *m, void *v) | ||
637 | { | 648 | { |
638 | struct fb_info **fi; | ||
639 | int clen; | ||
640 | |||
641 | clen = 0; | ||
642 | for (fi = registered_fb; fi < ®istered_fb[FB_MAX] && clen < 4000; | ||
643 | fi++) | ||
644 | if (*fi) | ||
645 | clen += sprintf(buf + clen, "%d %s\n", | ||
646 | (*fi)->node, | ||
647 | (*fi)->fix.id); | ||
648 | *start = buf + offset; | ||
649 | if (clen > offset) | ||
650 | clen -= offset; | ||
651 | else | ||
652 | clen = 0; | ||
653 | return clen < len ? clen : len; | ||
654 | } | 649 | } |
655 | 650 | ||
651 | static int fb_seq_show(struct seq_file *m, void *v) | ||
652 | { | ||
653 | int i = *(loff_t *)v; | ||
654 | struct fb_info *fi = registered_fb[i]; | ||
655 | |||
656 | if (fi) | ||
657 | seq_printf(m, "%d %s\n", fi->node, fi->fix.id); | ||
658 | return 0; | ||
659 | } | ||
660 | |||
661 | static const struct seq_operations proc_fb_seq_ops = { | ||
662 | .start = fb_seq_start, | ||
663 | .next = fb_seq_next, | ||
664 | .stop = fb_seq_stop, | ||
665 | .show = fb_seq_show, | ||
666 | }; | ||
667 | |||
668 | static int proc_fb_open(struct inode *inode, struct file *file) | ||
669 | { | ||
670 | return seq_open(file, &proc_fb_seq_ops); | ||
671 | } | ||
672 | |||
673 | static const struct file_operations fb_proc_fops = { | ||
674 | .owner = THIS_MODULE, | ||
675 | .open = proc_fb_open, | ||
676 | .read = seq_read, | ||
677 | .llseek = seq_lseek, | ||
678 | .release = seq_release, | ||
679 | }; | ||
680 | |||
656 | static ssize_t | 681 | static ssize_t |
657 | fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | 682 | fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) |
658 | { | 683 | { |
@@ -1533,7 +1558,7 @@ void fb_set_suspend(struct fb_info *info, int state) | |||
1533 | static int __init | 1558 | static int __init |
1534 | fbmem_init(void) | 1559 | fbmem_init(void) |
1535 | { | 1560 | { |
1536 | create_proc_read_entry("fb", 0, NULL, fbmem_read_proc, NULL); | 1561 | proc_create("fb", 0, NULL, &fb_proc_fops); |
1537 | 1562 | ||
1538 | if (register_chrdev(FB_MAJOR,"fb",&fb_fops)) | 1563 | if (register_chrdev(FB_MAJOR,"fb",&fb_fops)) |
1539 | printk("unable to get major %d for fb devs\n", FB_MAJOR); | 1564 | printk("unable to get major %d for fb devs\n", FB_MAJOR); |