Re: [PATCH 2/2] vgacon: use request_region(), not request_resource(), to set BUSY

Previous thread: How to write marker info in MMIO trace from kernel by Larry Finger on Tuesday, May 4, 2010 - 11:36 am. (5 messages)

Next thread: [PATCH] mtd: map.h: add missing bug.h include by Kevin Cernekee on Tuesday, May 4, 2010 - 12:51 pm. (1 message)
From: Bjorn Helgaas
Date: Tuesday, May 4, 2010 - 11:58 am

Set the IORESOURCE_TYPE based on the parent.  Without this, the type is
never set, which is slightly confusing if we ever print the resource later.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
---

 kernel/resource.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/kernel/resource.c b/kernel/resource.c
index aa63746..f0d83a4 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -699,8 +699,9 @@ struct resource * __request_region(struct resource *parent,
 	res->name = name;
 	res->start = start;
 	res->end = start + n - 1;
-	res->flags = IORESOURCE_BUSY;
-	res->flags |= flags;
+	res->flags = parent->flags & IORESOURCE_TYPE_BITS;
+	res->flags |= (flags & ~IORESOURCE_TYPE_BITS);
+	res->flags |= IORESOURCE_BUSY;
 
 	write_lock(&resource_lock);
 

--

From: Bjorn Helgaas
Date: Tuesday, May 4, 2010 - 11:58 am

Drivers normally use request_region() to mark the region busy so it won't
be used by anybody else.  Previously, we used request_resource(), which
doesn't mark the VGA regions busy.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
---

 drivers/video/console/vgacon.c |   30 ++++++------------------------
 1 files changed, 6 insertions(+), 24 deletions(-)


diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 182dd6f..fca54ec 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -410,25 +410,16 @@ static const char *vgacon_startup(void)
 		vga_video_port_reg = VGA_CRT_IM;
 		vga_video_port_val = VGA_CRT_DM;
 		if ((screen_info.orig_video_ega_bx & 0xff) != 0x10) {
-			static struct resource ega_console_resource =
-			    { .name = "ega", .start = 0x3B0, .end = 0x3BF };
 			vga_video_type = VIDEO_TYPE_EGAM;
 			vga_vram_size = 0x8000;
 			display_desc = "EGA+";
-			request_resource(&ioport_resource,
-					 &ega_console_resource);
+			request_region(0x3b0, 0x10, "ega");
 		} else {
-			static struct resource mda1_console_resource =
-			    { .name = "mda", .start = 0x3B0, .end = 0x3BB };
-			static struct resource mda2_console_resource =
-			    { .name = "mda", .start = 0x3BF, .end = 0x3BF };
 			vga_video_type = VIDEO_TYPE_MDA;
 			vga_vram_size = 0x2000;
 			display_desc = "*MDA";
-			request_resource(&ioport_resource,
-					 &mda1_console_resource);
-			request_resource(&ioport_resource,
-					 &mda2_console_resource);
+			request_region(0x3b0, 0xc, "mda");
+			request_region(0x3bf, 0x1, "mda");
 			vga_video_font_height = 14;
 		}
 	} else {
@@ -443,19 +434,13 @@ static const char *vgacon_startup(void)
 			vga_vram_size = 0x8000;
 
 			if (!screen_info.orig_video_isVGA) {
-				static struct resource ega_console_resource
-				    = { .name = "ega", .start = 0x3C0, .end = 0x3DF };
 				vga_video_type = VIDEO_TYPE_EGAC;
 				display_desc = "EGA";
-				request_resource(&ioport_resource,
-						 ...
From: Linus Torvalds
Date: Tuesday, May 4, 2010 - 12:09 pm

Hmm. I don't object, but unless there is some crazy regression, there's no 
way I will take something like this outside the merge window. Who knows 
what odd frame buffer driver is out there that just depended on the fact 
that it could also register that VGA area?

Probably no such thing exists, but it's why I want these kinds of things 
during the merge window. And obviously preferably through something like 
the PCI merge tree, but that's a different issue.

		Linus
--

From: Bjorn Helgaas
Date: Tuesday, May 4, 2010 - 12:16 pm

Yep, I was intending for after .34.  I couldn't figure out where
to send it, but I'll be happy to send it to Jesse.

Bjorn
--

From: H. Peter Anvin
Date: Tuesday, May 4, 2010 - 1:14 pm

I would vote for Jesse's tree.  If Jesse doesn't want it I'll take it.

	-hpa

--

From: Jesse Barnes
Date: Tuesday, May 4, 2010 - 1:51 pm

On Tue, 04 May 2010 13:14:11 -0700

I'm happy to stuff it in my -next tree.  Bjorn can you resend?

Thanks,
Jesse
--

From: Jesse Barnes
Date: Tuesday, May 18, 2010 - 2:41 pm

On Tue, 04 May 2010 13:14:11 -0700

Can you resend this one Bjorn?

Thanks,
-- 
Jesse Barnes, Intel Open Source Technology Center
--

Previous thread: How to write marker info in MMIO trace from kernel by Larry Finger on Tuesday, May 4, 2010 - 11:36 am. (5 messages)

Next thread: [PATCH] mtd: map.h: add missing bug.h include by Kevin Cernekee on Tuesday, May 4, 2010 - 12:51 pm. (1 message)