summaryrefslogtreecommitdiffstats
path: root/drivers/pnp/pnpbios/core.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 16:33:54 -0600
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:16 -0400
commitbda1e4e5a3d976046378cd495a63e1ee0847deec (patch)
treed646e0057940116440d8f2c53ea7fc225d97a0a0 /drivers/pnp/pnpbios/core.c
parent25eb846189d20db4114cebf14fee96d69bef4667 (diff)
downloadlinux-bda1e4e5a3d976046378cd495a63e1ee0847deec.tar.gz
linux-bda1e4e5a3d976046378cd495a63e1ee0847deec.tar.bz2
linux-bda1e4e5a3d976046378cd495a63e1ee0847deec.zip
PNP: add pnp_alloc_dev()
Add pnp_alloc_dev() to allocate a struct pnp_dev and fill in the protocol, instance number, and initial PNP ID. Now it is always valid to use dev_printk() on any pnp_dev pointer. 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/core.c')
-rw-r--r--drivers/pnp/pnpbios/core.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index 3ee5ed437385..6af2be2c1d67 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -318,7 +318,6 @@ static int __init insert_device(struct pnp_bios_node *node)
{
struct list_head *pos;
struct pnp_dev *dev;
- struct pnp_id *dev_id;
char id[8];
/* check if the device is already added */
@@ -328,18 +327,11 @@ static int __init insert_device(struct pnp_bios_node *node)
return -1;
}
- dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL);
- if (!dev)
- return -1;
-
pnp_eisa_id_to_string(node->eisa_id & PNP_EISA_ID_MASK, id);
- dev_id = pnp_add_id(dev, id);
- if (!dev_id) {
- kfree(dev);
+ dev = pnp_alloc_dev(&pnpbios_protocol, node->handle, id);
+ if (!dev)
return -1;
- }
- dev->number = node->handle;
pnpbios_parse_data_stream(dev, node);
dev->active = pnp_is_active(dev);
dev->flags = node->flags;
@@ -352,7 +344,6 @@ static int __init insert_device(struct pnp_bios_node *node)
dev->capabilities |= PNP_WRITE;
if (dev->flags & PNPBIOS_REMOVABLE)
dev->capabilities |= PNP_REMOVABLE;
- dev->protocol = &pnpbios_protocol;
/* clear out the damaged flags */
if (!dev->active)