ide: fix refcounting in device drivers
[linux-2.6/mini2440.git] / include / pcmcia / device_id.h
blobc33ea08352b8a5447ce37ed89f49cfb1d1efd265
1 /*
2 * device_id.h -- PCMCIA driver matching helpers
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 * (C) 2003 - 2004 David Woodhouse
9 * (C) 2003 - 2004 Dominik Brodowski
12 #ifndef _LINUX_PCMCIA_DEVICE_ID_H
13 #define _LINUX_PCMCIA_DEVICE_ID_H
15 #ifdef __KERNEL__
17 #define PCMCIA_DEVICE_MANF_CARD(manf, card) { \
18 .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \
19 PCMCIA_DEV_ID_MATCH_CARD_ID, \
20 .manf_id = (manf), \
21 .card_id = (card), }
23 #define PCMCIA_DEVICE_FUNC_ID(func) { \
24 .match_flags = PCMCIA_DEV_ID_MATCH_FUNC_ID, \
25 .func_id = (func), }
27 #define PCMCIA_DEVICE_PROD_ID1(v1, vh1) { \
28 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1, \
29 .prod_id = { (v1), NULL, NULL, NULL }, \
30 .prod_id_hash = { (vh1), 0, 0, 0 }, }
32 #define PCMCIA_DEVICE_PROD_ID2(v2, vh2) { \
33 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID2, \
34 .prod_id = { NULL, (v2), NULL, NULL }, \
35 .prod_id_hash = { 0, (vh2), 0, 0 }, }
37 #define PCMCIA_DEVICE_PROD_ID12(v1, v2, vh1, vh2) { \
38 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
39 PCMCIA_DEV_ID_MATCH_PROD_ID2, \
40 .prod_id = { (v1), (v2), NULL, NULL }, \
41 .prod_id_hash = { (vh1), (vh2), 0, 0 }, }
43 #define PCMCIA_DEVICE_PROD_ID13(v1, v3, vh1, vh3) { \
44 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
45 PCMCIA_DEV_ID_MATCH_PROD_ID3, \
46 .prod_id = { (v1), NULL, (v3), NULL }, \
47 .prod_id_hash = { (vh1), 0, (vh3), 0 }, }
49 #define PCMCIA_DEVICE_PROD_ID14(v1, v4, vh1, vh4) { \
50 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
51 PCMCIA_DEV_ID_MATCH_PROD_ID4, \
52 .prod_id = { (v1), NULL, NULL, (v4) }, \
53 .prod_id_hash = { (vh1), 0, 0, (vh4) }, }
55 #define PCMCIA_DEVICE_PROD_ID123(v1, v2, v3, vh1, vh2, vh3) { \
56 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
57 PCMCIA_DEV_ID_MATCH_PROD_ID2| \
58 PCMCIA_DEV_ID_MATCH_PROD_ID3, \
59 .prod_id = { (v1), (v2), (v3), NULL },\
60 .prod_id_hash = { (vh1), (vh2), (vh3), 0 }, }
62 #define PCMCIA_DEVICE_PROD_ID124(v1, v2, v4, vh1, vh2, vh4) { \
63 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
64 PCMCIA_DEV_ID_MATCH_PROD_ID2| \
65 PCMCIA_DEV_ID_MATCH_PROD_ID4, \
66 .prod_id = { (v1), (v2), NULL, (v4) }, \
67 .prod_id_hash = { (vh1), (vh2), 0, (vh4) }, }
69 #define PCMCIA_DEVICE_PROD_ID134(v1, v3, v4, vh1, vh3, vh4) { \
70 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
71 PCMCIA_DEV_ID_MATCH_PROD_ID3| \
72 PCMCIA_DEV_ID_MATCH_PROD_ID4, \
73 .prod_id = { (v1), NULL, (v3), (v4) }, \
74 .prod_id_hash = { (vh1), 0, (vh3), (vh4) }, }
76 #define PCMCIA_DEVICE_PROD_ID1234(v1, v2, v3, v4, vh1, vh2, vh3, vh4) { \
77 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
78 PCMCIA_DEV_ID_MATCH_PROD_ID2| \
79 PCMCIA_DEV_ID_MATCH_PROD_ID3| \
80 PCMCIA_DEV_ID_MATCH_PROD_ID4, \
81 .prod_id = { (v1), (v2), (v3), (v4) }, \
82 .prod_id_hash = { (vh1), (vh2), (vh3), (vh4) }, }
84 #define PCMCIA_DEVICE_MANF_CARD_PROD_ID1(manf, card, v1, vh1) { \
85 .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \
86 PCMCIA_DEV_ID_MATCH_CARD_ID| \
87 PCMCIA_DEV_ID_MATCH_PROD_ID1, \
88 .manf_id = (manf), \
89 .card_id = (card), \
90 .prod_id = { (v1), NULL, NULL, NULL }, \
91 .prod_id_hash = { (vh1), 0, 0, 0 }, }
94 /* multi-function devices */
96 #define PCMCIA_MFC_DEVICE_MANF_CARD(mfc, manf, card) { \
97 .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \
98 PCMCIA_DEV_ID_MATCH_CARD_ID| \
99 PCMCIA_DEV_ID_MATCH_FUNCTION, \
100 .manf_id = (manf), \
101 .card_id = (card), \
102 .function = (mfc), }
104 #define PCMCIA_MFC_DEVICE_PROD_ID1(mfc, v1, vh1) { \
105 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
106 PCMCIA_DEV_ID_MATCH_FUNCTION, \
107 .prod_id = { (v1), NULL, NULL, NULL }, \
108 .prod_id_hash = { (vh1), 0, 0, 0 }, \
109 .function = (mfc), }
111 #define PCMCIA_MFC_DEVICE_PROD_ID2(mfc, v2, vh2) { \
112 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID2| \
113 PCMCIA_DEV_ID_MATCH_FUNCTION, \
114 .prod_id = { NULL, (v2), NULL, NULL }, \
115 .prod_id_hash = { 0, (vh2), 0, 0 }, \
116 .function = (mfc), }
118 #define PCMCIA_MFC_DEVICE_PROD_ID12(mfc, v1, v2, vh1, vh2) { \
119 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
120 PCMCIA_DEV_ID_MATCH_PROD_ID2| \
121 PCMCIA_DEV_ID_MATCH_FUNCTION, \
122 .prod_id = { (v1), (v2), NULL, NULL }, \
123 .prod_id_hash = { (vh1), (vh2), 0, 0 }, \
124 .function = (mfc), }
126 #define PCMCIA_MFC_DEVICE_PROD_ID13(mfc, v1, v3, vh1, vh3) { \
127 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
128 PCMCIA_DEV_ID_MATCH_PROD_ID3| \
129 PCMCIA_DEV_ID_MATCH_FUNCTION, \
130 .prod_id = { (v1), NULL, (v3), NULL }, \
131 .prod_id_hash = { (vh1), 0, (vh3), 0 }, \
132 .function = (mfc), }
134 #define PCMCIA_MFC_DEVICE_PROD_ID123(mfc, v1, v2, v3, vh1, vh2, vh3) { \
135 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
136 PCMCIA_DEV_ID_MATCH_PROD_ID2| \
137 PCMCIA_DEV_ID_MATCH_PROD_ID3| \
138 PCMCIA_DEV_ID_MATCH_FUNCTION, \
139 .prod_id = { (v1), (v2), (v3), NULL },\
140 .prod_id_hash = { (vh1), (vh2), (vh3), 0 }, \
141 .function = (mfc), }
143 /* pseudo multi-function devices */
145 #define PCMCIA_PFC_DEVICE_MANF_CARD(mfc, manf, card) { \
146 .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \
147 PCMCIA_DEV_ID_MATCH_CARD_ID| \
148 PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
149 .manf_id = (manf), \
150 .card_id = (card), \
151 .device_no = (mfc), }
153 #define PCMCIA_PFC_DEVICE_PROD_ID1(mfc, v1, vh1) { \
154 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
155 PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
156 .prod_id = { (v1), NULL, NULL, NULL }, \
157 .prod_id_hash = { (vh1), 0, 0, 0 }, \
158 .device_no = (mfc), }
160 #define PCMCIA_PFC_DEVICE_PROD_ID2(mfc, v2, vh2) { \
161 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID2| \
162 PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
163 .prod_id = { NULL, (v2), NULL, NULL }, \
164 .prod_id_hash = { 0, (vh2), 0, 0 }, \
165 .device_no = (mfc), }
167 #define PCMCIA_PFC_DEVICE_PROD_ID12(mfc, v1, v2, vh1, vh2) { \
168 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
169 PCMCIA_DEV_ID_MATCH_PROD_ID2| \
170 PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
171 .prod_id = { (v1), (v2), NULL, NULL }, \
172 .prod_id_hash = { (vh1), (vh2), 0, 0 }, \
173 .device_no = (mfc), }
175 #define PCMCIA_PFC_DEVICE_PROD_ID13(mfc, v1, v3, vh1, vh3) { \
176 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
177 PCMCIA_DEV_ID_MATCH_PROD_ID3| \
178 PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
179 .prod_id = { (v1), NULL, (v3), NULL }, \
180 .prod_id_hash = { (vh1), 0, (vh3), 0 }, \
181 .device_no = (mfc), }
183 #define PCMCIA_PFC_DEVICE_PROD_ID123(mfc, v1, v2, v3, vh1, vh2, vh3) { \
184 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
185 PCMCIA_DEV_ID_MATCH_PROD_ID2| \
186 PCMCIA_DEV_ID_MATCH_PROD_ID3| \
187 PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
188 .prod_id = { (v1), (v2), (v3), NULL },\
189 .prod_id_hash = { (vh1), (vh2), (vh3), 0 }, \
190 .device_no = (mfc), }
192 /* cards needing a CIS override */
194 #define PCMCIA_DEVICE_CIS_MANF_CARD(manf, card, _cisfile) { \
195 .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
196 PCMCIA_DEV_ID_MATCH_MANF_ID| \
197 PCMCIA_DEV_ID_MATCH_CARD_ID, \
198 .manf_id = (manf), \
199 .card_id = (card), \
200 .cisfile = (_cisfile)}
202 #define PCMCIA_DEVICE_CIS_PROD_ID12(v1, v2, vh1, vh2, _cisfile) { \
203 .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
204 PCMCIA_DEV_ID_MATCH_PROD_ID1| \
205 PCMCIA_DEV_ID_MATCH_PROD_ID2, \
206 .prod_id = { (v1), (v2), NULL, NULL }, \
207 .prod_id_hash = { (vh1), (vh2), 0, 0 }, \
208 .cisfile = (_cisfile)}
210 #define PCMCIA_DEVICE_CIS_PROD_ID123(v1, v2, v3, vh1, vh2, vh3, _cisfile) { \
211 .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
212 PCMCIA_DEV_ID_MATCH_PROD_ID1| \
213 PCMCIA_DEV_ID_MATCH_PROD_ID2| \
214 PCMCIA_DEV_ID_MATCH_PROD_ID3, \
215 .prod_id = { (v1), (v2), (v3), NULL },\
216 .prod_id_hash = { (vh1), (vh2), (vh3), 0 }, \
217 .cisfile = (_cisfile)}
220 #define PCMCIA_DEVICE_CIS_PROD_ID2(v2, vh2, _cisfile) { \
221 .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
222 PCMCIA_DEV_ID_MATCH_PROD_ID2, \
223 .prod_id = { NULL, (v2), NULL, NULL }, \
224 .prod_id_hash = { 0, (vh2), 0, 0 }, \
225 .cisfile = (_cisfile)}
227 #define PCMCIA_PFC_DEVICE_CIS_PROD_ID12(mfc, v1, v2, vh1, vh2, _cisfile) { \
228 .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
229 PCMCIA_DEV_ID_MATCH_PROD_ID1| \
230 PCMCIA_DEV_ID_MATCH_PROD_ID2| \
231 PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
232 .prod_id = { (v1), (v2), NULL, NULL }, \
233 .prod_id_hash = { (vh1), (vh2), 0, 0 },\
234 .device_no = (mfc), \
235 .cisfile = (_cisfile)}
237 #define PCMCIA_MFC_DEVICE_CIS_MANF_CARD(mfc, manf, card, _cisfile) { \
238 .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
239 PCMCIA_DEV_ID_MATCH_MANF_ID| \
240 PCMCIA_DEV_ID_MATCH_CARD_ID| \
241 PCMCIA_DEV_ID_MATCH_FUNCTION, \
242 .manf_id = (manf), \
243 .card_id = (card), \
244 .function = (mfc), \
245 .cisfile = (_cisfile)}
247 #define PCMCIA_MFC_DEVICE_CIS_PROD_ID12(mfc, v1, v2, vh1, vh2, _cisfile) { \
248 .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
249 PCMCIA_DEV_ID_MATCH_PROD_ID1| \
250 PCMCIA_DEV_ID_MATCH_PROD_ID2| \
251 PCMCIA_DEV_ID_MATCH_FUNCTION, \
252 .prod_id = { (v1), (v2), NULL, NULL }, \
253 .prod_id_hash = { (vh1), (vh2), 0, 0 }, \
254 .function = (mfc), \
255 .cisfile = (_cisfile)}
257 #define PCMCIA_MFC_DEVICE_CIS_PROD_ID4(mfc, v4, vh4, _cisfile) { \
258 .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
259 PCMCIA_DEV_ID_MATCH_PROD_ID4| \
260 PCMCIA_DEV_ID_MATCH_FUNCTION, \
261 .prod_id = { NULL, NULL, NULL, (v4) }, \
262 .prod_id_hash = { 0, 0, 0, (vh4) }, \
263 .function = (mfc), \
264 .cisfile = (_cisfile)}
267 #define PCMCIA_DEVICE_NULL { .match_flags = 0, }
269 #endif /* __KERNEL__ */
270 #endif /* _LINUX_PCMCIA_DEVICE_ID_H */