diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2009-10-18 17:32:33 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2009-11-08 12:06:54 -0500 |
commit | 91284224da5b15ec6c2b45e10fa5eccd1c92a204 (patch) | |
tree | e070902f5119b2eacf79d91cd36de98e3ae8423c /include/pcmcia/ds.h | |
parent | af757923a92e6e9dbfdb6b0264be14c564e1c466 (diff) |
pcmcia: add new CIS access helpers
As a replacement to pcmcia_get_{first,next}_tuple() and
pcmcia_get_tuple_data(), three new -- and easier to use --
functions are added:
- pcmcia_get_tuple() to get the very first CIS entry of one
type.
- pcmcia_loop_tuple() to loop over all CIS entries of one type.
- pcmcia_get_mac_from_cis() to read out the hardware MAC address
from CISTPL_FUNCE.
Only a handful of drivers need these functions anyway, as most
CIS access is already handled by pcmcia_loop_config(), which
now shares the same backed (pccard_loop_tuple()) with
pcmcia_loop_tuple().
A pcmcia_get_mac_from_cis() bug noted by Komuro
<komurojun-mbn@nifty.com> has been fixed in this revision.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'include/pcmcia/ds.h')
-rw-r--r-- | include/pcmcia/ds.h | 57 |
1 files changed, 43 insertions, 14 deletions
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index a2be80b9a095..2eb6e24d1a6b 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h | |||
@@ -34,6 +34,7 @@ | |||
34 | struct pcmcia_socket; | 34 | struct pcmcia_socket; |
35 | struct pcmcia_device; | 35 | struct pcmcia_device; |
36 | struct config_t; | 36 | struct config_t; |
37 | struct net_device; | ||
37 | 38 | ||
38 | /* dynamic device IDs for PCMCIA device drivers. See | 39 | /* dynamic device IDs for PCMCIA device drivers. See |
39 | * Documentation/pcmcia/driver.txt for details. | 40 | * Documentation/pcmcia/driver.txt for details. |
@@ -176,26 +177,39 @@ const char *pcmcia_error_ret(int ret); | |||
176 | pcmcia_error_ret(ret)); \ | 177 | pcmcia_error_ret(ret)); \ |
177 | } | 178 | } |
178 | 179 | ||
179 | /* CIS access. | 180 | |
180 | * Use the pcmcia_* versions in PCMCIA drivers | 181 | /* |
182 | * CIS access. | ||
183 | * | ||
184 | * Please use the following functions to access CIS tuples: | ||
185 | * - pcmcia_get_tuple() | ||
186 | * - pcmcia_loop_tuple() | ||
187 | * - pcmcia_get_mac_from_cis() | ||
188 | * | ||
189 | * To parse a tuple_t, pcmcia_parse_tuple() exists. Its interface | ||
190 | * might change in future. | ||
181 | */ | 191 | */ |
182 | int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse); | ||
183 | 192 | ||
184 | int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, | 193 | /* get the very first CIS entry of type @code. Note that buf is pointer |
185 | tuple_t *tuple); | 194 | * to u8 *buf; and that you need to kfree(buf) afterwards. */ |
186 | #define pcmcia_get_first_tuple(p_dev, tuple) \ | 195 | size_t pcmcia_get_tuple(struct pcmcia_device *p_dev, cisdata_t code, |
187 | pccard_get_first_tuple(p_dev->socket, p_dev->func, tuple) | 196 | u8 **buf); |
188 | 197 | ||
189 | int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, | 198 | /* loop over CIS entries */ |
190 | tuple_t *tuple); | 199 | int pcmcia_loop_tuple(struct pcmcia_device *p_dev, cisdata_t code, |
191 | #define pcmcia_get_next_tuple(p_dev, tuple) \ | 200 | int (*loop_tuple) (struct pcmcia_device *p_dev, |
192 | pccard_get_next_tuple(p_dev->socket, p_dev->func, tuple) | 201 | tuple_t *tuple, |
202 | void *priv_data), | ||
203 | void *priv_data); | ||
193 | 204 | ||
194 | int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple); | 205 | /* get the MAC address from CISTPL_FUNCE */ |
195 | #define pcmcia_get_tuple_data(p_dev, tuple) \ | 206 | int pcmcia_get_mac_from_cis(struct pcmcia_device *p_dev, |
196 | pccard_get_tuple_data(p_dev->socket, tuple) | 207 | struct net_device *dev); |
197 | 208 | ||
198 | 209 | ||
210 | /* parse a tuple_t */ | ||
211 | int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse); | ||
212 | |||
199 | /* loop CIS entries for valid configuration */ | 213 | /* loop CIS entries for valid configuration */ |
200 | int pcmcia_loop_config(struct pcmcia_device *p_dev, | 214 | int pcmcia_loop_config(struct pcmcia_device *p_dev, |
201 | int (*conf_check) (struct pcmcia_device *p_dev, | 215 | int (*conf_check) (struct pcmcia_device *p_dev, |
@@ -215,6 +229,21 @@ int pcmcia_reset_card(struct pcmcia_socket *skt); | |||
215 | int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, | 229 | int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, |
216 | conf_reg_t *reg); | 230 | conf_reg_t *reg); |
217 | 231 | ||
232 | /* deprecated -- do not use in drivers. */ | ||
233 | int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, | ||
234 | tuple_t *tuple); | ||
235 | #define pcmcia_get_first_tuple(p_dev, tuple) \ | ||
236 | pccard_get_first_tuple(p_dev->socket, p_dev->func, tuple) | ||
237 | |||
238 | int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, | ||
239 | tuple_t *tuple); | ||
240 | #define pcmcia_get_next_tuple(p_dev, tuple) \ | ||
241 | pccard_get_next_tuple(p_dev->socket, p_dev->func, tuple) | ||
242 | |||
243 | int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple); | ||
244 | #define pcmcia_get_tuple_data(p_dev, tuple) \ | ||
245 | pccard_get_tuple_data(p_dev->socket, tuple) | ||
246 | |||
218 | /* device configuration */ | 247 | /* device configuration */ |
219 | int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req); | 248 | int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req); |
220 | int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req); | 249 | int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req); |