diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-04-28 18:33:54 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-29 03:22:16 -0400 |
commit | bda1e4e5a3d976046378cd495a63e1ee0847deec (patch) | |
tree | d646e0057940116440d8f2c53ea7fc225d97a0a0 /drivers/pnp/isapnp | |
parent | 25eb846189d20db4114cebf14fee96d69bef4667 (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/isapnp')
-rw-r--r-- | drivers/pnp/isapnp/core.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c index ccb04190044b..727936a6befb 100644 --- a/drivers/pnp/isapnp/core.c +++ b/drivers/pnp/isapnp/core.c | |||
@@ -409,18 +409,17 @@ static struct pnp_dev *__init isapnp_parse_device(struct pnp_card *card, | |||
409 | char id[8]; | 409 | char id[8]; |
410 | 410 | ||
411 | isapnp_peek(tmp, size); | 411 | isapnp_peek(tmp, size); |
412 | dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL); | ||
413 | if (!dev) | ||
414 | return NULL; | ||
415 | dev->number = number; | ||
416 | eisa_id = tmp[0] | tmp[1] << 8 | tmp[2] << 16 | tmp[3] << 24; | 412 | eisa_id = tmp[0] | tmp[1] << 8 | tmp[2] << 16 | tmp[3] << 24; |
417 | pnp_eisa_id_to_string(eisa_id, id); | 413 | pnp_eisa_id_to_string(eisa_id, id); |
418 | pnp_add_id(dev, id); | 414 | |
415 | dev = pnp_alloc_dev(&isapnp_protocol, number, id); | ||
416 | if (!dev) | ||
417 | return NULL; | ||
418 | |||
419 | dev->regs = tmp[4]; | 419 | dev->regs = tmp[4]; |
420 | dev->card = card; | 420 | dev->card = card; |
421 | if (size > 5) | 421 | if (size > 5) |
422 | dev->regs |= tmp[5] << 8; | 422 | dev->regs |= tmp[5] << 8; |
423 | dev->protocol = &isapnp_protocol; | ||
424 | dev->capabilities |= PNP_CONFIGURABLE; | 423 | dev->capabilities |= PNP_CONFIGURABLE; |
425 | dev->capabilities |= PNP_READ; | 424 | dev->capabilities |= PNP_READ; |
426 | dev->capabilities |= PNP_WRITE; | 425 | dev->capabilities |= PNP_WRITE; |