aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pcmcia
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-11-14 15:25:51 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-05 18:03:24 -0500
commitf8cfa618dccbdc6dab5297f75779566a388a98fd (patch)
treeb91e0952038dafc6e03bf8b1d8948b1fdefec031 /drivers/scsi/pcmcia
parentb463581154f3f3eecda27cae60df813fefcd84d3 (diff)
[PATCH] pcmcia: unify attach, EVENT_CARD_INSERTION handlers into one probe callback
Unify the EVENT_CARD_INSERTION and "attach" callbacks to one unified probe() callback. As all in-kernel drivers are changed to this new callback, there will be no temporary backwards-compatibility. Inside a probe() function, each driver _must_ set struct pcmcia_device *p_dev->instance and instance->handle correctly. With these patches, the basic driver interface for 16-bit PCMCIA drivers now has the classic four callbacks known also from other buses: int (*probe) (struct pcmcia_device *dev); void (*remove) (struct pcmcia_device *dev); int (*suspend) (struct pcmcia_device *dev); int (*resume) (struct pcmcia_device *dev); Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/scsi/pcmcia')
-rw-r--r--drivers/scsi/pcmcia/aha152x_stub.c52
-rw-r--r--drivers/scsi/pcmcia/fdomain_stub.c56
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.c67
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.h2
-rw-r--r--drivers/scsi/pcmcia/qlogic_stub.c49
-rw-r--r--drivers/scsi/pcmcia/sym53c500_cs.c53
6 files changed, 51 insertions, 228 deletions
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index 3128ba8c57a9..0c9edb7051f4 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -95,27 +95,21 @@ typedef struct scsi_info_t {
95} scsi_info_t; 95} scsi_info_t;
96 96
97static void aha152x_release_cs(dev_link_t *link); 97static void aha152x_release_cs(dev_link_t *link);
98static int aha152x_event(event_t event, int priority,
99 event_callback_args_t *args);
100
101static dev_link_t *aha152x_attach(void);
102static void aha152x_detach(struct pcmcia_device *p_dev); 98static void aha152x_detach(struct pcmcia_device *p_dev);
99static void aha152x_config_cs(dev_link_t *link);
103 100
104static dev_link_t *dev_list; 101static dev_link_t *dev_list;
105static dev_info_t dev_info = "aha152x_cs";
106 102
107static dev_link_t *aha152x_attach(void) 103static int aha152x_attach(struct pcmcia_device *p_dev)
108{ 104{
109 scsi_info_t *info; 105 scsi_info_t *info;
110 client_reg_t client_reg;
111 dev_link_t *link; 106 dev_link_t *link;
112 int ret;
113 107
114 DEBUG(0, "aha152x_attach()\n"); 108 DEBUG(0, "aha152x_attach()\n");
115 109
116 /* Create new SCSI device */ 110 /* Create new SCSI device */
117 info = kmalloc(sizeof(*info), GFP_KERNEL); 111 info = kmalloc(sizeof(*info), GFP_KERNEL);
118 if (!info) return NULL; 112 if (!info) return -ENOMEM;
119 memset(info, 0, sizeof(*info)); 113 memset(info, 0, sizeof(*info));
120 link = &info->link; link->priv = info; 114 link = &info->link; link->priv = info;
121 115
@@ -129,20 +123,13 @@ static dev_link_t *aha152x_attach(void)
129 link->conf.IntType = INT_MEMORY_AND_IO; 123 link->conf.IntType = INT_MEMORY_AND_IO;
130 link->conf.Present = PRESENT_OPTION; 124 link->conf.Present = PRESENT_OPTION;
131 125
132 /* Register with Card Services */ 126 link->handle = p_dev;
133 link->next = dev_list; 127 p_dev->instance = link;
134 dev_list = link; 128
135 client_reg.dev_info = &dev_info; 129 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
136 client_reg.Version = 0x0210; 130 aha152x_config_cs(link);
137 client_reg.event_callback_args.client_data = link; 131
138 ret = pcmcia_register_client(&link->handle, &client_reg); 132 return 0;
139 if (ret != 0) {
140 cs_error(link->handle, RegisterClient, ret);
141 aha152x_detach(link->handle);
142 return NULL;
143 }
144
145 return link;
146} /* aha152x_attach */ 133} /* aha152x_attach */
147 134
148/*====================================================================*/ 135/*====================================================================*/
@@ -297,22 +284,6 @@ static int aha152x_resume(struct pcmcia_device *dev)
297 return 0; 284 return 0;
298} 285}
299 286
300static int aha152x_event(event_t event, int priority,
301 event_callback_args_t *args)
302{
303 dev_link_t *link = args->client_data;
304
305 DEBUG(0, "aha152x_event(0x%06x)\n", event);
306
307 switch (event) {
308 case CS_EVENT_CARD_INSERTION:
309 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
310 aha152x_config_cs(link);
311 break;
312 }
313 return 0;
314}
315
316static struct pcmcia_device_id aha152x_ids[] = { 287static struct pcmcia_device_id aha152x_ids[] = {
317 PCMCIA_DEVICE_PROD_ID123("New Media", "SCSI", "Bus Toaster", 0xcdf7e4cc, 0x35f26476, 0xa8851d6e), 288 PCMCIA_DEVICE_PROD_ID123("New Media", "SCSI", "Bus Toaster", 0xcdf7e4cc, 0x35f26476, 0xa8851d6e),
318 PCMCIA_DEVICE_PROD_ID123("NOTEWORTHY", "SCSI", "Bus Toaster", 0xad89c6e8, 0x35f26476, 0xa8851d6e), 289 PCMCIA_DEVICE_PROD_ID123("NOTEWORTHY", "SCSI", "Bus Toaster", 0xad89c6e8, 0x35f26476, 0xa8851d6e),
@@ -328,8 +299,7 @@ static struct pcmcia_driver aha152x_cs_driver = {
328 .drv = { 299 .drv = {
329 .name = "aha152x_cs", 300 .name = "aha152x_cs",
330 }, 301 },
331 .attach = aha152x_attach, 302 .probe = aha152x_attach,
332 .event = aha152x_event,
333 .remove = aha152x_detach, 303 .remove = aha152x_detach,
334 .id_table = aha152x_ids, 304 .id_table = aha152x_ids,
335 .suspend = aha152x_suspend, 305 .suspend = aha152x_suspend,
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c
index 538fedb97924..788c58d805f3 100644
--- a/drivers/scsi/pcmcia/fdomain_stub.c
+++ b/drivers/scsi/pcmcia/fdomain_stub.c
@@ -80,27 +80,19 @@ typedef struct scsi_info_t {
80 80
81 81
82static void fdomain_release(dev_link_t *link); 82static void fdomain_release(dev_link_t *link);
83static int fdomain_event(event_t event, int priority,
84 event_callback_args_t *args);
85
86static dev_link_t *fdomain_attach(void);
87static void fdomain_detach(struct pcmcia_device *p_dev); 83static void fdomain_detach(struct pcmcia_device *p_dev);
84static void fdomain_config(dev_link_t *link);
88 85
89 86static int fdomain_attach(struct pcmcia_device *p_dev)
90static dev_info_t dev_info = "fdomain_cs";
91
92static dev_link_t *fdomain_attach(void)
93{ 87{
94 scsi_info_t *info; 88 scsi_info_t *info;
95 client_reg_t client_reg;
96 dev_link_t *link; 89 dev_link_t *link;
97 int ret; 90
98
99 DEBUG(0, "fdomain_attach()\n"); 91 DEBUG(0, "fdomain_attach()\n");
100 92
101 /* Create new SCSI device */ 93 /* Create new SCSI device */
102 info = kmalloc(sizeof(*info), GFP_KERNEL); 94 info = kmalloc(sizeof(*info), GFP_KERNEL);
103 if (!info) return NULL; 95 if (!info) return -ENOMEM;
104 memset(info, 0, sizeof(*info)); 96 memset(info, 0, sizeof(*info));
105 link = &info->link; link->priv = info; 97 link = &info->link; link->priv = info;
106 link->io.NumPorts1 = 0x10; 98 link->io.NumPorts1 = 0x10;
@@ -113,19 +105,13 @@ static dev_link_t *fdomain_attach(void)
113 link->conf.IntType = INT_MEMORY_AND_IO; 105 link->conf.IntType = INT_MEMORY_AND_IO;
114 link->conf.Present = PRESENT_OPTION; 106 link->conf.Present = PRESENT_OPTION;
115 107
116 /* Register with Card Services */ 108 link->handle = p_dev;
117 link->next = NULL; 109 p_dev->instance = link;
118 client_reg.dev_info = &dev_info; 110
119 client_reg.Version = 0x0210; 111 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
120 client_reg.event_callback_args.client_data = link; 112 fdomain_config(link);
121 ret = pcmcia_register_client(&link->handle, &client_reg); 113
122 if (ret != 0) { 114 return 0;
123 cs_error(link->handle, RegisterClient, ret);
124 fdomain_detach(link->handle);
125 return NULL;
126 }
127
128 return link;
129} /* fdomain_attach */ 115} /* fdomain_attach */
130 116
131/*====================================================================*/ 117/*====================================================================*/
@@ -265,23 +251,6 @@ static int fdomain_resume(struct pcmcia_device *dev)
265 return 0; 251 return 0;
266} 252}
267 253
268static int fdomain_event(event_t event, int priority,
269 event_callback_args_t *args)
270{
271 dev_link_t *link = args->client_data;
272
273 DEBUG(1, "fdomain_event(0x%06x)\n", event);
274
275 switch (event) {
276 case CS_EVENT_CARD_INSERTION:
277 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
278 fdomain_config(link);
279 break;
280 }
281 return 0;
282} /* fdomain_event */
283
284
285static struct pcmcia_device_id fdomain_ids[] = { 254static struct pcmcia_device_id fdomain_ids[] = {
286 PCMCIA_DEVICE_PROD_ID12("IBM Corp.", "SCSI PCMCIA Card", 0xe3736c88, 0x859cad20), 255 PCMCIA_DEVICE_PROD_ID12("IBM Corp.", "SCSI PCMCIA Card", 0xe3736c88, 0x859cad20),
287 PCMCIA_DEVICE_PROD_ID1("SCSI PCMCIA Adapter Card", 0x8dacb57e), 256 PCMCIA_DEVICE_PROD_ID1("SCSI PCMCIA Adapter Card", 0x8dacb57e),
@@ -295,8 +264,7 @@ static struct pcmcia_driver fdomain_cs_driver = {
295 .drv = { 264 .drv = {
296 .name = "fdomain_cs", 265 .name = "fdomain_cs",
297 }, 266 },
298 .attach = fdomain_attach, 267 .probe = fdomain_attach,
299 .event = fdomain_event,
300 .remove = fdomain_detach, 268 .remove = fdomain_detach,
301 .id_table = fdomain_ids, 269 .id_table = fdomain_ids,
302 .suspend = fdomain_suspend, 270 .suspend = fdomain_suspend,
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index e48e9fb3c58c..9e3ab3fd5355 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -104,8 +104,6 @@ static struct scsi_host_template nsp_driver_template = {
104#endif 104#endif
105}; 105};
106 106
107static dev_info_t dev_info = {"nsp_cs"};
108
109static nsp_hw_data nsp_data_base; /* attach <-> detect glue */ 107static nsp_hw_data nsp_data_base; /* attach <-> detect glue */
110 108
111 109
@@ -1595,19 +1593,17 @@ static int nsp_eh_host_reset(Scsi_Cmnd *SCpnt)
1595 configure the card at this point -- we wait until we receive a 1593 configure the card at this point -- we wait until we receive a
1596 card insertion event. 1594 card insertion event.
1597======================================================================*/ 1595======================================================================*/
1598static dev_link_t *nsp_cs_attach(void) 1596static int nsp_cs_attach(struct pcmcia_device *p_dev)
1599{ 1597{
1600 scsi_info_t *info; 1598 scsi_info_t *info;
1601 client_reg_t client_reg;
1602 dev_link_t *link; 1599 dev_link_t *link;
1603 int ret;
1604 nsp_hw_data *data = &nsp_data_base; 1600 nsp_hw_data *data = &nsp_data_base;
1605 1601
1606 nsp_dbg(NSP_DEBUG_INIT, "in"); 1602 nsp_dbg(NSP_DEBUG_INIT, "in");
1607 1603
1608 /* Create new SCSI device */ 1604 /* Create new SCSI device */
1609 info = kmalloc(sizeof(*info), GFP_KERNEL); 1605 info = kmalloc(sizeof(*info), GFP_KERNEL);
1610 if (info == NULL) { return NULL; } 1606 if (info == NULL) { return -ENOMEM; }
1611 memset(info, 0, sizeof(*info)); 1607 memset(info, 0, sizeof(*info));
1612 link = &info->link; 1608 link = &info->link;
1613 link->priv = info; 1609 link->priv = info;
@@ -1635,22 +1631,14 @@ static dev_link_t *nsp_cs_attach(void)
1635 link->conf.IntType = INT_MEMORY_AND_IO; 1631 link->conf.IntType = INT_MEMORY_AND_IO;
1636 link->conf.Present = PRESENT_OPTION; 1632 link->conf.Present = PRESENT_OPTION;
1637 1633
1634 link->handle = p_dev;
1635 p_dev->instance = link;
1638 1636
1639 /* Register with Card Services */ 1637 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
1640 link->next = NULL; 1638 nsp_cs_config(link);
1641 client_reg.dev_info = &dev_info;
1642 client_reg.Version = 0x0210;
1643 client_reg.event_callback_args.client_data = link;
1644 ret = pcmcia_register_client(&link->handle, &client_reg);
1645 if (ret != CS_SUCCESS) {
1646 cs_error(link->handle, RegisterClient, ret);
1647 nsp_cs_detach(link->handle);
1648 return NULL;
1649 }
1650
1651 1639
1652 nsp_dbg(NSP_DEBUG_INIT, "link=0x%p", link); 1640 nsp_dbg(NSP_DEBUG_INIT, "link=0x%p", link);
1653 return link; 1641 return 0;
1654} /* nsp_cs_attach */ 1642} /* nsp_cs_attach */
1655 1643
1656 1644
@@ -2056,44 +2044,6 @@ static int nsp_cs_resume(struct pcmcia_device *dev)
2056 return 0; 2044 return 0;
2057} 2045}
2058 2046
2059/*======================================================================
2060
2061 The card status event handler. Mostly, this schedules other
2062 stuff to run after an event is received. A CARD_REMOVAL event
2063 also sets some flags to discourage the net drivers from trying
2064 to talk to the card any more.
2065
2066 When a CARD_REMOVAL event is received, we immediately set a flag
2067 to block future accesses to this device. All the functions that
2068 actually access the device should check this flag to make sure
2069 the card is still present.
2070
2071======================================================================*/
2072static int nsp_cs_event(event_t event,
2073 int priority,
2074 event_callback_args_t *args)
2075{
2076 dev_link_t *link = args->client_data;
2077
2078 nsp_dbg(NSP_DEBUG_INIT, "in, event=0x%08x", event);
2079
2080 switch (event) {
2081 case CS_EVENT_CARD_INSERTION:
2082 nsp_dbg(NSP_DEBUG_INIT, "event: insert");
2083 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
2084#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,68))
2085 info->bus = args->bus;
2086#endif
2087 nsp_cs_config(link);
2088 break;
2089 default:
2090 nsp_dbg(NSP_DEBUG_INIT, "event: unknown");
2091 break;
2092 }
2093 nsp_dbg(NSP_DEBUG_INIT, "end");
2094 return 0;
2095} /* nsp_cs_event */
2096
2097/*======================================================================* 2047/*======================================================================*
2098 * module entry point 2048 * module entry point
2099 *====================================================================*/ 2049 *====================================================================*/
@@ -2115,8 +2065,7 @@ static struct pcmcia_driver nsp_driver = {
2115 .drv = { 2065 .drv = {
2116 .name = "nsp_cs", 2066 .name = "nsp_cs",
2117 }, 2067 },
2118 .attach = nsp_cs_attach, 2068 .probe = nsp_cs_attach,
2119 .event = nsp_cs_event,
2120 .remove = nsp_cs_detach, 2069 .remove = nsp_cs_detach,
2121 .id_table = nsp_cs_ids, 2070 .id_table = nsp_cs_ids,
2122 .suspend = nsp_cs_suspend, 2071 .suspend = nsp_cs_suspend,
diff --git a/drivers/scsi/pcmcia/nsp_cs.h b/drivers/scsi/pcmcia/nsp_cs.h
index d276c469edf1..b66b140a745e 100644
--- a/drivers/scsi/pcmcia/nsp_cs.h
+++ b/drivers/scsi/pcmcia/nsp_cs.h
@@ -296,11 +296,9 @@ typedef struct _nsp_hw_data {
296 */ 296 */
297 297
298/* Card service functions */ 298/* Card service functions */
299static dev_link_t *nsp_cs_attach (void);
300static void nsp_cs_detach (struct pcmcia_device *p_dev); 299static void nsp_cs_detach (struct pcmcia_device *p_dev);
301static void nsp_cs_release(dev_link_t *link); 300static void nsp_cs_release(dev_link_t *link);
302static void nsp_cs_config (dev_link_t *link); 301static void nsp_cs_config (dev_link_t *link);
303static int nsp_cs_event (event_t event, int priority, event_callback_args_t *args);
304 302
305/* Linux SCSI subsystem specific functions */ 303/* Linux SCSI subsystem specific functions */
306static struct Scsi_Host *nsp_detect (struct scsi_host_template *sht); 304static struct Scsi_Host *nsp_detect (struct scsi_host_template *sht);
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c
index e10281a6e5f9..dce7e687fd4a 100644
--- a/drivers/scsi/pcmcia/qlogic_stub.c
+++ b/drivers/scsi/pcmcia/qlogic_stub.c
@@ -98,13 +98,8 @@ typedef struct scsi_info_t {
98} scsi_info_t; 98} scsi_info_t;
99 99
100static void qlogic_release(dev_link_t *link); 100static void qlogic_release(dev_link_t *link);
101static int qlogic_event(event_t event, int priority, event_callback_args_t * args);
102
103static dev_link_t *qlogic_attach(void);
104static void qlogic_detach(struct pcmcia_device *p_dev); 101static void qlogic_detach(struct pcmcia_device *p_dev);
105 102static void qlogic_config(dev_link_t * link);
106
107static dev_info_t dev_info = "qlogic_cs";
108 103
109static struct Scsi_Host *qlogic_detect(struct scsi_host_template *host, 104static struct Scsi_Host *qlogic_detect(struct scsi_host_template *host,
110 dev_link_t *link, int qbase, int qlirq) 105 dev_link_t *link, int qbase, int qlirq)
@@ -161,19 +156,17 @@ free_scsi_host:
161err: 156err:
162 return NULL; 157 return NULL;
163} 158}
164static dev_link_t *qlogic_attach(void) 159static int qlogic_attach(struct pcmcia_device *p_dev)
165{ 160{
166 scsi_info_t *info; 161 scsi_info_t *info;
167 client_reg_t client_reg;
168 dev_link_t *link; 162 dev_link_t *link;
169 int ret;
170 163
171 DEBUG(0, "qlogic_attach()\n"); 164 DEBUG(0, "qlogic_attach()\n");
172 165
173 /* Create new SCSI device */ 166 /* Create new SCSI device */
174 info = kmalloc(sizeof(*info), GFP_KERNEL); 167 info = kmalloc(sizeof(*info), GFP_KERNEL);
175 if (!info) 168 if (!info)
176 return NULL; 169 return -ENOMEM;
177 memset(info, 0, sizeof(*info)); 170 memset(info, 0, sizeof(*info));
178 link = &info->link; 171 link = &info->link;
179 link->priv = info; 172 link->priv = info;
@@ -187,19 +180,13 @@ static dev_link_t *qlogic_attach(void)
187 link->conf.IntType = INT_MEMORY_AND_IO; 180 link->conf.IntType = INT_MEMORY_AND_IO;
188 link->conf.Present = PRESENT_OPTION; 181 link->conf.Present = PRESENT_OPTION;
189 182
190 /* Register with Card Services */ 183 link->handle = p_dev;
191 link->next = NULL; 184 p_dev->instance = link;
192 client_reg.dev_info = &dev_info; 185
193 client_reg.Version = 0x0210; 186 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
194 client_reg.event_callback_args.client_data = link; 187 qlogic_config(link);
195 ret = pcmcia_register_client(&link->handle, &client_reg);
196 if (ret != 0) {
197 cs_error(link->handle, RegisterClient, ret);
198 qlogic_detach(link->handle);
199 return NULL;
200 }
201 188
202 return link; 189 return 0;
203} /* qlogic_attach */ 190} /* qlogic_attach */
204 191
205/*====================================================================*/ 192/*====================================================================*/
@@ -368,21 +355,6 @@ static int qlogic_resume(struct pcmcia_device *dev)
368 return 0; 355 return 0;
369} 356}
370 357
371static int qlogic_event(event_t event, int priority, event_callback_args_t * args)
372{
373 dev_link_t *link = args->client_data;
374
375 DEBUG(1, "qlogic_event(0x%06x)\n", event);
376
377 switch (event) {
378 case CS_EVENT_CARD_INSERTION:
379 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
380 qlogic_config(link);
381 break;
382 }
383 return 0;
384} /* qlogic_event */
385
386static struct pcmcia_device_id qlogic_ids[] = { 358static struct pcmcia_device_id qlogic_ids[] = {
387 PCMCIA_DEVICE_PROD_ID12("EIger Labs", "PCMCIA-to-SCSI Adapter", 0x88395fa7, 0x33b7a5e6), 359 PCMCIA_DEVICE_PROD_ID12("EIger Labs", "PCMCIA-to-SCSI Adapter", 0x88395fa7, 0x33b7a5e6),
388 PCMCIA_DEVICE_PROD_ID12("EPSON", "SCSI-2 PC Card SC200", 0xd361772f, 0x299d1751), 360 PCMCIA_DEVICE_PROD_ID12("EPSON", "SCSI-2 PC Card SC200", 0xd361772f, 0x299d1751),
@@ -410,8 +382,7 @@ static struct pcmcia_driver qlogic_cs_driver = {
410 .drv = { 382 .drv = {
411 .name = "qlogic_cs", 383 .name = "qlogic_cs",
412 }, 384 },
413 .attach = qlogic_attach, 385 .probe = qlogic_attach,
414 .event = qlogic_event,
415 .remove = qlogic_detach, 386 .remove = qlogic_detach,
416 .id_table = qlogic_ids, 387 .id_table = qlogic_ids,
417 .suspend = qlogic_suspend, 388 .suspend = qlogic_suspend,
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index 87d50b33475e..3a4dd6f5b81f 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -228,14 +228,6 @@ enum Phase {
228 228
229/* ================================================================== */ 229/* ================================================================== */
230 230
231/*
232* Global (within this module) variables other than
233* sym53c500_driver_template (the scsi_host_template).
234*/
235static dev_info_t dev_info = "sym53c500_cs";
236
237/* ================================================================== */
238
239static void 231static void
240chip_init(int io_port) 232chip_init(int io_port)
241{ 233{
@@ -909,22 +901,6 @@ static int sym53c500_resume(struct pcmcia_device *dev)
909 return 0; 901 return 0;
910} 902}
911 903
912static int
913SYM53C500_event(event_t event, int priority, event_callback_args_t *args)
914{
915 dev_link_t *link = args->client_data;
916
917 DEBUG(1, "SYM53C500_event(0x%06x)\n", event);
918
919 switch (event) {
920 case CS_EVENT_CARD_INSERTION:
921 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
922 SYM53C500_config(link);
923 break;
924 }
925 return 0;
926} /* SYM53C500_event */
927
928static void 904static void
929SYM53C500_detach(struct pcmcia_device *p_dev) 905SYM53C500_detach(struct pcmcia_device *p_dev)
930{ 906{
@@ -939,20 +915,18 @@ SYM53C500_detach(struct pcmcia_device *p_dev)
939 link->priv = NULL; 915 link->priv = NULL;
940} /* SYM53C500_detach */ 916} /* SYM53C500_detach */
941 917
942static dev_link_t * 918static int
943SYM53C500_attach(void) 919SYM53C500_attach(struct pcmcia_device *p_dev)
944{ 920{
945 struct scsi_info_t *info; 921 struct scsi_info_t *info;
946 client_reg_t client_reg;
947 dev_link_t *link; 922 dev_link_t *link;
948 int ret;
949 923
950 DEBUG(0, "SYM53C500_attach()\n"); 924 DEBUG(0, "SYM53C500_attach()\n");
951 925
952 /* Create new SCSI device */ 926 /* Create new SCSI device */
953 info = kmalloc(sizeof(*info), GFP_KERNEL); 927 info = kmalloc(sizeof(*info), GFP_KERNEL);
954 if (!info) 928 if (!info)
955 return NULL; 929 return -ENOMEM;
956 memset(info, 0, sizeof(*info)); 930 memset(info, 0, sizeof(*info));
957 link = &info->link; 931 link = &info->link;
958 link->priv = info; 932 link->priv = info;
@@ -966,19 +940,13 @@ SYM53C500_attach(void)
966 link->conf.IntType = INT_MEMORY_AND_IO; 940 link->conf.IntType = INT_MEMORY_AND_IO;
967 link->conf.Present = PRESENT_OPTION; 941 link->conf.Present = PRESENT_OPTION;
968 942
969 /* Register with Card Services */ 943 link->handle = p_dev;
970 link->next = NULL; 944 p_dev->instance = link;
971 client_reg.dev_info = &dev_info;
972 client_reg.Version = 0x0210;
973 client_reg.event_callback_args.client_data = link;
974 ret = pcmcia_register_client(&link->handle, &client_reg);
975 if (ret != 0) {
976 cs_error(link->handle, RegisterClient, ret);
977 SYM53C500_detach(link->handle);
978 return NULL;
979 }
980 945
981 return link; 946 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
947 SYM53C500_config(link);
948
949 return 0;
982} /* SYM53C500_attach */ 950} /* SYM53C500_attach */
983 951
984MODULE_AUTHOR("Bob Tracy <rct@frus.com>"); 952MODULE_AUTHOR("Bob Tracy <rct@frus.com>");
@@ -998,8 +966,7 @@ static struct pcmcia_driver sym53c500_cs_driver = {
998 .drv = { 966 .drv = {
999 .name = "sym53c500_cs", 967 .name = "sym53c500_cs",
1000 }, 968 },
1001 .attach = SYM53C500_attach, 969 .probe = SYM53C500_attach,
1002 .event = SYM53C500_event,
1003 .remove = SYM53C500_detach, 970 .remove = SYM53C500_detach,
1004 .id_table = sym53c500_ids, 971 .id_table = sym53c500_ids,
1005 .suspend = sym53c500_suspend, 972 .suspend = sym53c500_suspend,