diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2006-09-16 16:09:41 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-10-01 12:06:23 -0400 |
commit | 1fbbac4bcb03033d325c71fc7273aa0b9c1d9a03 (patch) | |
tree | 55e38dd44ab03cd6b1c97f9939aaa829b68676c2 /drivers/serial/serial_cs.c | |
parent | 43549ad7a74e33947f3ba1756a7713086d32e97c (diff) |
[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>
Diffstat (limited to 'drivers/serial/serial_cs.c')
-rw-r--r-- | drivers/serial/serial_cs.c | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 82bb603fc1ae..2e3a39d38f08 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c | |||
@@ -80,20 +80,42 @@ module_param(buggy_uart, int, 0444); | |||
80 | 80 | ||
81 | /* Table of multi-port card ID's */ | 81 | /* Table of multi-port card ID's */ |
82 | 82 | ||
83 | struct multi_id { | 83 | struct serial_quirk { |
84 | u_short manfid; | 84 | u_short manfid; |
85 | u_short prodid; | 85 | u_short prodid; |
86 | int multi; /* 1 = multifunction, > 1 = # ports */ | 86 | int multi; /* 1 = multifunction, > 1 = # ports */ |
87 | }; | 87 | }; |
88 | 88 | ||
89 | static const struct multi_id multi_id[] = { | 89 | static const struct serial_quirk quirks[] = { |
90 | { MANFID_OMEGA, PRODID_OMEGA_QSP_100, 4 }, | 90 | { |
91 | { MANFID_QUATECH, PRODID_QUATECH_DUAL_RS232, 2 }, | 91 | .manfid = MANFID_OMEGA, |
92 | { MANFID_QUATECH, PRODID_QUATECH_DUAL_RS232_D1, 2 }, | 92 | .prodid = PRODID_OMEGA_QSP_100, |
93 | { MANFID_QUATECH, PRODID_QUATECH_QUAD_RS232, 4 }, | 93 | .multi = 4, |
94 | { MANFID_SOCKET, PRODID_SOCKET_DUAL_RS232, 2 }, | 94 | }, { |
95 | { MANFID_INTEL, PRODID_INTEL_DUAL_RS232, 2 }, | 95 | .manfid = MANFID_QUATECH, |
96 | { MANFID_NATINST, PRODID_NATINST_QUAD_RS232, 4 } | 96 | .prodid = PRODID_QUATECH_DUAL_RS232, |
97 | .multi = 2, | ||
98 | }, { | ||
99 | .manfid = MANFID_QUATECH, | ||
100 | .prodid = PRODID_QUATECH_DUAL_RS232_D1, | ||
101 | .multi = 2, | ||
102 | }, { | ||
103 | .manfid = MANFID_QUATECH, | ||
104 | .prodid = PRODID_QUATECH_QUAD_RS232, | ||
105 | .multi = 4, | ||
106 | }, { | ||
107 | .manfid = MANFID_SOCKET, | ||
108 | .prodid = PRODID_SOCKET_DUAL_RS232, | ||
109 | .multi = 2, | ||
110 | }, { | ||
111 | .manfid = MANFID_INTEL, | ||
112 | .prodid = PRODID_INTEL_DUAL_RS232, | ||
113 | .multi = 2, | ||
114 | }, { | ||
115 | .manfid = MANFID_NATINST, | ||
116 | .prodid = PRODID_NATINST_QUAD_RS232, | ||
117 | .multi = 4, | ||
118 | } | ||
97 | }; | 119 | }; |
98 | 120 | ||
99 | struct serial_info { | 121 | struct serial_info { |
@@ -106,6 +128,7 @@ struct serial_info { | |||
106 | int c950ctrl; | 128 | int c950ctrl; |
107 | dev_node_t node[4]; | 129 | dev_node_t node[4]; |
108 | int line[4]; | 130 | int line[4]; |
131 | const struct serial_quirk *quirk; | ||
109 | }; | 132 | }; |
110 | 133 | ||
111 | struct serial_cfg_mem { | 134 | struct serial_cfg_mem { |
@@ -622,10 +645,10 @@ static int serial_config(struct pcmcia_device * link) | |||
622 | if (first_tuple(link, tuple, parse) == CS_SUCCESS) { | 645 | if (first_tuple(link, tuple, parse) == CS_SUCCESS) { |
623 | info->manfid = parse->manfid.manf; | 646 | info->manfid = parse->manfid.manf; |
624 | info->prodid = parse->manfid.card; | 647 | info->prodid = parse->manfid.card; |
625 | for (i = 0; i < ARRAY_SIZE(multi_id); i++) | 648 | for (i = 0; i < ARRAY_SIZE(quirks); i++) |
626 | if ((info->manfid == multi_id[i].manfid) && | 649 | if ((info->manfid == quirks[i].manfid) && |
627 | (info->prodid == multi_id[i].prodid)) { | 650 | (info->prodid == quirks[i].prodid)) { |
628 | info->multi = multi_id[i].multi; | 651 | info->quirk = &quirks[i]; |
629 | break; | 652 | break; |
630 | } | 653 | } |
631 | } | 654 | } |
@@ -647,6 +670,12 @@ static int serial_config(struct pcmcia_device * link) | |||
647 | } | 670 | } |
648 | } | 671 | } |
649 | 672 | ||
673 | /* | ||
674 | * Apply any multi-port quirk. | ||
675 | */ | ||
676 | if (info->quirk && info->quirk->multi != -1) | ||
677 | info->multi = info->quirk->multi; | ||
678 | |||
650 | if (info->multi > 1) | 679 | if (info->multi > 1) |
651 | multi_config(link); | 680 | multi_config(link); |
652 | else | 681 | else |