aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pcmcia
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-11-14 15:23:14 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-05 18:03:10 -0500
commitcc3b4866bee996c922e875b8c8efe9f0d8803aae (patch)
tree6632837b6986f33566f75ed971cecbdc210e3201 /drivers/scsi/pcmcia
parent8e9e793d68fcda6cc84c18cedf85ca0f91d801a8 (diff)
[PATCH] pcmcia: unify detach, REMOVAL_EVENT handlers into one remove callback
Unify the "detach" and REMOVAL_EVENT handlers to one "remove" function. Old functionality is preserved, for the moment. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/scsi/pcmcia')
-rw-r--r--drivers/scsi/pcmcia/aha152x_stub.c17
-rw-r--r--drivers/scsi/pcmcia/fdomain_stub.c17
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.c23
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.h2
-rw-r--r--drivers/scsi/pcmcia/qlogic_stub.c17
-rw-r--r--drivers/scsi/pcmcia/sym53c500_cs.c15
6 files changed, 26 insertions, 65 deletions
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index 82988a3e35ec..3128ba8c57a9 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -99,7 +99,7 @@ static int aha152x_event(event_t event, int priority,
99 event_callback_args_t *args); 99 event_callback_args_t *args);
100 100
101static dev_link_t *aha152x_attach(void); 101static dev_link_t *aha152x_attach(void);
102static void aha152x_detach(dev_link_t *); 102static void aha152x_detach(struct pcmcia_device *p_dev);
103 103
104static dev_link_t *dev_list; 104static dev_link_t *dev_list;
105static dev_info_t dev_info = "aha152x_cs"; 105static dev_info_t dev_info = "aha152x_cs";
@@ -138,7 +138,7 @@ static dev_link_t *aha152x_attach(void)
138 ret = pcmcia_register_client(&link->handle, &client_reg); 138 ret = pcmcia_register_client(&link->handle, &client_reg);
139 if (ret != 0) { 139 if (ret != 0) {
140 cs_error(link->handle, RegisterClient, ret); 140 cs_error(link->handle, RegisterClient, ret);
141 aha152x_detach(link); 141 aha152x_detach(link->handle);
142 return NULL; 142 return NULL;
143 } 143 }
144 144
@@ -147,8 +147,9 @@ static dev_link_t *aha152x_attach(void)
147 147
148/*====================================================================*/ 148/*====================================================================*/
149 149
150static void aha152x_detach(dev_link_t *link) 150static void aha152x_detach(struct pcmcia_device *p_dev)
151{ 151{
152 dev_link_t *link = dev_to_instance(p_dev);
152 dev_link_t **linkp; 153 dev_link_t **linkp;
153 154
154 DEBUG(0, "aha152x_detach(0x%p)\n", link); 155 DEBUG(0, "aha152x_detach(0x%p)\n", link);
@@ -162,9 +163,6 @@ static void aha152x_detach(dev_link_t *link)
162 if (link->state & DEV_CONFIG) 163 if (link->state & DEV_CONFIG)
163 aha152x_release_cs(link); 164 aha152x_release_cs(link);
164 165
165 if (link->handle)
166 pcmcia_deregister_client(link->handle);
167
168 /* Unlink device structure, free bits */ 166 /* Unlink device structure, free bits */
169 *linkp = link->next; 167 *linkp = link->next;
170 kfree(link->priv); 168 kfree(link->priv);
@@ -307,11 +305,6 @@ static int aha152x_event(event_t event, int priority,
307 DEBUG(0, "aha152x_event(0x%06x)\n", event); 305 DEBUG(0, "aha152x_event(0x%06x)\n", event);
308 306
309 switch (event) { 307 switch (event) {
310 case CS_EVENT_CARD_REMOVAL:
311 link->state &= ~DEV_PRESENT;
312 if (link->state & DEV_CONFIG)
313 aha152x_release_cs(link);
314 break;
315 case CS_EVENT_CARD_INSERTION: 308 case CS_EVENT_CARD_INSERTION:
316 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 309 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
317 aha152x_config_cs(link); 310 aha152x_config_cs(link);
@@ -337,7 +330,7 @@ static struct pcmcia_driver aha152x_cs_driver = {
337 }, 330 },
338 .attach = aha152x_attach, 331 .attach = aha152x_attach,
339 .event = aha152x_event, 332 .event = aha152x_event,
340 .detach = aha152x_detach, 333 .remove = aha152x_detach,
341 .id_table = aha152x_ids, 334 .id_table = aha152x_ids,
342 .suspend = aha152x_suspend, 335 .suspend = aha152x_suspend,
343 .resume = aha152x_resume, 336 .resume = aha152x_resume,
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c
index 9e1d68c14694..5842c938fff5 100644
--- a/drivers/scsi/pcmcia/fdomain_stub.c
+++ b/drivers/scsi/pcmcia/fdomain_stub.c
@@ -84,7 +84,7 @@ static int fdomain_event(event_t event, int priority,
84 event_callback_args_t *args); 84 event_callback_args_t *args);
85 85
86static dev_link_t *fdomain_attach(void); 86static dev_link_t *fdomain_attach(void);
87static void fdomain_detach(dev_link_t *); 87static void fdomain_detach(struct pcmcia_device *p_dev);
88 88
89 89
90static dev_link_t *dev_list = NULL; 90static dev_link_t *dev_list = NULL;
@@ -124,7 +124,7 @@ static dev_link_t *fdomain_attach(void)
124 ret = pcmcia_register_client(&link->handle, &client_reg); 124 ret = pcmcia_register_client(&link->handle, &client_reg);
125 if (ret != 0) { 125 if (ret != 0) {
126 cs_error(link->handle, RegisterClient, ret); 126 cs_error(link->handle, RegisterClient, ret);
127 fdomain_detach(link); 127 fdomain_detach(link->handle);
128 return NULL; 128 return NULL;
129 } 129 }
130 130
@@ -133,8 +133,9 @@ static dev_link_t *fdomain_attach(void)
133 133
134/*====================================================================*/ 134/*====================================================================*/
135 135
136static void fdomain_detach(dev_link_t *link) 136static void fdomain_detach(struct pcmcia_device *p_dev)
137{ 137{
138 dev_link_t *link = dev_to_instance(p_dev);
138 dev_link_t **linkp; 139 dev_link_t **linkp;
139 140
140 DEBUG(0, "fdomain_detach(0x%p)\n", link); 141 DEBUG(0, "fdomain_detach(0x%p)\n", link);
@@ -148,9 +149,6 @@ static void fdomain_detach(dev_link_t *link)
148 if (link->state & DEV_CONFIG) 149 if (link->state & DEV_CONFIG)
149 fdomain_release(link); 150 fdomain_release(link);
150 151
151 if (link->handle)
152 pcmcia_deregister_client(link->handle);
153
154 /* Unlink device structure, free bits */ 152 /* Unlink device structure, free bits */
155 *linkp = link->next; 153 *linkp = link->next;
156 kfree(link->priv); 154 kfree(link->priv);
@@ -288,11 +286,6 @@ static int fdomain_event(event_t event, int priority,
288 DEBUG(1, "fdomain_event(0x%06x)\n", event); 286 DEBUG(1, "fdomain_event(0x%06x)\n", event);
289 287
290 switch (event) { 288 switch (event) {
291 case CS_EVENT_CARD_REMOVAL:
292 link->state &= ~DEV_PRESENT;
293 if (link->state & DEV_CONFIG)
294 fdomain_release(link);
295 break;
296 case CS_EVENT_CARD_INSERTION: 289 case CS_EVENT_CARD_INSERTION:
297 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 290 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
298 fdomain_config(link); 291 fdomain_config(link);
@@ -317,7 +310,7 @@ static struct pcmcia_driver fdomain_cs_driver = {
317 }, 310 },
318 .attach = fdomain_attach, 311 .attach = fdomain_attach,
319 .event = fdomain_event, 312 .event = fdomain_event,
320 .detach = fdomain_detach, 313 .remove = fdomain_detach,
321 .id_table = fdomain_ids, 314 .id_table = fdomain_ids,
322 .suspend = fdomain_suspend, 315 .suspend = fdomain_suspend,
323 .resume = fdomain_resume, 316 .resume = fdomain_resume,
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index 870e87180d12..e40a8c22aa9d 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1646,7 +1646,7 @@ static dev_link_t *nsp_cs_attach(void)
1646 ret = pcmcia_register_client(&link->handle, &client_reg); 1646 ret = pcmcia_register_client(&link->handle, &client_reg);
1647 if (ret != CS_SUCCESS) { 1647 if (ret != CS_SUCCESS) {
1648 cs_error(link->handle, RegisterClient, ret); 1648 cs_error(link->handle, RegisterClient, ret);
1649 nsp_cs_detach(link); 1649 nsp_cs_detach(link->handle);
1650 return NULL; 1650 return NULL;
1651 } 1651 }
1652 1652
@@ -1662,8 +1662,9 @@ static dev_link_t *nsp_cs_attach(void)
1662 structures are freed. Otherwise, the structures will be freed 1662 structures are freed. Otherwise, the structures will be freed
1663 when the device is released. 1663 when the device is released.
1664======================================================================*/ 1664======================================================================*/
1665static void nsp_cs_detach(dev_link_t *link) 1665static void nsp_cs_detach(struct pcmcia_device *p_dev)
1666{ 1666{
1667 dev_link_t *link = dev_to_instance(p_dev);
1667 dev_link_t **linkp; 1668 dev_link_t **linkp;
1668 1669
1669 nsp_dbg(NSP_DEBUG_INIT, "in, link=0x%p", link); 1670 nsp_dbg(NSP_DEBUG_INIT, "in, link=0x%p", link);
@@ -1678,12 +1679,9 @@ static void nsp_cs_detach(dev_link_t *link)
1678 return; 1679 return;
1679 } 1680 }
1680 1681
1681 if (link->state & DEV_CONFIG) 1682 if (link->state & DEV_CONFIG) {
1683 ((scsi_info_t *)link->priv)->stop = 1;
1682 nsp_cs_release(link); 1684 nsp_cs_release(link);
1683
1684 /* Break the link with Card Services */
1685 if (link->handle) {
1686 pcmcia_deregister_client(link->handle);
1687 } 1685 }
1688 1686
1689 /* Unlink device structure, free bits */ 1687 /* Unlink device structure, free bits */
@@ -2096,15 +2094,6 @@ static int nsp_cs_event(event_t event,
2096 nsp_dbg(NSP_DEBUG_INIT, "in, event=0x%08x", event); 2094 nsp_dbg(NSP_DEBUG_INIT, "in, event=0x%08x", event);
2097 2095
2098 switch (event) { 2096 switch (event) {
2099 case CS_EVENT_CARD_REMOVAL:
2100 nsp_dbg(NSP_DEBUG_INIT, "event: remove");
2101 link->state &= ~DEV_PRESENT;
2102 if (link->state & DEV_CONFIG) {
2103 ((scsi_info_t *)link->priv)->stop = 1;
2104 nsp_cs_release(link);
2105 }
2106 break;
2107
2108 case CS_EVENT_CARD_INSERTION: 2097 case CS_EVENT_CARD_INSERTION:
2109 nsp_dbg(NSP_DEBUG_INIT, "event: insert"); 2098 nsp_dbg(NSP_DEBUG_INIT, "event: insert");
2110 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 2099 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
@@ -2144,7 +2133,7 @@ static struct pcmcia_driver nsp_driver = {
2144 }, 2133 },
2145 .attach = nsp_cs_attach, 2134 .attach = nsp_cs_attach,
2146 .event = nsp_cs_event, 2135 .event = nsp_cs_event,
2147 .detach = nsp_cs_detach, 2136 .remove = nsp_cs_detach,
2148 .id_table = nsp_cs_ids, 2137 .id_table = nsp_cs_ids,
2149 .suspend = nsp_cs_suspend, 2138 .suspend = nsp_cs_suspend,
2150 .resume = nsp_cs_resume, 2139 .resume = nsp_cs_resume,
diff --git a/drivers/scsi/pcmcia/nsp_cs.h b/drivers/scsi/pcmcia/nsp_cs.h
index f8b943082717..d276c469edf1 100644
--- a/drivers/scsi/pcmcia/nsp_cs.h
+++ b/drivers/scsi/pcmcia/nsp_cs.h
@@ -297,7 +297,7 @@ typedef struct _nsp_hw_data {
297 297
298/* Card service functions */ 298/* Card service functions */
299static dev_link_t *nsp_cs_attach (void); 299static dev_link_t *nsp_cs_attach (void);
300static void nsp_cs_detach (dev_link_t *link); 300static void nsp_cs_detach (struct pcmcia_device *p_dev);
301static void nsp_cs_release(dev_link_t *link); 301static void nsp_cs_release(dev_link_t *link);
302static void nsp_cs_config (dev_link_t *link); 302static void nsp_cs_config (dev_link_t *link);
303static int nsp_cs_event (event_t event, int priority, event_callback_args_t *args); 303static int nsp_cs_event (event_t event, int priority, event_callback_args_t *args);
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c
index 2541a999a0e5..8351dc234ffb 100644
--- a/drivers/scsi/pcmcia/qlogic_stub.c
+++ b/drivers/scsi/pcmcia/qlogic_stub.c
@@ -101,7 +101,7 @@ static void qlogic_release(dev_link_t *link);
101static int qlogic_event(event_t event, int priority, event_callback_args_t * args); 101static int qlogic_event(event_t event, int priority, event_callback_args_t * args);
102 102
103static dev_link_t *qlogic_attach(void); 103static dev_link_t *qlogic_attach(void);
104static void qlogic_detach(dev_link_t *); 104static void qlogic_detach(struct pcmcia_device *p_dev);
105 105
106 106
107static dev_link_t *dev_list = NULL; 107static dev_link_t *dev_list = NULL;
@@ -198,7 +198,7 @@ static dev_link_t *qlogic_attach(void)
198 ret = pcmcia_register_client(&link->handle, &client_reg); 198 ret = pcmcia_register_client(&link->handle, &client_reg);
199 if (ret != 0) { 199 if (ret != 0) {
200 cs_error(link->handle, RegisterClient, ret); 200 cs_error(link->handle, RegisterClient, ret);
201 qlogic_detach(link); 201 qlogic_detach(link->handle);
202 return NULL; 202 return NULL;
203 } 203 }
204 204
@@ -207,8 +207,9 @@ static dev_link_t *qlogic_attach(void)
207 207
208/*====================================================================*/ 208/*====================================================================*/
209 209
210static void qlogic_detach(dev_link_t * link) 210static void qlogic_detach(struct pcmcia_device *p_dev)
211{ 211{
212 dev_link_t *link = dev_to_instance(p_dev);
212 dev_link_t **linkp; 213 dev_link_t **linkp;
213 214
214 DEBUG(0, "qlogic_detach(0x%p)\n", link); 215 DEBUG(0, "qlogic_detach(0x%p)\n", link);
@@ -223,9 +224,6 @@ static void qlogic_detach(dev_link_t * link)
223 if (link->state & DEV_CONFIG) 224 if (link->state & DEV_CONFIG)
224 qlogic_release(link); 225 qlogic_release(link);
225 226
226 if (link->handle)
227 pcmcia_deregister_client(link->handle);
228
229 /* Unlink device structure, free bits */ 227 /* Unlink device structure, free bits */
230 *linkp = link->next; 228 *linkp = link->next;
231 kfree(link->priv); 229 kfree(link->priv);
@@ -390,11 +388,6 @@ static int qlogic_event(event_t event, int priority, event_callback_args_t * arg
390 DEBUG(1, "qlogic_event(0x%06x)\n", event); 388 DEBUG(1, "qlogic_event(0x%06x)\n", event);
391 389
392 switch (event) { 390 switch (event) {
393 case CS_EVENT_CARD_REMOVAL:
394 link->state &= ~DEV_PRESENT;
395 if (link->state & DEV_CONFIG)
396 qlogic_release(link);
397 break;
398 case CS_EVENT_CARD_INSERTION: 391 case CS_EVENT_CARD_INSERTION:
399 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 392 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
400 qlogic_config(link); 393 qlogic_config(link);
@@ -432,7 +425,7 @@ static struct pcmcia_driver qlogic_cs_driver = {
432 }, 425 },
433 .attach = qlogic_attach, 426 .attach = qlogic_attach,
434 .event = qlogic_event, 427 .event = qlogic_event,
435 .detach = qlogic_detach, 428 .remove = qlogic_detach,
436 .id_table = qlogic_ids, 429 .id_table = qlogic_ids,
437 .suspend = qlogic_suspend, 430 .suspend = qlogic_suspend,
438 .resume = qlogic_resume, 431 .resume = qlogic_resume,
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index c4e3e2294c66..a0f8e2691f9c 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -918,11 +918,6 @@ SYM53C500_event(event_t event, int priority, event_callback_args_t *args)
918 DEBUG(1, "SYM53C500_event(0x%06x)\n", event); 918 DEBUG(1, "SYM53C500_event(0x%06x)\n", event);
919 919
920 switch (event) { 920 switch (event) {
921 case CS_EVENT_CARD_REMOVAL:
922 link->state &= ~DEV_PRESENT;
923 if (link->state & DEV_CONFIG)
924 SYM53C500_release(link);
925 break;
926 case CS_EVENT_CARD_INSERTION: 921 case CS_EVENT_CARD_INSERTION:
927 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 922 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
928 SYM53C500_config(link); 923 SYM53C500_config(link);
@@ -932,8 +927,9 @@ SYM53C500_event(event_t event, int priority, event_callback_args_t *args)
932} /* SYM53C500_event */ 927} /* SYM53C500_event */
933 928
934static void 929static void
935SYM53C500_detach(dev_link_t *link) 930SYM53C500_detach(struct pcmcia_device *p_dev)
936{ 931{
932 dev_link_t *link = dev_to_instance(p_dev);
937 dev_link_t **linkp; 933 dev_link_t **linkp;
938 934
939 DEBUG(0, "SYM53C500_detach(0x%p)\n", link); 935 DEBUG(0, "SYM53C500_detach(0x%p)\n", link);
@@ -948,9 +944,6 @@ SYM53C500_detach(dev_link_t *link)
948 if (link->state & DEV_CONFIG) 944 if (link->state & DEV_CONFIG)
949 SYM53C500_release(link); 945 SYM53C500_release(link);
950 946
951 if (link->handle)
952 pcmcia_deregister_client(link->handle);
953
954 /* Unlink device structure, free bits. */ 947 /* Unlink device structure, free bits. */
955 *linkp = link->next; 948 *linkp = link->next;
956 kfree(link->priv); 949 kfree(link->priv);
@@ -993,7 +986,7 @@ SYM53C500_attach(void)
993 ret = pcmcia_register_client(&link->handle, &client_reg); 986 ret = pcmcia_register_client(&link->handle, &client_reg);
994 if (ret != 0) { 987 if (ret != 0) {
995 cs_error(link->handle, RegisterClient, ret); 988 cs_error(link->handle, RegisterClient, ret);
996 SYM53C500_detach(link); 989 SYM53C500_detach(link->handle);
997 return NULL; 990 return NULL;
998 } 991 }
999 992
@@ -1019,7 +1012,7 @@ static struct pcmcia_driver sym53c500_cs_driver = {
1019 }, 1012 },
1020 .attach = SYM53C500_attach, 1013 .attach = SYM53C500_attach,
1021 .event = SYM53C500_event, 1014 .event = SYM53C500_event,
1022 .detach = SYM53C500_detach, 1015 .remove = SYM53C500_detach,
1023 .id_table = sym53c500_ids, 1016 .id_table = sym53c500_ids,
1024 .suspend = sym53c500_suspend, 1017 .suspend = sym53c500_suspend,
1025 .resume = sym53c500_resume, 1018 .resume = sym53c500_resume,