summaryrefslogtreecommitdiffstats
path: root/drivers/pnp/isapnp
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/isapnp
parent25eb846189d20db4114cebf14fee96d69bef4667 (diff)
downloadlinux-stable-bda1e4e5a3d976046378cd495a63e1ee0847deec.tar.gz
linux-stable-bda1e4e5a3d976046378cd495a63e1ee0847deec.tar.bz2
linux-stable-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/isapnp')
-rw-r--r--drivers/pnp/isapnp/core.c11
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,
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;