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/ds.c | |
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/ds.c')
-rw-r--r-- | drivers/pcmcia/ds.c | 46 |
1 files changed, 18 insertions, 28 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; |