PnP BIOS patch #4
(I guess I'll start numbering these patch versions so we can tell them apart.)
Here's another version of the PnP BIOS patch with a few aesthetic improvements, no functional changes. I'll wait for some version of this patch to get into an -ac release before making any more big changes.
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 +34 -27
93 lines not on this page · raw message
drivers/pnp/pnp_bios.c +287 -200
851 lines not on this page · raw message
drivers/pnp/pnp_proc.c +19 -19
@@ -31,10 +31,10 @@ *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) ) +if (pnpbios_get_dev_node (&nodenum,1 , node) )break ; p += sprintf(p, "%02x\t%08x\t%02x:%02x:%02x\t%04x\n", node->handle, node->eisa_id,
@@ -57,9 +57,9 @@ *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) ) +if (pnpbios_get_dev_node (&nodenum, boot, node) )return -EIO ; len = node->size -sizeof (struct pnp_bios_node );memcpy (buf, node->data, len);
@@ -74,22 +74,25 @@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) ) +if (pnpbios_get_dev_node (&nodenum, boot, node) )return -EIO ;if (count != node->size -sizeof (struct pnp_bios_node ))return -EINVAL ;memcpy (node->data, buf, count); -if (pnp_bios_set_dev_node (node->handle, boot, node) !=0 ) +if (pnpbios_set_dev_node (node->handle, boot, node) !=0 )return -EINVAL ;kfree (node);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,10 +100,7 @@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 ; +if (pnpbios_dev_node_info (&node_info) !=0 )return ; proc_pnp =proc_mkdir ("pnp" , proc_bus);if (!proc_pnp)return ;
@@ -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 ) +if (pnpbios_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); }