[patch 05/37] ISAPNP: pull pnp_add_id() out of isapnp_parse_id()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Split the pnp_add_id() part from the PNPID conversion part so we
can move the initial add_id() into the pnp_dev allocation.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@xxxxxx>

Index: work7/drivers/pnp/isapnp/core.c
===================================================================
--- work7.orig/drivers/pnp/isapnp/core.c	2008-03-21 15:31:25.000000000 -0600
+++ work7/drivers/pnp/isapnp/core.c	2008-03-21 15:32:15.000000000 -0600
@@ -400,11 +400,9 @@
 /*
  *  Parse EISA id.
  */
-static void isapnp_parse_id(struct pnp_dev *dev, unsigned short vendor,
-			    unsigned short device)
+static void isapnp_to_pnpid(unsigned short vendor, unsigned short device,
+			    char *id)
 {
-	char id[8];
-
 	id[0] = 'A' + ((vendor >> 2) & 0x3f) - 1;
 	id[1] = 'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1;
 	id[2] = 'A' + ((vendor >> 8) & 0x1f) - 1;
@@ -413,8 +411,6 @@
 	id[5] = '0' + ((device >> 12) & 0x0f);
 	id[6] = '0' + ((device >> 8) & 0x0f);
 	id[7] = '\0';
-
-	pnp_add_id(dev, id);
 }
 
 /*
@@ -424,6 +420,7 @@
 						  int size, int number)
 {
 	unsigned char tmp[6];
+	char id[8];
 	struct pnp_dev *dev;
 
 	isapnp_peek(tmp, size);
@@ -431,7 +428,8 @@
 	if (!dev)
 		return NULL;
 	dev->number = number;
-	isapnp_parse_id(dev, (tmp[1] << 8) | tmp[0], (tmp[3] << 8) | tmp[2]);
+	isapnp_to_pnpid((tmp[1] << 8) | tmp[0], (tmp[3] << 8) | tmp[2], id);
+	pnp_add_id(dev, id);
 	dev->regs = tmp[4];
 	dev->card = card;
 	if (size > 5)
@@ -621,6 +619,7 @@
 	unsigned char type, tmp[17];
 	struct pnp_option *option;
 	struct pnp_dev *dev;
+	char id[8];
 
 	if ((dev = isapnp_parse_device(card, size, number++)) == NULL)
 		return 1;
@@ -660,8 +659,9 @@
 		case _STAG_COMPATDEVID:
 			if (size == 4 && compat < DEVICE_COUNT_COMPATIBLE) {
 				isapnp_peek(tmp, 4);
-				isapnp_parse_id(dev, (tmp[1] << 8) | tmp[0],
-						(tmp[3] << 8) | tmp[2]);
+				isapnp_to_pnpid((tmp[1] << 8) | tmp[0],
+						(tmp[3] << 8) | tmp[2], id);
+				pnp_add_id(dev, id);
 				compat++;
 				size = 0;
 			}

-- 
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux