From: Greg KH <greg@kroah.com>




 25-akpm/drivers/video/aty/aty128fb.c          |    1 +
 25-akpm/drivers/video/cirrusfb.c              |    1 +
 25-akpm/drivers/video/cyber2000fb.c           |    1 +
 25-akpm/drivers/video/fbmem.c                 |   10 ++++++++++
 25-akpm/drivers/video/i810/i810_main.c        |    1 +
 25-akpm/drivers/video/igafb.c                 |    5 +++--
 25-akpm/drivers/video/imsttfb.c               |    5 +++--
 25-akpm/drivers/video/matrox/matroxfb_crtc2.c |    1 +
 25-akpm/drivers/video/neofb.c                 |    1 +
 25-akpm/drivers/video/radeonfb.c              |    1 +
 25-akpm/drivers/video/riva/fbdev.c            |    1 +
 25-akpm/drivers/video/sis/sis_main.c          |    1 +
 25-akpm/drivers/video/sstfb.c                 |    1 +
 25-akpm/drivers/video/tdfxfb.c                |    1 +
 25-akpm/drivers/video/tgafb.c                 |    1 +
 25-akpm/drivers/video/tridentfb.c             |    1 +
 25-akpm/include/linux/fb.h                    |    2 ++
 17 files changed, 31 insertions(+), 4 deletions(-)

diff -puN drivers/video/aty/aty128fb.c~sysfs-add-video-class drivers/video/aty/aty128fb.c
--- 25/drivers/video/aty/aty128fb.c~sysfs-add-video-class	Tue Dec 23 15:28:55 2003
+++ 25-akpm/drivers/video/aty/aty128fb.c	Tue Dec 23 15:28:55 2003
@@ -1536,6 +1536,7 @@ aty128_init(struct pci_dev *pdev, const 
 	/* fill in info */
 	info->fbops = &aty128fb_ops;
 	info->flags = FBINFO_FLAG_DEFAULT;
+	info->dev = &pdev->dev;
 
 #ifdef CONFIG_PMAC_PBOOK
 	par->lcd_on = default_lcd_on;
diff -puN drivers/video/cirrusfb.c~sysfs-add-video-class drivers/video/cirrusfb.c
--- 25/drivers/video/cirrusfb.c~sysfs-add-video-class	Tue Dec 23 15:28:55 2003
+++ 25-akpm/drivers/video/cirrusfb.c	Tue Dec 23 15:28:55 2003
@@ -2787,6 +2787,7 @@ int __init clgenfb_init(void)
 	fb_info->gen.info.switch_con = &fbgen_switch;
 	fb_info->gen.info.updatevar = &fbgen_update_var;
 	fb_info->gen.info.flags = FBINFO_FLAG_DEFAULT;
+	fb_info->gen.info.dev = fb_info->pdev;
 
 	for (j = 0; j < 256; j++) {
 		if (j < 16) {
diff -puN drivers/video/cyber2000fb.c~sysfs-add-video-class drivers/video/cyber2000fb.c
--- 25/drivers/video/cyber2000fb.c~sysfs-add-video-class	Tue Dec 23 15:28:55 2003
+++ 25-akpm/drivers/video/cyber2000fb.c	Tue Dec 23 15:28:55 2003
@@ -1366,6 +1366,7 @@ static int __devinit cyberpro_common_pro
 	cfb->fb.fix.smem_len   = smem_size;
 	cfb->fb.fix.mmio_len   = MMIO_SIZE;
 	cfb->fb.screen_base    = cfb->region;
+	cfb->fb.dev            = &cfb->dev->dev;
 
 	err = -EINVAL;
 	if (!fb_find_mode(&cfb->fb.var, &cfb->fb, NULL, NULL, 0,
diff -puN drivers/video/fbmem.c~sysfs-add-video-class drivers/video/fbmem.c
--- 25/drivers/video/fbmem.c~sysfs-add-video-class	Tue Dec 23 15:28:55 2003
+++ 25-akpm/drivers/video/fbmem.c	Tue Dec 23 15:28:55 2003
@@ -31,6 +31,7 @@
 #include <linux/kmod.h>
 #endif
 #include <linux/devfs_fs_kernel.h>
+#include <linux/device.h>
 
 #if defined(__mc68000__) || defined(CONFIG_APUS)
 #include <asm/setup.h>
@@ -1199,6 +1200,10 @@ static struct file_operations fb_fops = 
 #endif
 };
 
+static struct class fb_class = {
+	.name	= "video",
+};
+
 /**
  *	register_framebuffer - registers a frame buffer device
  *	@fb_info: frame buffer info structure
@@ -1242,6 +1247,8 @@ register_framebuffer(struct fb_info *fb_
 
 	devfs_mk_cdev(MKDEV(FB_MAJOR, i),
 			S_IFCHR | S_IRUGO | S_IWUGO, "fb/%d", i);
+
+	simple_add_class_device(&fb_class, MKDEV(FB_MAJOR, i), fb_info->dev, "fb%d", i);
 	return 0;
 }
 
@@ -1270,6 +1277,7 @@ unregister_framebuffer(struct fb_info *f
 		kfree(fb_info->pixmap.addr);
 	registered_fb[i]=NULL;
 	num_registered_fb--;
+	simple_remove_class_device(MKDEV(FB_MAJOR, i));
 	return 0;
 }
 
@@ -1294,6 +1302,8 @@ fbmem_init(void)
 	if (register_chrdev(FB_MAJOR,"fb",&fb_fops))
 		printk("unable to get major %d for fb devs\n", FB_MAJOR);
 
+	class_register(&fb_class);
+
 #ifdef CONFIG_FB_OF
 	if (ofonly) {
 		offb_init();
diff -puN drivers/video/i810/i810_main.c~sysfs-add-video-class drivers/video/i810/i810_main.c
--- 25/drivers/video/i810/i810_main.c~sysfs-add-video-class	Tue Dec 23 15:28:55 2003
+++ 25-akpm/drivers/video/i810/i810_main.c	Tue Dec 23 15:28:55 2003
@@ -1880,6 +1880,7 @@ static int __devinit i810fb_init_pci (st
 	info->fbops = &par->i810fb_ops;
 	info->pseudo_palette = par->pseudo_palette;
 	info->flags = FBINFO_FLAG_DEFAULT;
+	info->dev = &dev->dev;
 	
 	fb_alloc_cmap(&info->cmap, 256, 0);
 
diff -puN drivers/video/igafb.c~sysfs-add-video-class drivers/video/igafb.c
--- 25/drivers/video/igafb.c~sysfs-add-video-class	Tue Dec 23 15:28:55 2003
+++ 25-akpm/drivers/video/igafb.c	Tue Dec 23 15:28:55 2003
@@ -332,7 +332,7 @@ static struct fb_ops igafb_ops = {
 #endif
 };
 
-static int __init iga_init(struct fb_info *info, struct iga_par *par)
+static int __init iga_init(struct fb_info *info, struct iga_par *par, struct pci_dev *dev)
 {
         char vramsz = iga_inb(par, IGA_EXT_CNTRL, IGA_IDX_EXT_BUS_CNTL) 
 		                                         & MEM_SIZE_ALIAS;
@@ -358,6 +358,7 @@ static int __init iga_init(struct fb_inf
 
 	info->fbops = &igafb_ops;
 	info->flags = FBINFO_FLAG_DEFAULT;
+	info->dev = &dev->dev;
 
 	fb_alloc_cmap(&info->cmap, video_cmap_len, 0);
 
@@ -529,7 +530,7 @@ int __init igafb_init(void)
 	info->fix = igafb_fix;
 	info->pseudo_palette = (void *)(par + 1);
 
-	if (!iga_init(info, par)) {
+	if (!iga_init(info, par, pdev)) {
 		iounmap((void *)par->io_base);
 		iounmap(info->screen_base);
 		if (par->mmap_map)
diff -puN drivers/video/imsttfb.c~sysfs-add-video-class drivers/video/imsttfb.c
--- 25/drivers/video/imsttfb.c~sysfs-add-video-class	Tue Dec 23 15:28:55 2003
+++ 25-akpm/drivers/video/imsttfb.c	Tue Dec 23 15:28:55 2003
@@ -1348,7 +1348,7 @@ static struct fb_ops imsttfb_ops = {
 };
 
 static void __init 
-init_imstt(struct fb_info *info)
+init_imstt(struct fb_info *info, struct pci_dev *pdev)
 {
 	struct imstt_par *par = (struct imstt_par *) info->par;
 	__u32 i, tmp, *ip, *end;
@@ -1442,6 +1442,7 @@ init_imstt(struct fb_info *info)
 
 	info->fbops = &imsttfb_ops;
 	info->flags = FBINFO_FLAG_DEFAULT;
+	info->dev = &pdev->dev;
 
 	fb_alloc_cmap(&info->cmap, 0, 0);
 
@@ -1520,7 +1521,7 @@ imsttfb_probe(struct pci_dev *pdev, cons
 	par->cmap_regs = (__u8 *)ioremap(addr + 0x840000, 0x1000);
 	info->par = par;
 	info->pseudo_palette = (void *) (par + 1);
-	init_imstt(info);
+	init_imstt(info, pdev);
 
 	pci_set_drvdata(pdev, info);
 	return 0;
diff -puN drivers/video/matrox/matroxfb_crtc2.c~sysfs-add-video-class drivers/video/matrox/matroxfb_crtc2.c
--- 25/drivers/video/matrox/matroxfb_crtc2.c~sysfs-add-video-class	Tue Dec 23 15:28:55 2003
+++ 25-akpm/drivers/video/matrox/matroxfb_crtc2.c	Tue Dec 23 15:28:55 2003
@@ -605,6 +605,7 @@ static int matroxfb_dh_regit(CPMINFO str
 	m2info->fbcon.flags = FBINFO_FLAG_DEFAULT;
 	m2info->fbcon.currcon = -1;
 	m2info->fbcon.pseudo_palette = m2info->cmap;
+	m2info->fbcon.dev = &m2info->primary_dev->pcidev->dev;
 	fb_alloc_cmap(&m2info->fbcon.cmap, 256, 1);
 
 	if (mem < 64)
diff -puN drivers/video/neofb.c~sysfs-add-video-class drivers/video/neofb.c
--- 25/drivers/video/neofb.c~sysfs-add-video-class	Tue Dec 23 15:28:55 2003
+++ 25-akpm/drivers/video/neofb.c	Tue Dec 23 15:28:55 2003
@@ -1943,6 +1943,7 @@ static struct fb_info *__devinit neo_all
 	info->flags = FBINFO_FLAG_DEFAULT;
 	info->par = par;
 	info->pseudo_palette = (void *) (par + 1);
+	info->dev = &dev->dev;
 
 	fb_alloc_cmap(&info->cmap, NR_PALETTE, 0);
 
diff -puN drivers/video/radeonfb.c~sysfs-add-video-class drivers/video/radeonfb.c
--- 25/drivers/video/radeonfb.c~sysfs-add-video-class	Tue Dec 23 15:28:55 2003
+++ 25-akpm/drivers/video/radeonfb.c	Tue Dec 23 15:28:55 2003
@@ -3037,6 +3037,7 @@ static int radeonfb_pci_register (struct
 	pci_set_drvdata(pdev, rinfo);
 	rinfo->next = board_list;
 	board_list = rinfo;
+	rinfo->info.dev = &pdev->dev;
 
 	if (register_framebuffer ((struct fb_info *) rinfo) < 0) {
 		printk ("radeonfb: could not register framebuffer\n");
diff -puN drivers/video/riva/fbdev.c~sysfs-add-video-class drivers/video/riva/fbdev.c
--- 25/drivers/video/riva/fbdev.c~sysfs-add-video-class	Tue Dec 23 15:28:55 2003
+++ 25-akpm/drivers/video/riva/fbdev.c	Tue Dec 23 15:28:55 2003
@@ -1751,6 +1751,7 @@ static int __devinit rivafb_probe(struct
 	if (info->pixmap.addr == NULL)
 		goto err_out_kfree1;
 	memset(info->pixmap.addr, 0, 64 * 1024);
+	info->dev = &pd->dev;
 
 	strcat(rivafb_fix.id, rci->name);
 	default_par->riva.Architecture = rci->arch_rev;
diff -puN drivers/video/sis/sis_main.c~sysfs-add-video-class drivers/video/sis/sis_main.c
--- 25/drivers/video/sis/sis_main.c~sysfs-add-video-class	Tue Dec 23 15:28:55 2003
+++ 25-akpm/drivers/video/sis/sis_main.c	Tue Dec 23 15:28:55 2003
@@ -4507,6 +4507,7 @@ int __init sisfb_init(void)
 		sis_fb_info.par = &ivideo;
 		sis_fb_info.screen_base = ivideo.video_vbase;
 		sis_fb_info.fbops = &sisfb_ops;
+		sis_fb_info.dev = &pdev->dev;
 		sisfb_get_fix(&sis_fb_info.fix, -1, &sis_fb_info);
 		sis_fb_info.pseudo_palette = pseudo_palette;
 		
diff -puN drivers/video/sstfb.c~sysfs-add-video-class drivers/video/sstfb.c
--- 25/drivers/video/sstfb.c~sysfs-add-video-class	Tue Dec 23 15:28:55 2003
+++ 25-akpm/drivers/video/sstfb.c	Tue Dec 23 15:28:55 2003
@@ -1477,6 +1477,7 @@ static int __devinit sstfb_probe(struct 
 	info->fbops	= &sstfb_ops;
 	info->currcon	= -1;
 	info->pseudo_palette = &all->pseudo_palette;
+	info->dev	= &pdev->dev;
 
 	fix->type	= FB_TYPE_PACKED_PIXELS;
 	fix->visual	= FB_VISUAL_TRUECOLOR;
diff -puN drivers/video/tdfxfb.c~sysfs-add-video-class drivers/video/tdfxfb.c
--- 25/drivers/video/tdfxfb.c~sysfs-add-video-class	Tue Dec 23 15:28:55 2003
+++ 25-akpm/drivers/video/tdfxfb.c	Tue Dec 23 15:28:55 2003
@@ -1248,6 +1248,7 @@ static int __devinit tdfxfb_probe(struct
 	info->par		= default_par;
 	info->pseudo_palette	= (void *)(default_par + 1); 
 	info->flags		= FBINFO_FLAG_DEFAULT;
+	info->dev		= &pdev->dev;
 
 #ifndef MODULE
 	if (!mode_option)
diff -puN drivers/video/tgafb.c~sysfs-add-video-class drivers/video/tgafb.c
--- 25/drivers/video/tgafb.c~sysfs-add-video-class	Tue Dec 23 15:28:55 2003
+++ 25-akpm/drivers/video/tgafb.c	Tue Dec 23 15:28:55 2003
@@ -1430,6 +1430,7 @@ tgafb_pci_register(struct pci_dev *pdev,
 	all->info.currcon = -1;
 	all->info.par = &all->par;
 	all->info.pseudo_palette = all->pseudo_palette;
+	all->info.dev = &pdev->dev;
 
 	/* This should give a reasonable default video mode.  */
 
diff -puN drivers/video/tridentfb.c~sysfs-add-video-class drivers/video/tridentfb.c
--- 25/drivers/video/tridentfb.c~sysfs-add-video-class	Tue Dec 23 15:28:55 2003
+++ 25-akpm/drivers/video/tridentfb.c	Tue Dec 23 15:28:55 2003
@@ -1156,6 +1156,7 @@ static int __devinit trident_pci_probe(s
 		default_var.accel_flags &= ~FB_ACCELF_TEXT;
 	default_var.activate |= FB_ACTIVATE_NOW;
 	fb_info.var = default_var;
+	fb_info.dev = &dev->dev;
 	if (register_framebuffer(&fb_info) < 0) {
 		output("Could not register Trident framebuffer\n");
 		return -EINVAL;
diff -puN include/linux/fb.h~sysfs-add-video-class include/linux/fb.h
--- 25/include/linux/fb.h~sysfs-add-video-class	Tue Dec 23 15:28:55 2003
+++ 25-akpm/include/linux/fb.h	Tue Dec 23 15:28:55 2003
@@ -352,6 +352,7 @@ struct fb_pixmap {
 struct fb_info;
 struct vm_area_struct;
 struct file;
+struct device;
 
     /*
      *  Frame buffer operations
@@ -412,6 +413,7 @@ struct fb_info {
    struct vc_data *display_fg;		/* Console visible on this display */
    int currcon;				/* Current VC. */	
    void *pseudo_palette;                /* Fake palette of 16 colors */ 
+   struct device *dev;                  /* pointer to the device for this fb */
    /* From here on everything is device dependent */
    void *par;	
 };

_