diff options
Diffstat (limited to 'drivers/scsi/pcmcia/qlogic_stub.c')
-rw-r--r-- | drivers/scsi/pcmcia/qlogic_stub.c | 49 |
1 files changed, 10 insertions, 39 deletions
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 | ||
100 | static void qlogic_release(dev_link_t *link); | 100 | static void qlogic_release(dev_link_t *link); |
101 | static int qlogic_event(event_t event, int priority, event_callback_args_t * args); | ||
102 | |||
103 | static dev_link_t *qlogic_attach(void); | ||
104 | static void qlogic_detach(struct pcmcia_device *p_dev); | 101 | static void qlogic_detach(struct pcmcia_device *p_dev); |
105 | 102 | static void qlogic_config(dev_link_t * link); | |
106 | |||
107 | static dev_info_t dev_info = "qlogic_cs"; | ||
108 | 103 | ||
109 | static struct Scsi_Host *qlogic_detect(struct scsi_host_template *host, | 104 | static 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: | |||
161 | err: | 156 | err: |
162 | return NULL; | 157 | return NULL; |
163 | } | 158 | } |
164 | static dev_link_t *qlogic_attach(void) | 159 | static 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 | ||
371 | static 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 | |||
386 | static struct pcmcia_device_id qlogic_ids[] = { | 358 | static 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, |