linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 06/17] platinumfb: Fix resource management
@ 2007-09-29  1:29 Antonino A. Daplas
  2007-09-29  9:16 ` Geert Uytterhoeven
  2007-10-03 20:56 ` Andrew Morton
  0 siblings, 2 replies; 7+ messages in thread
From: Antonino A. Daplas @ 2007-09-29  1:29 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Benjamin Herrenschmidt, Linux Fbdev development list

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Current kernels have a non-working platinumfb due to some resource
management issues. This fixes it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Antonino Daplas <adaplas@gmail.com>
---

 drivers/video/platinumfb.c |   48 ++++++++++++++++++++++++--------------------
 1 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c
index 8503e73..cbe71a5 100644
--- a/drivers/video/platinumfb.c
+++ b/drivers/video/platinumfb.c
@@ -17,6 +17,8 @@
  *  more details.
  */
 
+#undef DEBUG
+
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -535,33 +537,35 @@ static int __devinit platinumfb_probe(st
 	volatile __u8		*fbuffer;
 	int			bank0, bank1, bank2, bank3, rc;
 
-	printk(KERN_INFO "platinumfb: Found Apple Platinum video hardware\n");
+	dev_info(&odev->dev, "Found Apple Platinum video hardware\n");
 
 	info = framebuffer_alloc(sizeof(*pinfo), &odev->dev);
-	if (info == NULL)
+	if (info == NULL) {
+		dev_err(&odev->dev, "Failed to allocate fbdev !\n");
 		return -ENOMEM;
+	}
 	pinfo = info->par;
 
 	if (of_address_to_resource(dp, 0, &pinfo->rsrc_reg) ||
 	    of_address_to_resource(dp, 1, &pinfo->rsrc_fb)) {
-		printk(KERN_ERR "platinumfb: Can't get resources\n");
-		framebuffer_release(info);
-		return -ENXIO;
-	}
-	if (!request_mem_region(pinfo->rsrc_reg.start,
-				pinfo->rsrc_reg.start -
-				pinfo->rsrc_reg.end + 1,
-				"platinumfb registers")) {
+		dev_err(&odev->dev, "Can't get resources\n");
 		framebuffer_release(info);
 		return -ENXIO;
 	}
+	dev_dbg(&odev->dev, " registers  : 0x%llx...0x%llx\n",
+		(unsigned long long)pinfo->rsrc_reg.start,
+		(unsigned long long)pinfo->rsrc_reg.end);
+	dev_dbg(&odev->dev, " framebuffer: 0x%llx...0x%llx\n",
+		(unsigned long long)pinfo->rsrc_fb.start,
+		(unsigned long long)pinfo->rsrc_fb.end);
+
+	/* Do not try to request register space, they overlap with the
+	 * northbridge and that can fail. Only request framebuffer
+	 */
 	if (!request_mem_region(pinfo->rsrc_fb.start,
-				pinfo->rsrc_fb.start
-				- pinfo->rsrc_fb.end + 1,
+				pinfo->rsrc_fb.end - pinfo->rsrc_fb.start + 1,
 				"platinumfb framebuffer")) {
-		release_mem_region(pinfo->rsrc_reg.start,
-				   pinfo->rsrc_reg.end -
-				   pinfo->rsrc_reg.start + 1);
+		printk(KERN_ERR "platinumfb: Can't request framebuffer !\n");
 		framebuffer_release(info);
 		return -ENXIO;
 	}
@@ -600,7 +604,8 @@ static int __devinit platinumfb_probe(st
 	bank2 = fbuffer[0x200000] == 0x56;
 	bank3 = fbuffer[0x300000] == 0x78;
 	pinfo->total_vram = (bank0 + bank1 + bank2 + bank3) * 0x100000;
-	printk(KERN_INFO "platinumfb: Total VRAM = %dMB (%d%d%d%d)\n", (int) (pinfo->total_vram / 1024 / 1024),
+	printk(KERN_INFO "platinumfb: Total VRAM = %dMB (%d%d%d%d)\n",
+	       (unsigned int) (pinfo->total_vram / 1024 / 1024),
 	       bank3, bank2, bank1, bank0);
 
 	/*
@@ -644,16 +649,15 @@ static int __devexit platinumfb_remove(s
         unregister_framebuffer (info);
 	
 	/* Unmap frame buffer and registers */
+	iounmap(pinfo->frame_buffer);
+	iounmap(pinfo->platinum_regs);
+	iounmap(pinfo->cmap_regs);
+
 	release_mem_region(pinfo->rsrc_fb.start,
 			   pinfo->rsrc_fb.end -
 			   pinfo->rsrc_fb.start + 1);
-	release_mem_region(pinfo->rsrc_reg.start,
-			   pinfo->rsrc_reg.end -
-			   pinfo->rsrc_reg.start + 1);
-	iounmap(pinfo->frame_buffer);
-	iounmap(pinfo->platinum_regs);
+
 	release_mem_region(pinfo->cmap_regs_phys, 0x1000);
-	iounmap(pinfo->cmap_regs);
 
 	framebuffer_release(info);
 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

* Re: [PATCH 06/17] platinumfb: Fix resource management
  2007-09-29  1:29 [PATCH 06/17] platinumfb: Fix resource management Antonino A. Daplas
@ 2007-09-29  9:16 ` Geert Uytterhoeven
  2007-09-29 21:53   ` Benjamin Herrenschmidt
  2007-10-03 20:56 ` Andrew Morton
  1 sibling, 1 reply; 7+ messages in thread
From: Geert Uytterhoeven @ 2007-09-29  9:16 UTC (permalink / raw)
  To: Linux Fbdev development list
  Cc: Andrew Morton, Benjamin Herrenschmidt, Andy Whitcroft

On Sat, 29 Sep 2007, Antonino A. Daplas wrote:
> From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> 
> Current kernels have a non-working platinumfb due to some resource
> management issues. This fixes it.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Antonino Daplas <adaplas@gmail.com>
> ---
> 
>  drivers/video/platinumfb.c |   48 ++++++++++++++++++++++++--------------------
>  1 files changed, 26 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c
> index 8503e73..cbe71a5 100644
> --- a/drivers/video/platinumfb.c
> +++ b/drivers/video/platinumfb.c
> @@ -17,6 +17,8 @@
>   *  more details.
>   */
>  
> +#undef DEBUG
> +
>  #include <linux/module.h>
>  #include <linux/kernel.h>
>  #include <linux/errno.h>

Probably scripts/checkpatch.pl should be taught to complain about
`#undef DEBUG'.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

* Re: [PATCH 06/17] platinumfb: Fix resource management
  2007-09-29  9:16 ` Geert Uytterhoeven
@ 2007-09-29 21:53   ` Benjamin Herrenschmidt
  2007-09-30  7:11     ` Geert Uytterhoeven
  0 siblings, 1 reply; 7+ messages in thread
From: Benjamin Herrenschmidt @ 2007-09-29 21:53 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Andrew Morton, Linux Fbdev development list, Andy Whitcroft


> Probably scripts/checkpatch.pl should be taught to complain about
> `#undef DEBUG'.

Why ? Whenever I have things that are #ifdef DEBUG in the file (such as
dev_dbg statements), I always leave a #undef DEBUG statement at the top.

That way, I know I can enable debug in that file by flicking it.

Ben.



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

* Re: [PATCH 06/17] platinumfb: Fix resource management
  2007-09-29 21:53   ` Benjamin Herrenschmidt
@ 2007-09-30  7:11     ` Geert Uytterhoeven
  2007-09-30  8:03       ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 7+ messages in thread
From: Geert Uytterhoeven @ 2007-09-30  7:11 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Andrew Morton, Linux Fbdev development list, Andy Whitcroft

On Sun, 30 Sep 2007, Benjamin Herrenschmidt wrote:
> > Probably scripts/checkpatch.pl should be taught to complain about
> > `#undef DEBUG'.
> 
> Why ? Whenever I have things that are #ifdef DEBUG in the file (such as
> dev_dbg statements), I always leave a #undef DEBUG statement at the top.

Because it overrides a -DDEBUG on the build command line.

> That way, I know I can enable debug in that file by flicking it.

Just add #define DEBUG at the top?

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

* Re: [PATCH 06/17] platinumfb: Fix resource management
  2007-09-30  7:11     ` Geert Uytterhoeven
@ 2007-09-30  8:03       ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 7+ messages in thread
From: Benjamin Herrenschmidt @ 2007-09-30  8:03 UTC (permalink / raw)
  To: linux-fbdev-devel; +Cc: Andrew Morton, Andy Whitcroft


On Sun, 2007-09-30 at 09:11 +0200, Geert Uytterhoeven wrote:
> On Sun, 30 Sep 2007, Benjamin Herrenschmidt wrote:
> > > Probably scripts/checkpatch.pl should be taught to complain about
> > > `#undef DEBUG'.
> > 
> > Why ? Whenever I have things that are #ifdef DEBUG in the file (such as
> > dev_dbg statements), I always leave a #undef DEBUG statement at the top.
> 
> Because it overrides a -DDEBUG on the build command line.

Hrm... ok, I never play with the commandline :-)

> > That way, I know I can enable debug in that file by flicking it.
> 
> Just add #define DEBUG at the top?

Yeah well, it's really just a reminder that there's DEBUG stuff in that
file, but feel free to send a patch removing it :-)

Ben.



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

* Re: [PATCH 06/17] platinumfb: Fix resource management
  2007-09-29  1:29 [PATCH 06/17] platinumfb: Fix resource management Antonino A. Daplas
  2007-09-29  9:16 ` Geert Uytterhoeven
@ 2007-10-03 20:56 ` Andrew Morton
  2007-10-03 21:29   ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2007-10-03 20:56 UTC (permalink / raw)
  To: Antonino A. Daplas; +Cc: benh, linux-fbdev-devel

On Sat, 29 Sep 2007 09:29:53 +0800
"Antonino A. Daplas" <adaplas@gmail.com> wrote:

> Current kernels have a non-working platinumfb due to some resource
> management issues. This fixes it.

Why isn't this 2.6.23 material?

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

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

* Re: [PATCH 06/17] platinumfb: Fix resource management
  2007-10-03 20:56 ` Andrew Morton
@ 2007-10-03 21:29   ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 7+ messages in thread
From: Benjamin Herrenschmidt @ 2007-10-03 21:29 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-fbdev-devel, Antonino A. Daplas


On Wed, 2007-10-03 at 13:56 -0700, Andrew Morton wrote:
> On Sat, 29 Sep 2007 09:29:53 +0800
> "Antonino A. Daplas" <adaplas@gmail.com> wrote:
> 
> > Current kernels have a non-working platinumfb due to some resource
> > management issues. This fixes it.
> 
> Why isn't this 2.6.23 material?

We decided it's been broken long enough and nobody complained so it
wasn't worth pushing. I wouldn't be surprised if there weren't more than
a handful of people left with a PowerMac 7200 which is I think the only
machine using platinumfb.

Feel free to send it to Linus for .23 if you feel like it though.

Cheers,
Ben.



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

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

end of thread, other threads:[~2007-10-03 21:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-29  1:29 [PATCH 06/17] platinumfb: Fix resource management Antonino A. Daplas
2007-09-29  9:16 ` Geert Uytterhoeven
2007-09-29 21:53   ` Benjamin Herrenschmidt
2007-09-30  7:11     ` Geert Uytterhoeven
2007-09-30  8:03       ` Benjamin Herrenschmidt
2007-10-03 20:56 ` Andrew Morton
2007-10-03 21:29   ` Benjamin Herrenschmidt

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).