diff options
Diffstat (limited to 'drivers/net/pcmcia/com20020_cs.c')
-rw-r--r-- | drivers/net/pcmcia/com20020_cs.c | 59 |
1 files changed, 8 insertions, 51 deletions
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index d48dbd3e153a..2827a48ea37c 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c | |||
@@ -120,12 +120,7 @@ MODULE_LICENSE("GPL"); | |||
120 | 120 | ||
121 | static void com20020_config(dev_link_t *link); | 121 | static void com20020_config(dev_link_t *link); |
122 | static void com20020_release(dev_link_t *link); | 122 | static void com20020_release(dev_link_t *link); |
123 | static int com20020_event(event_t event, int priority, | ||
124 | event_callback_args_t *args); | ||
125 | 123 | ||
126 | static dev_info_t dev_info = "com20020_cs"; | ||
127 | |||
128 | static dev_link_t *com20020_attach(void); | ||
129 | static void com20020_detach(struct pcmcia_device *p_dev); | 124 | static void com20020_detach(struct pcmcia_device *p_dev); |
130 | 125 | ||
131 | /*====================================================================*/ | 126 | /*====================================================================*/ |
@@ -143,21 +138,19 @@ typedef struct com20020_dev_t { | |||
143 | 138 | ||
144 | ======================================================================*/ | 139 | ======================================================================*/ |
145 | 140 | ||
146 | static dev_link_t *com20020_attach(void) | 141 | static int com20020_attach(struct pcmcia_device *p_dev) |
147 | { | 142 | { |
148 | client_reg_t client_reg; | ||
149 | dev_link_t *link; | 143 | dev_link_t *link; |
150 | com20020_dev_t *info; | 144 | com20020_dev_t *info; |
151 | struct net_device *dev; | 145 | struct net_device *dev; |
152 | int ret; | ||
153 | struct arcnet_local *lp; | 146 | struct arcnet_local *lp; |
154 | 147 | ||
155 | DEBUG(0, "com20020_attach()\n"); | 148 | DEBUG(0, "com20020_attach()\n"); |
156 | 149 | ||
157 | /* Create new network device */ | 150 | /* Create new network device */ |
158 | link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); | 151 | link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); |
159 | if (!link) | 152 | if (!link) |
160 | return NULL; | 153 | return -ENOMEM; |
161 | 154 | ||
162 | info = kmalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); | 155 | info = kmalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); |
163 | if (!info) | 156 | if (!info) |
@@ -189,29 +182,19 @@ static dev_link_t *com20020_attach(void) | |||
189 | link->conf.IntType = INT_MEMORY_AND_IO; | 182 | link->conf.IntType = INT_MEMORY_AND_IO; |
190 | link->conf.Present = PRESENT_OPTION; | 183 | link->conf.Present = PRESENT_OPTION; |
191 | 184 | ||
192 | |||
193 | link->irq.Instance = info->dev = dev; | 185 | link->irq.Instance = info->dev = dev; |
194 | link->priv = info; | 186 | link->priv = info; |
195 | 187 | ||
196 | /* Register with Card Services */ | 188 | link->state |= DEV_PRESENT; |
197 | link->next = NULL; | 189 | com20020_config(link); |
198 | client_reg.dev_info = &dev_info; | ||
199 | client_reg.Version = 0x0210; | ||
200 | client_reg.event_callback_args.client_data = link; | ||
201 | ret = pcmcia_register_client(&link->handle, &client_reg); | ||
202 | if (ret != 0) { | ||
203 | cs_error(link->handle, RegisterClient, ret); | ||
204 | com20020_detach(link->handle); | ||
205 | return NULL; | ||
206 | } | ||
207 | 190 | ||
208 | return link; | 191 | return 0; |
209 | 192 | ||
210 | fail_alloc_dev: | 193 | fail_alloc_dev: |
211 | kfree(info); | 194 | kfree(info); |
212 | fail_alloc_info: | 195 | fail_alloc_info: |
213 | kfree(link); | 196 | kfree(link); |
214 | return NULL; | 197 | return -ENOMEM; |
215 | } /* com20020_attach */ | 198 | } /* com20020_attach */ |
216 | 199 | ||
217 | /*====================================================================== | 200 | /*====================================================================== |
@@ -442,31 +425,6 @@ static int com20020_resume(struct pcmcia_device *p_dev) | |||
442 | return 0; | 425 | return 0; |
443 | } | 426 | } |
444 | 427 | ||
445 | /*====================================================================== | ||
446 | |||
447 | The card status event handler. Mostly, this schedules other | ||
448 | stuff to run after an event is received. A CARD_REMOVAL event | ||
449 | also sets some flags to discourage the net drivers from trying | ||
450 | to talk to the card any more. | ||
451 | |||
452 | ======================================================================*/ | ||
453 | |||
454 | static int com20020_event(event_t event, int priority, | ||
455 | event_callback_args_t *args) | ||
456 | { | ||
457 | dev_link_t *link = args->client_data; | ||
458 | |||
459 | DEBUG(1, "com20020_event(0x%06x)\n", event); | ||
460 | |||
461 | switch (event) { | ||
462 | case CS_EVENT_CARD_INSERTION: | ||
463 | link->state |= DEV_PRESENT; | ||
464 | com20020_config(link); | ||
465 | break; | ||
466 | } | ||
467 | return 0; | ||
468 | } /* com20020_event */ | ||
469 | |||
470 | static struct pcmcia_device_id com20020_ids[] = { | 428 | static struct pcmcia_device_id com20020_ids[] = { |
471 | PCMCIA_DEVICE_PROD_ID12("Contemporary Control Systems, Inc.", "PCM20 Arcnet Adapter", 0x59991666, 0x95dfffaf), | 429 | PCMCIA_DEVICE_PROD_ID12("Contemporary Control Systems, Inc.", "PCM20 Arcnet Adapter", 0x59991666, 0x95dfffaf), |
472 | PCMCIA_DEVICE_NULL | 430 | PCMCIA_DEVICE_NULL |
@@ -478,8 +436,7 @@ static struct pcmcia_driver com20020_cs_driver = { | |||
478 | .drv = { | 436 | .drv = { |
479 | .name = "com20020_cs", | 437 | .name = "com20020_cs", |
480 | }, | 438 | }, |
481 | .attach = com20020_attach, | 439 | .probe = com20020_attach, |
482 | .event = com20020_event, | ||
483 | .remove = com20020_detach, | 440 | .remove = com20020_detach, |
484 | .id_table = com20020_ids, | 441 | .id_table = com20020_ids, |
485 | .suspend = com20020_suspend, | 442 | .suspend = com20020_suspend, |