Skip to contentSkip to conversation

resources: fill in type for __request_region()

PATCH In review Bjorn Helgaas 4 participants 7 messages May 4, 2010 – May 18, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 resources: fill in type for __request_region()

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.

---

 kernel/resource.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
kernel/resource.c +3 -2
index aa63746..f0d83a4 100644
@@ -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);
 
#1 lore raw

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

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.

---

 drivers/video/console/vgacon.c |   30 ++++++------------------------
 1 files changed, 6 insertions(+), 24 deletions(-)
drivers/video/console/vgacon.c +6 -24
index 182dd6f..fca54ec 100644
@@ -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,
-						 &ega_console_resource);
+				request_region(0x3c0, 0x20, "ega");
 			} else {
-				static struct resource vga_console_resource
-				    = { .name = "vga+", .start = 0x3C0, .end = 0x3DF };
 				vga_video_type = VIDEO_TYPE_VGAC;
 				display_desc = "VGA+";
-				request_resource(&ioport_resource,
-						 &vga_console_resource);
+				request_region(0x3c0, 0x20, "vga+");
 
 #ifdef VGA_CAN_DO_64KB
 				/*
@@ -494,13 +479,10 @@ static const char *vgacon_startup(void)
 				}
 			}
 		} else {
-			static struct resource cga_console_resource =
-			    { .name = "cga", .start = 0x3D4, .end = 0x3D5 };
 			vga_video_type = VIDEO_TYPE_CGA;
 			vga_vram_size = 0x2000;
 			display_desc = "*CGA";
-			request_resource(&ioport_resource,
-					 &cga_console_resource);
+			request_region(0x3d4, 0x2, "cga");
 			vga_video_font_height = 8;
 		}
 	}
#2 lore raw

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

Quoted 6 lines · Bjorn Helgaas

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.

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

#3 lore raw

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

Quoted 7 lines · Linus Torvalds
Quoted 5 lines · Bjorn Helgaas

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.

Quoted 8 lines

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.

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

#4 lore raw

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

Quoted 13 lines · Bjorn Helgaas
Quoted 12 lines · Linus Torvalds
Quoted 5 lines · Bjorn Helgaas

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.

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?

Quoted 7 lines
Quoted 3 lines

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.

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.

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

-hpa

#5 lore raw

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

Quoted 19 lines · On Tue, 04 May 2010 13:14:11 -0700 "H. Peter Anvin" <[email protected]> wrote:
Quoted 18 lines · Bjorn Helgaas
Quoted 16 lines · Linus Torvalds
Quoted 5 lines · Bjorn Helgaas

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.

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.

Quoted 5 lines
Quoted 3 lines

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.

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

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

Thanks,
Jesse

#6 lore raw

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

In reply to H. Peter Anvin
Quoted 18 lines · On Tue, 04 May 2010 13:14:11 -0700 "H. Peter Anvin" <[email protected]> wrote:
Quoted 17 lines · Bjorn Helgaas
Quoted 15 lines · Linus Torvalds
Quoted 5 lines · Bjorn Helgaas

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.

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.

Quoted 5 lines
Quoted 3 lines

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.

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

Can you resend this one Bjorn?

Thanks,

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center