summaryrefslogtreecommitdiffstats
path: root/drivers/pnp/pnpbios
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 16:33:52 -0600
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:16 -0400
commit772defc6292bae8b6db298476d1dabd22a99492b (patch)
treeb973807f7f65f6d59e8a273ff80ab3d312e71dc3 /drivers/pnp/pnpbios
parent1692b27bf37826f85f9c12f8468848885643532a (diff)
PNP: change pnp_add_id() to allocate its own pnp_id structures
This moves some of the pnp_id knowledge out of the backends and into the PNP core. 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.c6
-rw-r--r--drivers/pnp/pnpbios/rsparser.c9
2 files changed, 6 insertions, 9 deletions
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index 2a5353bceb2..2d592aea0aa 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -332,16 +332,14 @@ static int __init insert_device(struct pnp_bios_node *node)
if (!dev)
return -1;
- dev_id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL);
+ pnpid32_to_pnpid(node->eisa_id, id);
+ dev_id = pnp_add_id(dev, id);
if (!dev_id) {
kfree(dev);
return -1;
}
dev->number = node->handle;
- pnpid32_to_pnpid(node->eisa_id, id);
- memcpy(dev_id->id, id, 7);
- pnp_add_id(dev_id, dev);
pnpbios_parse_data_stream(dev, node);
dev->active = pnp_is_active(dev);
dev->flags = node->flags;
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c
index caade353141..dbc88412c12 100644
--- a/drivers/pnp/pnpbios/rsparser.c
+++ b/drivers/pnp/pnpbios/rsparser.c
@@ -16,6 +16,7 @@ inline void pcibios_penalize_isa_irq(int irq, int active)
}
#endif /* CONFIG_PCI */
+#include "../base.h"
#include "pnpbios.h"
/* standard resource tags */
@@ -548,13 +549,11 @@ static unsigned char *pnpbios_parse_compatible_ids(unsigned char *p,
case SMALL_TAG_COMPATDEVID: /* compatible ID */
if (len != 4)
goto len_err;
- dev_id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL);
- if (!dev_id)
- return NULL;
pnpid32_to_pnpid(p[1] | p[2] << 8 | p[3] << 16 | p[4] <<
24, id);
- memcpy(&dev_id->id, id, 7);
- pnp_add_id(dev_id, dev);
+ dev_id = pnp_add_id(dev, id);
+ if (!dev_id)
+ return NULL;
break;
case SMALL_TAG_END: