aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/pnpbios
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 18:33:54 -0400
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:16 -0400
commitbda1e4e5a3d976046378cd495a63e1ee0847deec (patch)
treed646e0057940116440d8f2c53ea7fc225d97a0a0 /drivers/pnp/pnpbios
parent25eb846189d20db4114cebf14fee96d69bef4667 (diff)
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')
-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 3ee5ed43738..6af2be2c1d6 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)
318{ 318{
319 struct list_head *pos; 319 struct list_head *pos;
320 struct pnp_dev *dev; 320 struct pnp_dev *dev;
321 struct pnp_id *dev_id;
322 char id[8]; 321 char id[8];
323 322
324 /* check if the device is already added */ 323 /* check if the device is already added */
@@ -328,18 +327,11 @@ static int __init insert_device(struct pnp_bios_node *node)
328 return -1; 327 return -1;
329 } 328 }
330 329
331 dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL);
332 if (!dev)
333 return -1;
334
335 pnp_eisa_id_to_string(node->eisa_id & PNP_EISA_ID_MASK, id); 330 pnp_eisa_id_to_string(node->eisa_id & PNP_EISA_ID_MASK, id);
336 dev_id = pnp_add_id(dev, id); 331 dev = pnp_alloc_dev(&pnpbios_protocol, node->handle, id);
337 if (!dev_id) { 332 if (!dev)
338 kfree(dev);
339 return -1; 333 return -1;
340 }
341 334
342 dev->number = node->handle;
343 pnpbios_parse_data_stream(dev, node); 335 pnpbios_parse_data_stream(dev, node);
344 dev->active = pnp_is_active(dev); 336 dev->active = pnp_is_active(dev);
345 dev->flags = node->flags; 337 dev->flags = node->flags;
@@ -352,7 +344,6 @@ static int __init insert_device(struct pnp_bios_node *node)
352 dev->capabilities |= PNP_WRITE; 344 dev->capabilities |= PNP_WRITE;
353 if (dev->flags & PNPBIOS_REMOVABLE) 345 if (dev->flags & PNPBIOS_REMOVABLE)
354 dev->capabilities |= PNP_REMOVABLE; 346 dev->capabilities |= PNP_REMOVABLE;
355 dev->protocol = &pnpbios_protocol;
356 347
357 /* clear out the damaged flags */ 348 /* clear out the damaged flags */
358 if (!dev->active) 349 if (!dev->active)