[SERIAL] serial_cs: convert multi-port table to quirk table
- rename multi_id table to serial_quirk / quirks[] - use named initialisers - store a pointer to the quirk table in the serial_info structure so we can use the quirk table entry later. - apply multi-port quirk after the multi-port guessing code, but only if it's != -1. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
Родитель
43549ad7a7
Коммит
1fbbac4bcb
|
@ -80,20 +80,42 @@ module_param(buggy_uart, int, 0444);
|
||||||
|
|
||||||
/* Table of multi-port card ID's */
|
/* Table of multi-port card ID's */
|
||||||
|
|
||||||
struct multi_id {
|
struct serial_quirk {
|
||||||
u_short manfid;
|
u_short manfid;
|
||||||
u_short prodid;
|
u_short prodid;
|
||||||
int multi; /* 1 = multifunction, > 1 = # ports */
|
int multi; /* 1 = multifunction, > 1 = # ports */
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct multi_id multi_id[] = {
|
static const struct serial_quirk quirks[] = {
|
||||||
{ MANFID_OMEGA, PRODID_OMEGA_QSP_100, 4 },
|
{
|
||||||
{ MANFID_QUATECH, PRODID_QUATECH_DUAL_RS232, 2 },
|
.manfid = MANFID_OMEGA,
|
||||||
{ MANFID_QUATECH, PRODID_QUATECH_DUAL_RS232_D1, 2 },
|
.prodid = PRODID_OMEGA_QSP_100,
|
||||||
{ MANFID_QUATECH, PRODID_QUATECH_QUAD_RS232, 4 },
|
.multi = 4,
|
||||||
{ MANFID_SOCKET, PRODID_SOCKET_DUAL_RS232, 2 },
|
}, {
|
||||||
{ MANFID_INTEL, PRODID_INTEL_DUAL_RS232, 2 },
|
.manfid = MANFID_QUATECH,
|
||||||
{ MANFID_NATINST, PRODID_NATINST_QUAD_RS232, 4 }
|
.prodid = PRODID_QUATECH_DUAL_RS232,
|
||||||
|
.multi = 2,
|
||||||
|
}, {
|
||||||
|
.manfid = MANFID_QUATECH,
|
||||||
|
.prodid = PRODID_QUATECH_DUAL_RS232_D1,
|
||||||
|
.multi = 2,
|
||||||
|
}, {
|
||||||
|
.manfid = MANFID_QUATECH,
|
||||||
|
.prodid = PRODID_QUATECH_QUAD_RS232,
|
||||||
|
.multi = 4,
|
||||||
|
}, {
|
||||||
|
.manfid = MANFID_SOCKET,
|
||||||
|
.prodid = PRODID_SOCKET_DUAL_RS232,
|
||||||
|
.multi = 2,
|
||||||
|
}, {
|
||||||
|
.manfid = MANFID_INTEL,
|
||||||
|
.prodid = PRODID_INTEL_DUAL_RS232,
|
||||||
|
.multi = 2,
|
||||||
|
}, {
|
||||||
|
.manfid = MANFID_NATINST,
|
||||||
|
.prodid = PRODID_NATINST_QUAD_RS232,
|
||||||
|
.multi = 4,
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct serial_info {
|
struct serial_info {
|
||||||
|
@ -106,6 +128,7 @@ struct serial_info {
|
||||||
int c950ctrl;
|
int c950ctrl;
|
||||||
dev_node_t node[4];
|
dev_node_t node[4];
|
||||||
int line[4];
|
int line[4];
|
||||||
|
const struct serial_quirk *quirk;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct serial_cfg_mem {
|
struct serial_cfg_mem {
|
||||||
|
@ -622,10 +645,10 @@ static int serial_config(struct pcmcia_device * link)
|
||||||
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 = parse->manfid.card;
|
info->prodid = parse->manfid.card;
|
||||||
for (i = 0; i < ARRAY_SIZE(multi_id); i++)
|
for (i = 0; i < ARRAY_SIZE(quirks); i++)
|
||||||
if ((info->manfid == multi_id[i].manfid) &&
|
if ((info->manfid == quirks[i].manfid) &&
|
||||||
(info->prodid == multi_id[i].prodid)) {
|
(info->prodid == quirks[i].prodid)) {
|
||||||
info->multi = multi_id[i].multi;
|
info->quirk = &quirks[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -647,6 +670,12 @@ static int serial_config(struct pcmcia_device * link)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Apply any multi-port quirk.
|
||||||
|
*/
|
||||||
|
if (info->quirk && info->quirk->multi != -1)
|
||||||
|
info->multi = info->quirk->multi;
|
||||||
|
|
||||||
if (info->multi > 1)
|
if (info->multi > 1)
|
||||||
multi_config(link);
|
multi_config(link);
|
||||||
else
|
else
|
||||||
|
|
Загрузка…
Ссылка в новой задаче