Skip to contentSkip to conversation

PnP BIOS #5

PATCH New Thomas Hood 1 participant 1 message Oct 22, 2001 Pnp support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PnP BIOS #5

Here is a new version of the patch in which I have reverted a number of the function name changes. If you're building a new kernel with PnP BIOS support, please test this and
report back. // Thomas Hood

Summary of changes in this patch:
1) Fix bugs in resource reservation:
- didn't reserve all io resources
- end of resource range recorded in devlist off by 1
2) Change code so that set_dev_node updates the devlist, so drivers loaded after a setpnp will get up-to-date resource information. Because I haven't protected devlist update code with locks, this feature isn't SMP safe yet. I'd like some advice about how to do the locking. If you're worried, don't use setpnp.
3) Miscellaneous code cleanups. Improve printk output. Etc.
4) Don't EXPORT_SYMBOL lowlevel PnP BIOS access functions since they aren't used by anything except the proc routines which don't need them to be EXPORT_SYMBOL to link to them.
5) Declare announce_device in header (since it is EXPORT_SYMBOL in pnp_bios.c, presumably for a reason).

The patch:

init/main.c +1 -1
@@ -822,7 +822,7 @@
 	isapnp_init();
 #endif
 #ifdef CONFIG_PNPBIOS
-        pnp_bios_init();
+        pnpbios_init();
 #endif
 
 #ifdef CONFIG_TC
include/linux/pnp_bios.h +27 -20

82 lines not on this page · raw message

drivers/pnp/pnp_bios.c +265 -181

748 lines not on this page · raw message

drivers/pnp/pnp_proc.c +13 -13
@@ -31,7 +31,7 @@
 	    *eof = 1;
 	    return 0;
 	}
-	node = kmalloc(node_info.max_node_size, GFP_KERNEL);
+	node = pnpbios_kmalloc(node_info.max_node_size, GFP_KERNEL);
 	if (!node) return -ENOMEM;
 	for (i=0,nodenum=0;i<0xff && nodenum!=0xff; i++) {
 		if ( pnp_bios_get_dev_node(&nodenum, 1, node) )
@@ -57,7 +57,7 @@
 	    *eof = 1;
 	    return 0;
 	}
-	node = kmalloc(node_info.max_node_size, GFP_KERNEL);
+	node = pnpbios_kmalloc(node_info.max_node_size, GFP_KERNEL);
 	if (!node) return -ENOMEM;
 	if ( pnp_bios_get_dev_node(&nodenum, boot, node) )
 		return -EIO;
@@ -74,7 +74,7 @@
 	int boot = (long)data >> 8;
 	u8 nodenum = (long)data;
 
-	node = kmalloc(node_info.max_node_size, GFP_KERNEL);
+	node = pnpbios_kmalloc(node_info.max_node_size, GFP_KERNEL);
 	if (!node) return -ENOMEM;
 	if ( pnp_bios_get_dev_node(&nodenum, boot, node) )
 		return -EIO;
@@ -87,9 +87,12 @@
 	return count;
 }
 
-static int pnp_proc_dont_use_current_config;
-
-void pnp_proc_init( int dont_use_current )
+/*
+ * When this is called, pnpbios functions are assumed to
+ * work and the pnpbios_dont_use_current_config flag
+ * should already have been set to the appropriate value
+ */
+void pnpbios_proc_init( void )
 {
 	struct pnp_bios_node *node;
 	struct proc_dir_entry *ent;
@@ -97,9 +100,6 @@
 	int i;
 	u8 nodenum;
 
-	pnp_proc_dont_use_current_config = dont_use_current;
-
-	if (!pnp_bios_present()) return;
 	if (pnp_bios_dev_node_info(&node_info) != 0) return;
 	
 	proc_pnp = proc_mkdir("pnp", proc_bus);
@@ -108,13 +108,13 @@
 	if (!proc_pnp_boot) return;
 	create_proc_read_entry("devices", 0, proc_pnp, proc_read_devices, NULL);
 	
-	node = kmalloc(node_info.max_node_size, GFP_KERNEL);
+	node = pnpbios_kmalloc(node_info.max_node_size, GFP_KERNEL);
 	if (!node) return;
 	for (i=0,nodenum = 0; i<0xff && nodenum != 0xff; i++) {
 		if (pnp_bios_get_dev_node(&nodenum, 1, node) != 0)
 			break;
 		sprintf(name, "%02x", node->handle);
-		if ( !pnp_proc_dont_use_current_config ) {
+		if ( !pnpbios_dont_use_current_config ) {
 			ent = create_proc_entry(name, 0, proc_pnp);
 			if (ent) {
 				ent->read_proc = proc_read_node;
@@ -132,7 +132,7 @@
 	kfree(node);
 }
 
-void pnp_proc_done(void)
+void pnpbios_proc_done(void)
 {
 	int i;
 	char name[3];
@@ -141,7 +141,7 @@
 
 	for (i=0; i<0xff; i++) {
 		sprintf(name, "%02x", i);
-		if ( !pnp_proc_dont_use_current_config )
+		if ( !pnpbios_dont_use_current_config )
 			remove_proc_entry(name, proc_pnp);
 		remove_proc_entry(name, proc_pnp_boot);
 	}