linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] igafb: use framebuffer_alloc() to allocate fb_info struct
@ 2009-05-04 16:59 Krzysztof Helt
  2009-05-04 17:51 ` Sam Ravnborg
  0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Helt @ 2009-05-04 16:59 UTC (permalink / raw)
  To: Linux-fbdev-devel; +Cc: Geert Uytterhoeven, Andrew Morton, sparclinux

From: Krzysztof Helt <krzysztof.h1@wp.pl>

Use the framebuffer_alloc() function to allocate the fb_info
structure so the structure is correctly initialized after allocation.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
---

diff -urp linux-orig/drivers/video/igafb.c linux-2.6.30/drivers/video/igafb.c
--- linux-orig/drivers/video/igafb.c	2008-08-09 05:09:03.000000000 +0200
+++ linux-2.6.30/drivers/video/igafb.c	2009-05-04 00:14:28.000000000 +0200
@@ -395,17 +395,16 @@ int __init igafb_init(void)
 	/* We leak a reference here but as it cannot be unloaded this is
 	   fine. If you write unload code remember to free it in unload */
 	
-	size = sizeof(struct fb_info) + sizeof(struct iga_par) + sizeof(u32)*16;
+	size = sizeof(struct iga_par) + sizeof(u32)*16;
 
-        info = kzalloc(size, GFP_ATOMIC);
+	info = framebuffer_alloc(size, &pdev->dev);
         if (!info) {
                 printk("igafb_init: can't alloc fb_info\n");
 		 pci_dev_put(pdev);
                 return -ENOMEM;
         }
 
-	par = (struct iga_par *) (info + 1);
-	
+	par = info->par;
 
 	if ((addr = pdev->resource[0].start) == 0) {
                 printk("igafb_init: no memory start\n");
@@ -526,7 +525,6 @@ 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);

----------------------------------------------------------------------
Szukasz pracy? Sprawd¼ nasze oferty!
http://link.interia.pl/f2142


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] igafb: use framebuffer_alloc() to allocate fb_info struct
  2009-05-04 16:59 [PATCH] igafb: use framebuffer_alloc() to allocate fb_info struct Krzysztof Helt
@ 2009-05-04 17:51 ` Sam Ravnborg
  0 siblings, 0 replies; 2+ messages in thread
From: Sam Ravnborg @ 2009-05-04 17:51 UTC (permalink / raw)
  To: Krzysztof Helt
  Cc: Linux-fbdev-devel, Geert Uytterhoeven, Andrew Morton, sparclinux

Hi Krzysztof.
> diff -urp linux-orig/drivers/video/igafb.c linux-2.6.30/drivers/video/igafb.c
> --- linux-orig/drivers/video/igafb.c	2008-08-09 05:09:03.000000000 +0200
> +++ linux-2.6.30/drivers/video/igafb.c	2009-05-04 00:14:28.000000000 +0200
> @@ -395,17 +395,16 @@ int __init igafb_init(void)
>  	/* We leak a reference here but as it cannot be unloaded this is
>  	   fine. If you write unload code remember to free it in unload */
>  	
> -	size = sizeof(struct fb_info) + sizeof(struct iga_par) + sizeof(u32)*16;
> +	size = sizeof(struct iga_par) + sizeof(u32)*16;
>  
> -        info = kzalloc(size, GFP_ATOMIC);
> +	info = framebuffer_alloc(size, &pdev->dev);

While you are toucing this file it would be nice
with a follow-up patch that tabbified all of the file.
Today it looks like a mixture of tab and space used for indent.

checking the original file...
OK - it looks like the original file consistently used
space for indent and only fixes uses tabs.

	Sam

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-05-04 17:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-04 16:59 [PATCH] igafb: use framebuffer_alloc() to allocate fb_info struct Krzysztof Helt
2009-05-04 17:51 ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).