fbdev: Pass struct device to class_simple_device_add
PATCH 6/7 fbdev: Pass struct device to class_simple_device_add
Swsusp turns off the display when a power-management-enabled framebuffer driver is used. According to Nigel Cunningham <[email protected]>, the fix may involve the following:
"...I thought the best approach would be to use device classes to find the struct dev for the frame buffer driver, and then use the same code I use for storage devices to avoid suspending the frame buffer until later..."
Changes:
- pass info->device to class_simple_device_add()
- add struct device *device to struct fb_info
- store struct device in framebuffer_alloc()
- for drivers not using framebuffer_alloc(), store the struct during initalization
- port i810fb and rivafb to use framebuffer_alloc()
---
drivers/video/aty/atyfb_base.c | 2 drivers/video/chipsfb.c | 2 drivers/video/cyber2000fb.c | 2 drivers/video/fbmem.c | 3 - drivers/video/fbsysfs.c | 2 drivers/video/i810/i810_main.c | 75 +++++++++++++++-------------------- drivers/video/igafb.c | 1 drivers/video/imsttfb.c | 1 drivers/video/kyro/fbdev.c | 1 drivers/video/matrox/matroxfb_base.c | 1 drivers/video/pvr2fb.c | 1 drivers/video/radeonfb.c | 2 drivers/video/riva/fbdev.c | 22 +++------- drivers/video/sstfb.c | 1 drivers/video/tgafb.c | 1 drivers/video/tridentfb.c | 1 include/linux/fb.h | 1 17 files changed, 58 insertions(+), 61 deletions(-)
drivers/video/aty/atyfb_base.c +1 -1
@@ -1976,7 +1976,7 @@ int __init atyfb_init(void) info->fix = atyfb_fix; info->par = default_par; - + info->device = &pdev->dev;#ifdef __sparc__/* * Map memory-mapped registers.
drivers/video/chipsfb.c +1 -1
@@ -416,7 +416,7 @@ chipsfb_pci_init(struct pci_dev *dp, conrelease_mem_region (addr, size);return -ENOMEM ; } - + p->device = &dp->dev;init_chips (p, addr);#ifdef CONFIG_PMAC_PBOOK
drivers/video/cyber2000fb.c +2 -0
@@ -1399,6 +1399,8 @@ static int __devinit cyberpro_common_pro cfb->fb.var.xres, cfb->fb.var.yres, h_sync / 1000, h_sync % 1000, v_sync); +if (cfb->dev) + cfb->fb.device = &cfb->dev->dev; err =register_framebuffer (&cfb->fb); failed:
drivers/video/fbmem.c +2 -1
@@ -1131,7 +1131,8 @@ register_framebuffer(struct fb_info *fb_break ; fb_info->node = i; - c =class_simple_device_add (fb_class,MKDEV (FB_MAJOR , i),NULL ,"fb%d" , i); + c =class_simple_device_add (fb_class,MKDEV (FB_MAJOR , i), + fb_info->device,"fb%d" , i);if (IS_ERR (c)) {/* Not fatal */ printk (KERN_WARNING "Unable to create class_device for framebuffer %d; errno = %ld\n" , i,PTR_ERR (c));
drivers/video/fbsysfs.c +2 -0
@@ -51,6 +51,8 @@ struct fb_info *framebuffer_alloc(size_tif (size) info->par = p + fb_info_size; + info->device = dev; +return info;#undef PADDING#undef BYTES_PER_LONG
drivers/video/i810/i810_main.c +31 -40
89 lines not on this page · raw message
drivers/video/igafb.c +1 -0
@@ -528,6 +528,7 @@ int __init igafb_init(void) info->var = default_var; info->fix = igafb_fix; info->pseudo_palette = (void *)(par +1 ); + info->device = &pdev->dev;if (!iga_init (info, par)) {iounmap ((void *)par->io_base);
drivers/video/imsttfb.c +1 -0
@@ -1524,6 +1524,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 ); + info->device = &pdev->dev;init_imstt (info);pci_set_drvdata (pdev, info);
drivers/video/kyro/fbdev.c +1 -0
@@ -735,6 +735,7 @@ static int __devinit kyrofb_probe(structfb_memset (info->screen_base,0 , size); + info->device = &pdev->dev;if (register_framebuffer (info) <0 ) goto out_unmap;
drivers/video/matrox/matroxfb_base.c +1 -0
@@ -1864,6 +1864,7 @@ static int initMatrox2(WPMINFO struct bo/* We do not have to set currcon to 0... register_framebuffer do it for us on first console * and we do not want currcon == 0 for subsequent framebuffers */ +ACCESS_FBINFO (fbcon).device = &ACCESS_FBINFO (pcidev)->dev;if (register_framebuffer (&ACCESS_FBINFO (fbcon)) <0 ) { goto failVideoIO; }
drivers/video/pvr2fb.c +1 -0
@@ -939,6 +939,7 @@ static int __devinit pvr2fb_pci_probe(st pvr2_fix.mmio_start =pci_resource_start (pdev,1 ); pvr2_fix.mmio_len =pci_resource_len (pdev,1 ); + fbinfo->device = &pdev->dev;return pvr2fb_common_init (); }
drivers/video/radeonfb.c +1 -1
@@ -3040,7 +3040,7 @@ static int radeonfb_pci_register (structpci_set_drvdata (pdev, rinfo); rinfo->next = board_list; board_list = rinfo; - + ((struct fb_info *) rinfo)->device = &pdev->dev;if (register_framebuffer ((struct fb_info *) rinfo) <0 ) {printk ("radeonfb: could not register framebuffer\n" );iounmap ((void *)rinfo->fb_base);
drivers/video/riva/fbdev.c +7 -15
@@ -1858,21 +1858,17 @@ static int __devinit rivafb_probe(structNVTRACE_ENTER ();assert (pd !=NULL ); - info =kmalloc (sizeof (struct fb_info ),GFP_KERNEL ); + info =framebuffer_alloc (sizeof (struct riva_par ), &pd->dev); +if (!info) goto err_out; - default_par =kmalloc (sizeof (struct riva_par ),GFP_KERNEL ); -if (!default_par) - goto err_out_kfree; - -memset (info,0 ,sizeof (struct fb_info )); -memset (default_par,0 ,sizeof (struct riva_par )); + default_par = (struct riva_par *) info->par; default_par->pdev = pd; info->pixmap.addr =kmalloc (64 *1024 ,GFP_KERNEL );if (info->pixmap.addr ==NULL ) - goto err_out_kfree1; + goto err_out_kfree;memset (info->pixmap.addr,0 ,64 *1024 );if (pci_enable_device (pd)) {
@@ -1896,7 +1892,7 @@ static int __devinit rivafb_probe(structif (default_par->riva.Architecture ==0 ) { printk(KERN_ERR PFX "unknown NV_ARCH\n"); - goto err_out_kfree1; + goto err_out_free_base0; } if(default_par->riva.Architecture == NV_ARCH_10 || default_par->riva.Architecture == NV_ARCH_20 ||
@@ -2001,7 +1997,6 @@ static int __devinit rivafb_probe(structfb_destroy_modedb (info->monspecs.modedb); info->monspecs.modedb_len =0 ; info->monspecs.modedb =NULL ; -if (register_framebuffer (info) <0 ) { printk(KERN_ERR PFX "error registering riva framebuffer\n");
@@ -2040,10 +2035,8 @@ err_out_request:pci_disable_device (pd); err_out_enable:kfree (info->pixmap.addr); -err_out_kfree1: -kfree (default_par); err_out_kfree: -kfree (info); +framebuffer_release (info); err_out:return -ENODEV ; }
@@ -2077,8 +2070,7 @@ static void __exit rivafb_remove(structpci_release_regions (pd);pci_disable_device (pd);kfree (info->pixmap.addr); -kfree (par); -kfree (info); +framebuffer_release (info);pci_set_drvdata (pd,NULL );NVTRACE_LEAVE (); }
drivers/video/sstfb.c +1 -0
@@ -1507,6 +1507,7 @@ static int __devinit sstfb_probe(structfb_alloc_cmap (&info->cmap,256 ,0 );/* register fb */ + info->device = &pdev->dev;if (register_framebuffer (info) <0 ) {eprintk ("can't register framebuffer.\n" ); goto fail;
drivers/video/tgafb.c +1 -0
@@ -1454,6 +1454,7 @@ tgafb_pci_register(struct pci_dev *pdev,tgafb_set_par (&all->info);tgafb_init_fix (&all->info); + all->info.device = &pdev->dev;if (register_framebuffer (&all->info) <0 ) {printk (KERN_ERR "tgafb: Could not register framebuffer\n" ); ret = -EINVAL ;
drivers/video/tridentfb.c +1 -0
@@ -1164,6 +1164,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.device = &dev->dev;if (register_framebuffer (&fb_info) <0 ) {output ("Could not register Trident framebuffer\n" );return -EINVAL ;
include/linux/fb.h +1 -0
@@ -601,6 +601,7 @@ struct fb_info {struct fb_cmap cmap;/* Current cmap */ struct list_head modelist;/* mode list */ struct fb_ops *fbops; +struct device *device;char *screen_base;/* Virtual address */ int currcon;/* Current VC. */ void *pseudo_palette;/* Fake palette of 16 colors */
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php