diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-04-28 16:33:54 -0600 |
---|---|---|
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) | |
download | op-kernel-dev-bda1e4e5a3d976046378cd495a63e1ee0847deec.zip op-kernel-dev-bda1e4e5a3d976046378cd495a63e1ee0847deec.tar.gz |
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 ccb0419..727936a 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, char id[8]; isapnp_peek(tmp, size); - dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL); - if (!dev) - return NULL; - dev->number = number; eisa_id = tmp[0] | tmp[1] << 8 | tmp[2] << 16 | tmp[3] << 24; pnp_eisa_id_to_string(eisa_id, id); - pnp_add_id(dev, id); + + dev = pnp_alloc_dev(&isapnp_protocol, number, id); + if (!dev) + return NULL; + dev->regs = tmp[4]; dev->card = card; if (size > 5) dev->regs |= tmp[5] << 8; - dev->protocol = &isapnp_protocol; dev->capabilities |= PNP_CONFIGURABLE; dev->capabilities |= PNP_READ; dev->capabilities |= PNP_WRITE; |