diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2005-07-07 20:59:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-07 21:24:06 -0400 |
commit | 2bc5a9bdc56fac6f7cbf95b89443e3809141c247 (patch) | |
tree | b9cc15e994df40ca5f1e9748f2bb32e9e292c5d7 /drivers/pcmcia | |
parent | e12a9a93a8417c4f2aa46ce8346c2d27e656b9a2 (diff) |
[PATCH] pcmcia: reduce client_handle_t usage
Reduce the occurences of "client_handle_t" which is nothing else than a
pointer to struct pcmcia_device by now.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r-- | drivers/pcmcia/ds.c | 46 | ||||
-rw-r--r-- | drivers/pcmcia/pcmcia_compat.c | 36 | ||||
-rw-r--r-- | drivers/pcmcia/pcmcia_resource.c | 125 |
3 files changed, 72 insertions, 135 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 1cae9fda4e47..3e3c6f12bbe6 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -158,17 +158,15 @@ static const lookup_t service_table[] = { | |||
158 | }; | 158 | }; |
159 | 159 | ||
160 | 160 | ||
161 | static int pcmcia_report_error(client_handle_t handle, error_info_t *err) | 161 | static int pcmcia_report_error(struct pcmcia_device *p_dev, error_info_t *err) |
162 | { | 162 | { |
163 | int i; | 163 | int i; |
164 | char *serv; | 164 | char *serv; |
165 | 165 | ||
166 | if (!handle) | 166 | if (!p_dev) |
167 | printk(KERN_NOTICE); | 167 | printk(KERN_NOTICE); |
168 | else { | 168 | else |
169 | struct pcmcia_device *p_dev = handle_to_pdev(handle); | ||
170 | printk(KERN_NOTICE "%s: ", p_dev->dev.bus_id); | 169 | printk(KERN_NOTICE "%s: ", p_dev->dev.bus_id); |
171 | } | ||
172 | 170 | ||
173 | for (i = 0; i < ARRAY_SIZE(service_table); i++) | 171 | for (i = 0; i < ARRAY_SIZE(service_table); i++) |
174 | if (service_table[i].key == err->func) | 172 | if (service_table[i].key == err->func) |
@@ -193,10 +191,10 @@ static int pcmcia_report_error(client_handle_t handle, error_info_t *err) | |||
193 | 191 | ||
194 | /*======================================================================*/ | 192 | /*======================================================================*/ |
195 | 193 | ||
196 | void cs_error(client_handle_t handle, int func, int ret) | 194 | void cs_error(struct pcmcia_device *p_dev, int func, int ret) |
197 | { | 195 | { |
198 | error_info_t err = { func, ret }; | 196 | error_info_t err = { func, ret }; |
199 | pcmcia_report_error(handle, &err); | 197 | pcmcia_report_error(p_dev, &err); |
200 | } | 198 | } |
201 | EXPORT_SYMBOL(cs_error); | 199 | EXPORT_SYMBOL(cs_error); |
202 | 200 | ||
@@ -574,8 +572,6 @@ static int pcmcia_card_add(struct pcmcia_socket *s) | |||
574 | else | 572 | else |
575 | no_funcs = 1; | 573 | no_funcs = 1; |
576 | 574 | ||
577 | /* this doesn't handle multifunction devices on one pcmcia function | ||
578 | * yet. */ | ||
579 | for (i=0; i < no_funcs; i++) | 575 | for (i=0; i < no_funcs; i++) |
580 | pcmcia_device_add(s, i); | 576 | pcmcia_device_add(s, i); |
581 | 577 | ||
@@ -994,9 +990,8 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) | |||
994 | 990 | ||
995 | 991 | ||
996 | 992 | ||
997 | int pcmcia_register_client(client_handle_t *handle, client_reg_t *req) | 993 | int pcmcia_register_client(struct pcmcia_device **handle, client_reg_t *req) |
998 | { | 994 | { |
999 | struct pcmcia_device *client = NULL; | ||
1000 | struct pcmcia_socket *s = NULL; | 995 | struct pcmcia_socket *s = NULL; |
1001 | struct pcmcia_device *p_dev = NULL; | 996 | struct pcmcia_device *p_dev = NULL; |
1002 | struct pcmcia_driver *p_drv = NULL; | 997 | struct pcmcia_driver *p_drv = NULL; |
@@ -1024,7 +1019,6 @@ int pcmcia_register_client(client_handle_t *handle, client_reg_t *req) | |||
1024 | } | 1019 | } |
1025 | p_drv = to_pcmcia_drv(p_dev->dev.driver); | 1020 | p_drv = to_pcmcia_drv(p_dev->dev.driver); |
1026 | if (!strncmp(p_drv->drv.name, (char *)req->dev_info, DEV_NAME_LEN)) { | 1021 | if (!strncmp(p_drv->drv.name, (char *)req->dev_info, DEV_NAME_LEN)) { |
1027 | client = p_dev; | ||
1028 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); | 1022 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); |
1029 | goto found; | 1023 | goto found; |
1030 | } | 1024 | } |
@@ -1035,7 +1029,7 @@ int pcmcia_register_client(client_handle_t *handle, client_reg_t *req) | |||
1035 | } | 1029 | } |
1036 | found: | 1030 | found: |
1037 | up_read(&pcmcia_socket_list_rwsem); | 1031 | up_read(&pcmcia_socket_list_rwsem); |
1038 | if (!p_dev || !client) | 1032 | if (!p_dev) |
1039 | return -ENODEV; | 1033 | return -ENODEV; |
1040 | 1034 | ||
1041 | pcmcia_put_socket(s); /* safe, as we already hold a reference from bind_device */ | 1035 | pcmcia_put_socket(s); /* safe, as we already hold a reference from bind_device */ |
@@ -1046,12 +1040,9 @@ int pcmcia_register_client(client_handle_t *handle, client_reg_t *req) | |||
1046 | p_dev->event_callback_args.client_handle = p_dev; | 1040 | p_dev->event_callback_args.client_handle = p_dev; |
1047 | 1041 | ||
1048 | 1042 | ||
1049 | if (s->state & SOCKET_CARDBUS) | 1043 | if (!s->functions) { |
1050 | client->state |= CLIENT_CARDBUS; | ||
1051 | |||
1052 | if ((!(s->state & SOCKET_CARDBUS)) && (s->functions == 0)) { | ||
1053 | cistpl_longlink_mfc_t mfc; | 1044 | cistpl_longlink_mfc_t mfc; |
1054 | if (pccard_read_tuple(s, client->func, CISTPL_LONGLINK_MFC, &mfc) | 1045 | if (pccard_read_tuple(s, p_dev->func, CISTPL_LONGLINK_MFC, &mfc) |
1055 | == CS_SUCCESS) | 1046 | == CS_SUCCESS) |
1056 | s->functions = mfc.nfn; | 1047 | s->functions = mfc.nfn; |
1057 | else | 1048 | else |
@@ -1064,7 +1055,7 @@ int pcmcia_register_client(client_handle_t *handle, client_reg_t *req) | |||
1064 | } | 1055 | } |
1065 | 1056 | ||
1066 | ds_dbg(1, "register_client(): client 0x%p, dev %s\n", | 1057 | ds_dbg(1, "register_client(): client 0x%p, dev %s\n", |
1067 | client, p_dev->dev.bus_id); | 1058 | p_dev, p_dev->dev.bus_id); |
1068 | 1059 | ||
1069 | if ((s->state & (SOCKET_PRESENT|SOCKET_CARDBUS)) == SOCKET_PRESENT) { | 1060 | if ((s->state & (SOCKET_PRESENT|SOCKET_CARDBUS)) == SOCKET_PRESENT) { |
1070 | if (p_drv->event) | 1061 | if (p_drv->event) |
@@ -1112,26 +1103,25 @@ static int unbind_request(struct pcmcia_socket *s) | |||
1112 | return 0; | 1103 | return 0; |
1113 | } /* unbind_request */ | 1104 | } /* unbind_request */ |
1114 | 1105 | ||
1115 | int pcmcia_deregister_client(client_handle_t handle) | 1106 | int pcmcia_deregister_client(struct pcmcia_device *p_dev) |
1116 | { | 1107 | { |
1117 | struct pcmcia_socket *s; | 1108 | struct pcmcia_socket *s; |
1118 | int i; | 1109 | int i; |
1119 | struct pcmcia_device *p_dev = handle_to_pdev(handle); | ||
1120 | 1110 | ||
1121 | s = SOCKET(handle); | 1111 | s = p_dev->socket; |
1122 | ds_dbg(1, "deregister_client(%p)\n", handle); | 1112 | ds_dbg(1, "deregister_client(%p)\n", p_dev); |
1123 | 1113 | ||
1124 | if (handle->state & (CLIENT_IRQ_REQ|CLIENT_IO_REQ|CLIENT_CONFIG_LOCKED)) | 1114 | if (p_dev->state & (CLIENT_IRQ_REQ|CLIENT_IO_REQ|CLIENT_CONFIG_LOCKED)) |
1125 | goto warn_out; | 1115 | goto warn_out; |
1126 | for (i = 0; i < MAX_WIN; i++) | 1116 | for (i = 0; i < MAX_WIN; i++) |
1127 | if (handle->state & CLIENT_WIN_REQ(i)) | 1117 | if (p_dev->state & CLIENT_WIN_REQ(i)) |
1128 | goto warn_out; | 1118 | goto warn_out; |
1129 | 1119 | ||
1130 | if (handle->state & CLIENT_STALE) { | 1120 | if (p_dev->state & CLIENT_STALE) { |
1131 | handle->state &= ~CLIENT_STALE; | 1121 | p_dev->state &= ~CLIENT_STALE; |
1132 | pcmcia_put_dev(p_dev); | 1122 | pcmcia_put_dev(p_dev); |
1133 | } else { | 1123 | } else { |
1134 | handle->state = CLIENT_UNBOUND; | 1124 | p_dev->state = CLIENT_UNBOUND; |
1135 | } | 1125 | } |
1136 | 1126 | ||
1137 | return CS_SUCCESS; | 1127 | return CS_SUCCESS; |
diff --git a/drivers/pcmcia/pcmcia_compat.c b/drivers/pcmcia/pcmcia_compat.c index 916de6f85a2f..962ca004ac1b 100644 --- a/drivers/pcmcia/pcmcia_compat.c +++ b/drivers/pcmcia/pcmcia_compat.c | |||
@@ -28,53 +28,39 @@ | |||
28 | 28 | ||
29 | #include "cs_internal.h" | 29 | #include "cs_internal.h" |
30 | 30 | ||
31 | int pcmcia_get_first_tuple(client_handle_t handle, tuple_t *tuple) | 31 | int pcmcia_get_first_tuple(struct pcmcia_device *p_dev, tuple_t *tuple) |
32 | { | 32 | { |
33 | struct pcmcia_socket *s; | 33 | return pccard_get_first_tuple(p_dev->socket, p_dev->func, tuple); |
34 | s = SOCKET(handle); | ||
35 | return pccard_get_first_tuple(s, handle->func, tuple); | ||
36 | } | 34 | } |
37 | EXPORT_SYMBOL(pcmcia_get_first_tuple); | 35 | EXPORT_SYMBOL(pcmcia_get_first_tuple); |
38 | 36 | ||
39 | int pcmcia_get_next_tuple(client_handle_t handle, tuple_t *tuple) | 37 | int pcmcia_get_next_tuple(struct pcmcia_device *p_dev, tuple_t *tuple) |
40 | { | 38 | { |
41 | struct pcmcia_socket *s; | 39 | return pccard_get_next_tuple(p_dev->socket, p_dev->func, tuple); |
42 | s = SOCKET(handle); | ||
43 | return pccard_get_next_tuple(s, handle->func, tuple); | ||
44 | } | 40 | } |
45 | EXPORT_SYMBOL(pcmcia_get_next_tuple); | 41 | EXPORT_SYMBOL(pcmcia_get_next_tuple); |
46 | 42 | ||
47 | int pcmcia_get_tuple_data(client_handle_t handle, tuple_t *tuple) | 43 | int pcmcia_get_tuple_data(struct pcmcia_device *p_dev, tuple_t *tuple) |
48 | { | 44 | { |
49 | struct pcmcia_socket *s; | 45 | return pccard_get_tuple_data(p_dev->socket, tuple); |
50 | s = SOCKET(handle); | ||
51 | return pccard_get_tuple_data(s, tuple); | ||
52 | } | 46 | } |
53 | EXPORT_SYMBOL(pcmcia_get_tuple_data); | 47 | EXPORT_SYMBOL(pcmcia_get_tuple_data); |
54 | 48 | ||
55 | int pcmcia_parse_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) | 49 | int pcmcia_parse_tuple(struct pcmcia_device *p_dev, tuple_t *tuple, cisparse_t *parse) |
56 | { | 50 | { |
57 | return pccard_parse_tuple(tuple, parse); | 51 | return pccard_parse_tuple(tuple, parse); |
58 | } | 52 | } |
59 | EXPORT_SYMBOL(pcmcia_parse_tuple); | 53 | EXPORT_SYMBOL(pcmcia_parse_tuple); |
60 | 54 | ||
61 | int pcmcia_validate_cis(client_handle_t handle, cisinfo_t *info) | 55 | int pcmcia_validate_cis(struct pcmcia_device *p_dev, cisinfo_t *info) |
62 | { | 56 | { |
63 | struct pcmcia_socket *s; | 57 | return pccard_validate_cis(p_dev->socket, p_dev->func, info); |
64 | s = SOCKET(handle); | ||
65 | return pccard_validate_cis(s, handle->func, info); | ||
66 | } | 58 | } |
67 | EXPORT_SYMBOL(pcmcia_validate_cis); | 59 | EXPORT_SYMBOL(pcmcia_validate_cis); |
68 | 60 | ||
69 | 61 | ||
70 | int pcmcia_reset_card(client_handle_t handle, client_req_t *req) | 62 | int pcmcia_reset_card(struct pcmcia_device *p_dev, client_req_t *req) |
71 | { | 63 | { |
72 | struct pcmcia_socket *skt; | 64 | return pccard_reset_card(p_dev->socket); |
73 | |||
74 | skt = SOCKET(handle); | ||
75 | if (!skt) | ||
76 | return CS_BAD_HANDLE; | ||
77 | |||
78 | return pccard_reset_card(skt); | ||
79 | } | 65 | } |
80 | EXPORT_SYMBOL(pcmcia_reset_card); | 66 | EXPORT_SYMBOL(pcmcia_reset_card); |
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index ac5c3abe70c0..ec2abb37f407 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -202,12 +202,11 @@ int pccard_access_configuration_register(struct pcmcia_socket *s, | |||
202 | return CS_SUCCESS; | 202 | return CS_SUCCESS; |
203 | } /* pccard_access_configuration_register */ | 203 | } /* pccard_access_configuration_register */ |
204 | 204 | ||
205 | int pcmcia_access_configuration_register(client_handle_t handle, | 205 | int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, |
206 | conf_reg_t *reg) | 206 | conf_reg_t *reg) |
207 | { | 207 | { |
208 | struct pcmcia_socket *s; | 208 | return pccard_access_configuration_register(p_dev->socket, |
209 | s = SOCKET(handle); | 209 | p_dev->func, reg); |
210 | return pccard_access_configuration_register(s, handle->func, reg); | ||
211 | } | 210 | } |
212 | EXPORT_SYMBOL(pcmcia_access_configuration_register); | 211 | EXPORT_SYMBOL(pcmcia_access_configuration_register); |
213 | 212 | ||
@@ -269,17 +268,11 @@ int pccard_get_configuration_info(struct pcmcia_socket *s, | |||
269 | return CS_SUCCESS; | 268 | return CS_SUCCESS; |
270 | } /* pccard_get_configuration_info */ | 269 | } /* pccard_get_configuration_info */ |
271 | 270 | ||
272 | int pcmcia_get_configuration_info(client_handle_t handle, | 271 | int pcmcia_get_configuration_info(struct pcmcia_device *p_dev, |
273 | config_info_t *config) | 272 | config_info_t *config) |
274 | { | 273 | { |
275 | struct pcmcia_socket *s; | 274 | return pccard_get_configuration_info(p_dev->socket, p_dev->func, |
276 | 275 | config); | |
277 | if (!config) | ||
278 | return CS_BAD_HANDLE; | ||
279 | s = SOCKET(handle); | ||
280 | if (!s) | ||
281 | return CS_BAD_HANDLE; | ||
282 | return pccard_get_configuration_info(s, handle->func, config); | ||
283 | } | 276 | } |
284 | EXPORT_SYMBOL(pcmcia_get_configuration_info); | 277 | EXPORT_SYMBOL(pcmcia_get_configuration_info); |
285 | 278 | ||
@@ -422,14 +415,14 @@ EXPORT_SYMBOL(pcmcia_map_mem_page); | |||
422 | * | 415 | * |
423 | * Modify a locked socket configuration | 416 | * Modify a locked socket configuration |
424 | */ | 417 | */ |
425 | int pcmcia_modify_configuration(client_handle_t handle, | 418 | int pcmcia_modify_configuration(struct pcmcia_device *p_dev, |
426 | modconf_t *mod) | 419 | modconf_t *mod) |
427 | { | 420 | { |
428 | struct pcmcia_socket *s; | 421 | struct pcmcia_socket *s; |
429 | config_t *c; | 422 | config_t *c; |
430 | 423 | ||
431 | s = SOCKET(handle); | 424 | s = p_dev->socket; |
432 | c = CONFIG(handle); | 425 | c = CONFIG(p_dev); |
433 | if (!(s->state & SOCKET_PRESENT)) | 426 | if (!(s->state & SOCKET_PRESENT)) |
434 | return CS_NO_CARD; | 427 | return CS_NO_CARD; |
435 | if (!(c->state & CONFIG_LOCKED)) | 428 | if (!(c->state & CONFIG_LOCKED)) |
@@ -466,24 +459,18 @@ int pcmcia_modify_configuration(client_handle_t handle, | |||
466 | EXPORT_SYMBOL(pcmcia_modify_configuration); | 459 | EXPORT_SYMBOL(pcmcia_modify_configuration); |
467 | 460 | ||
468 | 461 | ||
469 | int pcmcia_release_configuration(client_handle_t handle) | 462 | int pcmcia_release_configuration(struct pcmcia_device *p_dev) |
470 | { | 463 | { |
471 | pccard_io_map io = { 0, 0, 0, 0, 1 }; | 464 | pccard_io_map io = { 0, 0, 0, 0, 1 }; |
472 | struct pcmcia_socket *s; | 465 | struct pcmcia_socket *s = p_dev->socket; |
473 | int i; | 466 | int i; |
474 | 467 | ||
475 | if (!(handle->state & CLIENT_CONFIG_LOCKED)) | 468 | if (!(p_dev->state & CLIENT_CONFIG_LOCKED)) |
476 | return CS_BAD_HANDLE; | 469 | return CS_BAD_HANDLE; |
477 | handle->state &= ~CLIENT_CONFIG_LOCKED; | 470 | p_dev->state &= ~CLIENT_CONFIG_LOCKED; |
478 | s = SOCKET(handle); | ||
479 | 471 | ||
480 | #ifdef CONFIG_CARDBUS | 472 | if (!(p_dev->state & CLIENT_STALE)) { |
481 | if (handle->state & CLIENT_CARDBUS) | 473 | config_t *c = CONFIG(p_dev); |
482 | return CS_SUCCESS; | ||
483 | #endif | ||
484 | |||
485 | if (!(handle->state & CLIENT_STALE)) { | ||
486 | config_t *c = CONFIG(handle); | ||
487 | if (--(s->lock_count) == 0) { | 474 | if (--(s->lock_count) == 0) { |
488 | s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */ | 475 | s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */ |
489 | s->socket.Vpp = 0; | 476 | s->socket.Vpp = 0; |
@@ -516,22 +503,16 @@ EXPORT_SYMBOL(pcmcia_release_configuration); | |||
516 | * don't bother checking the port ranges against the current socket | 503 | * don't bother checking the port ranges against the current socket |
517 | * values. | 504 | * values. |
518 | */ | 505 | */ |
519 | int pcmcia_release_io(client_handle_t handle, io_req_t *req) | 506 | int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req) |
520 | { | 507 | { |
521 | struct pcmcia_socket *s; | 508 | struct pcmcia_socket *s = p_dev->socket; |
522 | 509 | ||
523 | if (!(handle->state & CLIENT_IO_REQ)) | 510 | if (!(p_dev->state & CLIENT_IO_REQ)) |
524 | return CS_BAD_HANDLE; | 511 | return CS_BAD_HANDLE; |
525 | handle->state &= ~CLIENT_IO_REQ; | 512 | p_dev->state &= ~CLIENT_IO_REQ; |
526 | s = SOCKET(handle); | ||
527 | |||
528 | #ifdef CONFIG_CARDBUS | ||
529 | if (handle->state & CLIENT_CARDBUS) | ||
530 | return CS_SUCCESS; | ||
531 | #endif | ||
532 | 513 | ||
533 | if (!(handle->state & CLIENT_STALE)) { | 514 | if (!(p_dev->state & CLIENT_STALE)) { |
534 | config_t *c = CONFIG(handle); | 515 | config_t *c = CONFIG(p_dev); |
535 | if (c->state & CONFIG_LOCKED) | 516 | if (c->state & CONFIG_LOCKED) |
536 | return CS_CONFIGURATION_LOCKED; | 517 | return CS_CONFIGURATION_LOCKED; |
537 | if ((c->io.BasePort1 != req->BasePort1) || | 518 | if ((c->io.BasePort1 != req->BasePort1) || |
@@ -551,16 +532,15 @@ int pcmcia_release_io(client_handle_t handle, io_req_t *req) | |||
551 | EXPORT_SYMBOL(pcmcia_release_io); | 532 | EXPORT_SYMBOL(pcmcia_release_io); |
552 | 533 | ||
553 | 534 | ||
554 | int pcmcia_release_irq(client_handle_t handle, irq_req_t *req) | 535 | int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req) |
555 | { | 536 | { |
556 | struct pcmcia_socket *s; | 537 | struct pcmcia_socket *s = p_dev->socket; |
557 | if (!(handle->state & CLIENT_IRQ_REQ)) | 538 | if (!(p_dev->state & CLIENT_IRQ_REQ)) |
558 | return CS_BAD_HANDLE; | 539 | return CS_BAD_HANDLE; |
559 | handle->state &= ~CLIENT_IRQ_REQ; | 540 | p_dev->state &= ~CLIENT_IRQ_REQ; |
560 | s = SOCKET(handle); | ||
561 | 541 | ||
562 | if (!(handle->state & CLIENT_STALE)) { | 542 | if (!(p_dev->state & CLIENT_STALE)) { |
563 | config_t *c = CONFIG(handle); | 543 | config_t *c = CONFIG(p_dev); |
564 | if (c->state & CONFIG_LOCKED) | 544 | if (c->state & CONFIG_LOCKED) |
565 | return CS_CONFIGURATION_LOCKED; | 545 | return CS_CONFIGURATION_LOCKED; |
566 | if (c->irq.Attributes != req->Attributes) | 546 | if (c->irq.Attributes != req->Attributes) |
@@ -616,27 +596,21 @@ int pcmcia_release_window(window_handle_t win) | |||
616 | EXPORT_SYMBOL(pcmcia_release_window); | 596 | EXPORT_SYMBOL(pcmcia_release_window); |
617 | 597 | ||
618 | 598 | ||
619 | int pcmcia_request_configuration(client_handle_t handle, | 599 | int pcmcia_request_configuration(struct pcmcia_device *p_dev, |
620 | config_req_t *req) | 600 | config_req_t *req) |
621 | { | 601 | { |
622 | int i; | 602 | int i; |
623 | u_int base; | 603 | u_int base; |
624 | struct pcmcia_socket *s; | 604 | struct pcmcia_socket *s = p_dev->socket; |
625 | config_t *c; | 605 | config_t *c; |
626 | pccard_io_map iomap; | 606 | pccard_io_map iomap; |
627 | 607 | ||
628 | s = SOCKET(handle); | ||
629 | if (!(s->state & SOCKET_PRESENT)) | 608 | if (!(s->state & SOCKET_PRESENT)) |
630 | return CS_NO_CARD; | 609 | return CS_NO_CARD; |
631 | 610 | ||
632 | #ifdef CONFIG_CARDBUS | ||
633 | if (handle->state & CLIENT_CARDBUS) | ||
634 | return CS_UNSUPPORTED_MODE; | ||
635 | #endif | ||
636 | |||
637 | if (req->IntType & INT_CARDBUS) | 611 | if (req->IntType & INT_CARDBUS) |
638 | return CS_UNSUPPORTED_MODE; | 612 | return CS_UNSUPPORTED_MODE; |
639 | c = CONFIG(handle); | 613 | c = CONFIG(p_dev); |
640 | if (c->state & CONFIG_LOCKED) | 614 | if (c->state & CONFIG_LOCKED) |
641 | return CS_CONFIGURATION_LOCKED; | 615 | return CS_CONFIGURATION_LOCKED; |
642 | 616 | ||
@@ -737,7 +711,7 @@ int pcmcia_request_configuration(client_handle_t handle, | |||
737 | } | 711 | } |
738 | 712 | ||
739 | c->state |= CONFIG_LOCKED; | 713 | c->state |= CONFIG_LOCKED; |
740 | handle->state |= CLIENT_CONFIG_LOCKED; | 714 | p_dev->state |= CLIENT_CONFIG_LOCKED; |
741 | return CS_SUCCESS; | 715 | return CS_SUCCESS; |
742 | } /* pcmcia_request_configuration */ | 716 | } /* pcmcia_request_configuration */ |
743 | EXPORT_SYMBOL(pcmcia_request_configuration); | 717 | EXPORT_SYMBOL(pcmcia_request_configuration); |
@@ -748,27 +722,17 @@ EXPORT_SYMBOL(pcmcia_request_configuration); | |||
748 | * Request_io() reserves ranges of port addresses for a socket. | 722 | * Request_io() reserves ranges of port addresses for a socket. |
749 | * I have not implemented range sharing or alias addressing. | 723 | * I have not implemented range sharing or alias addressing. |
750 | */ | 724 | */ |
751 | int pcmcia_request_io(client_handle_t handle, io_req_t *req) | 725 | int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req) |
752 | { | 726 | { |
753 | struct pcmcia_socket *s; | 727 | struct pcmcia_socket *s = p_dev->socket; |
754 | config_t *c; | 728 | config_t *c; |
755 | 729 | ||
756 | s = SOCKET(handle); | ||
757 | if (!(s->state & SOCKET_PRESENT)) | 730 | if (!(s->state & SOCKET_PRESENT)) |
758 | return CS_NO_CARD; | 731 | return CS_NO_CARD; |
759 | 732 | ||
760 | if (handle->state & CLIENT_CARDBUS) { | ||
761 | #ifdef CONFIG_CARDBUS | ||
762 | handle->state |= CLIENT_IO_REQ; | ||
763 | return CS_SUCCESS; | ||
764 | #else | ||
765 | return CS_UNSUPPORTED_FUNCTION; | ||
766 | #endif | ||
767 | } | ||
768 | |||
769 | if (!req) | 733 | if (!req) |
770 | return CS_UNSUPPORTED_MODE; | 734 | return CS_UNSUPPORTED_MODE; |
771 | c = CONFIG(handle); | 735 | c = CONFIG(p_dev); |
772 | if (c->state & CONFIG_LOCKED) | 736 | if (c->state & CONFIG_LOCKED) |
773 | return CS_CONFIGURATION_LOCKED; | 737 | return CS_CONFIGURATION_LOCKED; |
774 | if (c->state & CONFIG_IO_REQ) | 738 | if (c->state & CONFIG_IO_REQ) |
@@ -793,7 +757,7 @@ int pcmcia_request_io(client_handle_t handle, io_req_t *req) | |||
793 | 757 | ||
794 | c->io = *req; | 758 | c->io = *req; |
795 | c->state |= CONFIG_IO_REQ; | 759 | c->state |= CONFIG_IO_REQ; |
796 | handle->state |= CLIENT_IO_REQ; | 760 | p_dev->state |= CLIENT_IO_REQ; |
797 | return CS_SUCCESS; | 761 | return CS_SUCCESS; |
798 | } /* pcmcia_request_io */ | 762 | } /* pcmcia_request_io */ |
799 | EXPORT_SYMBOL(pcmcia_request_io); | 763 | EXPORT_SYMBOL(pcmcia_request_io); |
@@ -816,17 +780,15 @@ static irqreturn_t test_action(int cpl, void *dev_id, struct pt_regs *regs) | |||
816 | } | 780 | } |
817 | #endif | 781 | #endif |
818 | 782 | ||
819 | int pcmcia_request_irq(client_handle_t handle, irq_req_t *req) | 783 | int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) |
820 | { | 784 | { |
821 | struct pcmcia_socket *s; | 785 | struct pcmcia_socket *s = p_dev->socket; |
822 | config_t *c; | 786 | config_t *c; |
823 | int ret = CS_IN_USE, irq = 0; | 787 | int ret = CS_IN_USE, irq = 0; |
824 | struct pcmcia_device *p_dev = handle_to_pdev(handle); | ||
825 | 788 | ||
826 | s = SOCKET(handle); | ||
827 | if (!(s->state & SOCKET_PRESENT)) | 789 | if (!(s->state & SOCKET_PRESENT)) |
828 | return CS_NO_CARD; | 790 | return CS_NO_CARD; |
829 | c = CONFIG(handle); | 791 | c = CONFIG(p_dev); |
830 | if (c->state & CONFIG_LOCKED) | 792 | if (c->state & CONFIG_LOCKED) |
831 | return CS_CONFIGURATION_LOCKED; | 793 | return CS_CONFIGURATION_LOCKED; |
832 | if (c->state & CONFIG_IRQ_REQ) | 794 | if (c->state & CONFIG_IRQ_REQ) |
@@ -890,7 +852,7 @@ int pcmcia_request_irq(client_handle_t handle, irq_req_t *req) | |||
890 | s->irq.Config++; | 852 | s->irq.Config++; |
891 | 853 | ||
892 | c->state |= CONFIG_IRQ_REQ; | 854 | c->state |= CONFIG_IRQ_REQ; |
893 | handle->state |= CLIENT_IRQ_REQ; | 855 | p_dev->state |= CLIENT_IRQ_REQ; |
894 | 856 | ||
895 | #ifdef CONFIG_PCMCIA_PROBE | 857 | #ifdef CONFIG_PCMCIA_PROBE |
896 | pcmcia_used_irq[irq]++; | 858 | pcmcia_used_irq[irq]++; |
@@ -906,14 +868,13 @@ EXPORT_SYMBOL(pcmcia_request_irq); | |||
906 | * Request_window() establishes a mapping between card memory space | 868 | * Request_window() establishes a mapping between card memory space |
907 | * and system memory space. | 869 | * and system memory space. |
908 | */ | 870 | */ |
909 | int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle_t *wh) | 871 | int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_handle_t *wh) |
910 | { | 872 | { |
911 | struct pcmcia_socket *s; | 873 | struct pcmcia_socket *s = (*p_dev)->socket; |
912 | window_t *win; | 874 | window_t *win; |
913 | u_long align; | 875 | u_long align; |
914 | int w; | 876 | int w; |
915 | 877 | ||
916 | s = (*handle)->socket; | ||
917 | if (!(s->state & SOCKET_PRESENT)) | 878 | if (!(s->state & SOCKET_PRESENT)) |
918 | return CS_NO_CARD; | 879 | return CS_NO_CARD; |
919 | if (req->Attributes & (WIN_PAGED | WIN_SHARED)) | 880 | if (req->Attributes & (WIN_PAGED | WIN_SHARED)) |
@@ -942,7 +903,7 @@ int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle | |||
942 | win = &s->win[w]; | 903 | win = &s->win[w]; |
943 | win->magic = WINDOW_MAGIC; | 904 | win->magic = WINDOW_MAGIC; |
944 | win->index = w; | 905 | win->index = w; |
945 | win->handle = *handle; | 906 | win->handle = *p_dev; |
946 | win->sock = s; | 907 | win->sock = s; |
947 | 908 | ||
948 | if (!(s->features & SS_CAP_STATIC_MAP)) { | 909 | if (!(s->features & SS_CAP_STATIC_MAP)) { |
@@ -951,7 +912,7 @@ int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle | |||
951 | if (!win->ctl.res) | 912 | if (!win->ctl.res) |
952 | return CS_IN_USE; | 913 | return CS_IN_USE; |
953 | } | 914 | } |
954 | (*handle)->state |= CLIENT_WIN_REQ(w); | 915 | (*p_dev)->state |= CLIENT_WIN_REQ(w); |
955 | 916 | ||
956 | /* Configure the socket controller */ | 917 | /* Configure the socket controller */ |
957 | win->ctl.map = w+1; | 918 | win->ctl.map = w+1; |