diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-04-28 18:33:58 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-29 03:22:17 -0400 |
commit | 6bf2aab24a5dc26bf8274c4b9dbbed8ca99ae82c (patch) | |
tree | 910e6795cf929481cecb00fc5ebad43121beba56 /drivers/pnp/isapnp | |
parent | 068076d5517009654376ceda75ff44af0feb9b1d (diff) |
PNP: add pnp_alloc_card()
Add pnp_alloc_card() to allocate a struct pnp_card and fill in the
protocol, instance number, and initial PNP ID. Now it is always
valid to use dev_printk() on any pnp_card 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 | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c index 3a326f9305f6..883577a93d6a 100644 --- a/drivers/pnp/isapnp/core.c +++ b/drivers/pnp/isapnp/core.c | |||
@@ -840,16 +840,14 @@ static int __init isapnp_build_device_list(void) | |||
840 | header[5], header[6], header[7], header[8]); | 840 | header[5], header[6], header[7], header[8]); |
841 | printk(KERN_DEBUG "checksum = 0x%x\n", checksum); | 841 | printk(KERN_DEBUG "checksum = 0x%x\n", checksum); |
842 | #endif | 842 | #endif |
843 | if ((card = | ||
844 | kzalloc(sizeof(struct pnp_card), GFP_KERNEL)) == NULL) | ||
845 | continue; | ||
846 | |||
847 | card->number = csn; | ||
848 | INIT_LIST_HEAD(&card->devices); | ||
849 | eisa_id = header[0] | header[1] << 8 | | 843 | eisa_id = header[0] | header[1] << 8 | |
850 | header[2] << 16 | header[3] << 24; | 844 | header[2] << 16 | header[3] << 24; |
851 | pnp_eisa_id_to_string(eisa_id, id); | 845 | pnp_eisa_id_to_string(eisa_id, id); |
852 | pnp_add_card_id(card, id); | 846 | card = pnp_alloc_card(&isapnp_protocol, csn, id); |
847 | if (!card) | ||
848 | continue; | ||
849 | |||
850 | INIT_LIST_HEAD(&card->devices); | ||
853 | card->serial = | 851 | card->serial = |
854 | (header[7] << 24) | (header[6] << 16) | (header[5] << 8) | | 852 | (header[7] << 24) | (header[6] << 16) | (header[5] << 8) | |
855 | header[4]; | 853 | header[4]; |
@@ -860,7 +858,6 @@ static int __init isapnp_build_device_list(void) | |||
860 | "isapnp: checksum for device %i is not valid (0x%x)\n", | 858 | "isapnp: checksum for device %i is not valid (0x%x)\n", |
861 | csn, isapnp_checksum_value); | 859 | csn, isapnp_checksum_value); |
862 | card->checksum = isapnp_checksum_value; | 860 | card->checksum = isapnp_checksum_value; |
863 | card->protocol = &isapnp_protocol; | ||
864 | 861 | ||
865 | pnp_add_card(card); | 862 | pnp_add_card(card); |
866 | } | 863 | } |