Skip to content

Commit 068076d

Browse files
Bjorn Helgaaslenb
authored andcommitted
ISAPNP: pull pnp_add_card_id() out of isapnp_parse_card_id()
Split the pnp_add_card_id() part from the PNPID conversion part so we can move the initial add_id() into the pnp_card allocation. This makes the PNPID conversion generic so we can use the same one for both devices and cards. 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>
1 parent e436675 commit 068076d

1 file changed

Lines changed: 6 additions & 22 deletions

File tree

‎drivers/pnp/isapnp/core.c‎

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -816,26 +816,6 @@ static unsigned char __init isapnp_checksum(unsigned char *data)
816816
return checksum;
817817
}
818818

819-
/*
820-
* Parse EISA id for ISA PnP card.
821-
*/
822-
static void isapnp_parse_card_id(struct pnp_card *card, unsigned short vendor,
823-
unsigned short device)
824-
{
825-
char id[8];
826-
827-
id[0] = 'A' + ((vendor >> 2) & 0x3f) - 1;
828-
id[1] = 'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1;
829-
id[2] = 'A' + ((vendor >> 8) & 0x1f) - 1;
830-
id[3] = hex_asc((device >> 4) & 0x0f);
831-
id[4] = hex_asc(device & 0x0f);
832-
id[5] = hex_asc((device >> 12) & 0x0f);
833-
id[6] = hex_asc((device >> 8) & 0x0f);
834-
id[7] = '\0';
835-
836-
pnp_add_card_id(card, id);
837-
}
838-
839819
/*
840820
* Build device list for all present ISA PnP devices.
841821
*/
@@ -844,6 +824,8 @@ static int __init isapnp_build_device_list(void)
844824
int csn;
845825
unsigned char header[9], checksum;
846826
struct pnp_card *card;
827+
u32 eisa_id;
828+
char id[8];
847829

848830
isapnp_wait();
849831
isapnp_key();
@@ -864,8 +846,10 @@ static int __init isapnp_build_device_list(void)
864846

865847
card->number = csn;
866848
INIT_LIST_HEAD(&card->devices);
867-
isapnp_parse_card_id(card, (header[1] << 8) | header[0],
868-
(header[3] << 8) | header[2]);
849+
eisa_id = header[0] | header[1] << 8 |
850+
header[2] << 16 | header[3] << 24;
851+
pnp_eisa_id_to_string(eisa_id, id);
852+
pnp_add_card_id(card, id);
869853
card->serial =
870854
(header[7] << 24) | (header[6] << 16) | (header[5] << 8) |
871855
header[4];

0 commit comments

Comments
 (0)