public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: pazke@orbita1.ru
To: linux-kernel@vger.kernel.org
Subject: [PATCH] PnP BIOS: bugfixes
Date: Tue, 17 Jul 2001 13:32:08 +0400	[thread overview]
Message-ID: <20010717133208.A28013@orbita1.ru> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 654 bytes --]


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.asc

[-- Attachment #1.2: patch-pnpBIOS --]
[-- Type: text/plain, Size: 1778 bytes --]

diff -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");
 }
 
 

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

                 reply	other threads:[~2001-07-17  9:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010717133208.A28013@orbita1.ru \
    --to=pazke@orbita1.ru \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox