lkml.org 
[lkml]   [2001]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH] PnP BIOS: bugfixes
From

Hi all,

this patch (2.4.6-ac5) fixed two significant bugs in PnP BIOS enumeration code:
- pnpbios_build_devlist() doesn't check pnp_bios_get_dev_node() return code
and always builds device list with approximately 250 bogus entries;
- pnpid32_to_pnpid() function generates bogus strings instead of PNPxxxx.

Patch tested on my machine using parport_pc module.

BTW why pnpid32_to_pnpid() builds device ID using lovercase chars like PNP0c01,
may be PNP0C01 will be better ?

Best regards.

--
Andrey Panin | Embedded systems software engineer
pazke@orbita1.ru | PGP key: http://www.orbita1.ru/~pazke/AndreyPanin.ascdiff -urN -X /usr/dontdiff /linux.vanilla/drivers/pnp/pnp_bios.c /linux/drivers/pnp/pnp_bios.c
--- /linux.vanilla/drivers/pnp/pnp_bios.c Tue Jul 17 23:11:14 2001
+++ /linux/drivers/pnp/pnp_bios.c Tue Jul 17 23:40:26 2001
@@ -695,16 +695,16 @@
const char *hex = "0123456789abcdef";
static char str[8];
id = cpu_to_le32(id);
- str[0] = CHAR(id, 26);
- str[1] = CHAR(id, 21);
- str[2] = CHAR(id,16);
- str[3] = HEX(id, 12);
- str[4] = HEX(id, 8);
- str[5] = HEX(id, 4);
- str[6] = HEX(id, 0);
+ str[0] = CHAR(id, 2);
+ str[1] = CHAR((((id & 3) << 3) | ((id >> 13) & 7)), 0);
+ str[2] = CHAR(id, 8);
+ str[3] = HEX(id, 20);
+ str[4] = HEX(id, 16);
+ str[5] = HEX(id, 28);
+ str[6] = HEX(id, 24);
str[7] = '\0';
return str;
-}
+}

#undef CHAR
#undef HEX
@@ -728,7 +728,7 @@

static void __init pnpbios_build_devlist(void)
{
- int i;
+ int i, devs = 0;
struct pnp_bios_node *node;
struct pnp_dev_node_info node_info;
struct pci_dev *dev;
@@ -746,13 +746,15 @@
if (!node)
return;

- for(i=0;i<0xff;i++)
- {
+ for(i=0;i<0xff;i++) {
dev = kmalloc(sizeof (struct pci_dev), GFP_KERNEL);
if (!dev)
break;

- pnp_bios_get_dev_node((u8 *)&num, (char )0 , node);
+ if (pnp_bios_get_dev_node((u8 *)&num, (char )0 , node))
+ continue;
+
+ devs++;
pnpbios_rawdata_2_pci_dev(node,dev);
dev->devfn=num;
pnpid = pnpid32_to_pnpid(node->eisa_id);
@@ -762,6 +764,11 @@
kfree(dev);
}
kfree(node);
+
+ if (devs)
+ printk(KERN_INFO "PnP: %i device%s detected total\n", devs, devs > 1 ? "s" : "");
+ else
+ printk(KERN_INFO "PnP: No devices found\n");
}

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 12:57    [W:0.199 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site