[PATCH] Re: New kernel/resource.c

Niels Kristian Bech Jensen (nkbj@image.dk)
Sat, 10 Jul 1999 14:36:07 +0200 (CEST)


On Sat, 10 Jul 1999, Linus Torvalds wrote:

[...]
> The old "request_region()" thing still works, but not until after the
> memory allocator has been initialized (because it uses kmalloc()). So
> stuff that does resource allocation early during boot has to actually use
> "struct resource" directly - normal device drivers can just ignore the
> change.
>
One such place is vgacon, which uses request_region() in vgacon_startup().
This gave me the warning "kmem_alloc: NULL ptr (name=unknown)" in the
dmesg output. This patch fixes that problem by changing
drivers/video/vgacon.c to use the new resource management stuff:

diff -urN pre-patch-2.3.11-1/drivers/video/vgacon.c linux/drivers/video/vgacon.c
--- pre-patch-2.3.11-1/drivers/video/vgacon.c Sun Jul 4 14:10:53 1999
+++ linux/drivers/video/vgacon.c Sat Jul 10 13:14:33 1999
@@ -186,18 +186,21 @@
vga_video_port_val = 0x3b5;
if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10)
{
+ static struct resource ega_console_resource = { "ega", 0x3B0, 0x3BF };
vga_video_type = VIDEO_TYPE_EGAM;
vga_vram_end = 0xb8000;
display_desc = "EGA+";
- request_region(0x3b0,16,"ega");
+ request_resource(&pci_io_resource, &ega_console_resource);
}
else
{
+ static struct resource mda1_console_resource = { "mda", 0x3B0, 0x3BB };
+ static struct resource mda2_console_resource = { "mda", 0x3BF, 0x3BF };
vga_video_type = VIDEO_TYPE_MDA;
vga_vram_end = 0xb2000;
display_desc = "*MDA";
- request_region(0x3b0,12,"mda");
- request_region(0x3bf, 1,"mda");
+ request_resource(&pci_io_resource, &mda1_console_resource);
+ request_resource(&pci_io_resource, &mda2_console_resource);
vga_video_font_height = 14;
}
}
@@ -214,13 +217,15 @@
vga_vram_end = 0xc0000;

if (!ORIG_VIDEO_ISVGA) {
+ static struct resource ega_console_resource = { "ega", 0x3C0, 0x3DF };
vga_video_type = VIDEO_TYPE_EGAC;
display_desc = "EGA";
- request_region(0x3c0,32,"ega");
+ request_resource(&pci_io_resource, &ega_console_resource);
} else {
+ static struct resource vga_console_resource = { "vga+", 0x3C0, 0x3DF };
vga_video_type = VIDEO_TYPE_VGAC;
display_desc = "VGA+";
- request_region(0x3c0,32,"vga+");
+ request_resource(&pci_io_resource, &vga_console_resource);

#ifdef VGA_CAN_DO_64KB
/*
@@ -261,10 +266,11 @@
}
else
{
+ static struct resource cga_console_resource = { "cga", 0x3D4, 0x3D5 };
vga_video_type = VIDEO_TYPE_CGA;
vga_vram_end = 0xba000;
display_desc = "*CGA";
- request_region(0x3d4,2,"cga");
+ request_resource(&pci_io_resource, &cga_console_resource);
vga_video_font_height = 8;
}
}

-- 
Niels Kristian Bech Jensen -- nkbj@image.dk -- http://www.image.dk/~nkbj/

----------->> Stop software piracy --- use free software! <<-----------

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/