aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/pnpbios
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 18:33:53 -0400
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:16 -0400
commit25eb846189d20db4114cebf14fee96d69bef4667 (patch)
treebca11a6cc777f4ee121b1c04aa9e86075ae04a3e /drivers/pnp/pnpbios
parent772defc6292bae8b6db298476d1dabd22a99492b (diff)
PNP: add pnp_eisa_id_to_string()
Converting the EISA ID to a string is messy and error-prone, and we might as well use the same code for ISAPNP and PNPBIOS. PNPACPI uses the conversion done by the ACPI core with acpi_ex_eisa_id_to_string(). Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Acked-By: Rene Herman <rene.herman@gmail.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp/pnpbios')
-rw-r--r--drivers/pnp/pnpbios/core.c2
-rw-r--r--drivers/pnp/pnpbios/rsparser.c26
2 files changed, 4 insertions, 24 deletions
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index 2d592aea0aa7..3ee5ed437385 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -332,7 +332,7 @@ static int __init insert_device(struct pnp_bios_node *node)
332 if (!dev) 332 if (!dev)
333 return -1; 333 return -1;
334 334
335 pnpid32_to_pnpid(node->eisa_id, id); 335 pnp_eisa_id_to_string(node->eisa_id & PNP_EISA_ID_MASK, id);
336 dev_id = pnp_add_id(dev, id); 336 dev_id = pnp_add_id(dev, id);
337 if (!dev_id) { 337 if (!dev_id) {
338 kfree(dev); 338 kfree(dev);
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c
index dbc88412c12e..948a661280d7 100644
--- a/drivers/pnp/pnpbios/rsparser.c
+++ b/drivers/pnp/pnpbios/rsparser.c
@@ -494,32 +494,12 @@ len_err:
494 * Compatible Device IDs 494 * Compatible Device IDs
495 */ 495 */
496 496
497#define HEX(id,a) hex[((id)>>a) & 15]
498#define CHAR(id,a) (0x40 + (((id)>>a) & 31))
499
500void pnpid32_to_pnpid(u32 id, char *str)
501{
502 const char *hex = "0123456789abcdef";
503
504 id = be32_to_cpu(id);
505 str[0] = CHAR(id, 26);
506 str[1] = CHAR(id, 21);
507 str[2] = CHAR(id, 16);
508 str[3] = HEX(id, 12);
509 str[4] = HEX(id, 8);
510 str[5] = HEX(id, 4);
511 str[6] = HEX(id, 0);
512 str[7] = '\0';
513}
514
515#undef CHAR
516#undef HEX
517
518static unsigned char *pnpbios_parse_compatible_ids(unsigned char *p, 497static unsigned char *pnpbios_parse_compatible_ids(unsigned char *p,
519 unsigned char *end, 498 unsigned char *end,
520 struct pnp_dev *dev) 499 struct pnp_dev *dev)
521{ 500{
522 int len, tag; 501 int len, tag;
502 u32 eisa_id;
523 char id[8]; 503 char id[8];
524 struct pnp_id *dev_id; 504 struct pnp_id *dev_id;
525 505
@@ -549,8 +529,8 @@ static unsigned char *pnpbios_parse_compatible_ids(unsigned char *p,
549 case SMALL_TAG_COMPATDEVID: /* compatible ID */ 529 case SMALL_TAG_COMPATDEVID: /* compatible ID */
550 if (len != 4) 530 if (len != 4)
551 goto len_err; 531 goto len_err;
552 pnpid32_to_pnpid(p[1] | p[2] << 8 | p[3] << 16 | p[4] << 532 eisa_id = p[1] | p[2] << 8 | p[3] << 16 | p[4] << 24;
553 24, id); 533 pnp_eisa_id_to_string(eisa_id & PNP_EISA_ID_MASK, id);
554 dev_id = pnp_add_id(dev, id); 534 dev_id = pnp_add_id(dev, id);
555 if (!dev_id) 535 if (!dev_id)
556 return NULL; 536 return NULL;