[SERIAL] serial_cs: Use clean up multiport card detection
- Use ARRAY_SIZE() instead of home grown based version. - use parse->manfid.card rather than le16_to_cpu(buf[1]) - manfid.card is already converted to this format. - use info->prodid in subsequent tests rather than parse->manfid.card. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
parent
de6cc84f72
commit
43549ad7a7
|
@ -95,7 +95,6 @@ static const struct multi_id multi_id[] = {
|
||||||
{ MANFID_INTEL, PRODID_INTEL_DUAL_RS232, 2 },
|
{ MANFID_INTEL, PRODID_INTEL_DUAL_RS232, 2 },
|
||||||
{ MANFID_NATINST, PRODID_NATINST_QUAD_RS232, 4 }
|
{ MANFID_NATINST, PRODID_NATINST_QUAD_RS232, 4 }
|
||||||
};
|
};
|
||||||
#define MULTI_COUNT (sizeof(multi_id)/sizeof(struct multi_id))
|
|
||||||
|
|
||||||
struct serial_info {
|
struct serial_info {
|
||||||
struct pcmcia_device *p_dev;
|
struct pcmcia_device *p_dev;
|
||||||
|
@ -622,13 +621,13 @@ static int serial_config(struct pcmcia_device * link)
|
||||||
tuple->DesiredTuple = CISTPL_MANFID;
|
tuple->DesiredTuple = CISTPL_MANFID;
|
||||||
if (first_tuple(link, tuple, parse) == CS_SUCCESS) {
|
if (first_tuple(link, tuple, parse) == CS_SUCCESS) {
|
||||||
info->manfid = parse->manfid.manf;
|
info->manfid = parse->manfid.manf;
|
||||||
info->prodid = le16_to_cpu(buf[1]);
|
info->prodid = parse->manfid.card;
|
||||||
for (i = 0; i < MULTI_COUNT; i++)
|
for (i = 0; i < ARRAY_SIZE(multi_id); i++)
|
||||||
if ((info->manfid == multi_id[i].manfid) &&
|
if ((info->manfid == multi_id[i].manfid) &&
|
||||||
(parse->manfid.card == multi_id[i].prodid))
|
(info->prodid == multi_id[i].prodid)) {
|
||||||
|
info->multi = multi_id[i].multi;
|
||||||
break;
|
break;
|
||||||
if (i < MULTI_COUNT)
|
}
|
||||||
info->multi = multi_id[i].multi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Another check for dual-serial cards: look for either serial or
|
/* Another check for dual-serial cards: look for either serial or
|
||||||
|
|
Loading…
Reference in New Issue