diff options
Diffstat (limited to 'drivers/net/wireless/airo_cs.c')
-rw-r--r-- | drivers/net/wireless/airo_cs.c | 74 |
1 files changed, 13 insertions, 61 deletions
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 88805a4c29f1..a496460ce224 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c | |||
@@ -82,8 +82,6 @@ MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340 PCMCIA cards"); | |||
82 | 82 | ||
83 | static void airo_config(dev_link_t *link); | 83 | static void airo_config(dev_link_t *link); |
84 | static void airo_release(dev_link_t *link); | 84 | static void airo_release(dev_link_t *link); |
85 | static int airo_event(event_t event, int priority, | ||
86 | event_callback_args_t *args); | ||
87 | 85 | ||
88 | /* | 86 | /* |
89 | The attach() and detach() entry points are used to create and destroy | 87 | The attach() and detach() entry points are used to create and destroy |
@@ -91,7 +89,6 @@ static int airo_event(event_t event, int priority, | |||
91 | needed to manage one actual PCMCIA card. | 89 | needed to manage one actual PCMCIA card. |
92 | */ | 90 | */ |
93 | 91 | ||
94 | static dev_link_t *airo_attach(void); | ||
95 | static void airo_detach(struct pcmcia_device *p_dev); | 92 | static void airo_detach(struct pcmcia_device *p_dev); |
96 | 93 | ||
97 | /* | 94 | /* |
@@ -102,14 +99,6 @@ static void airo_detach(struct pcmcia_device *p_dev); | |||
102 | */ | 99 | */ |
103 | 100 | ||
104 | /* | 101 | /* |
105 | The dev_info variable is the "key" that is used to match up this | ||
106 | device driver with appropriate cards, through the card configuration | ||
107 | database. | ||
108 | */ | ||
109 | |||
110 | static dev_info_t dev_info = "airo_cs"; | ||
111 | |||
112 | /* | ||
113 | A linked list of "instances" of the aironet device. Each actual | 102 | A linked list of "instances" of the aironet device. Each actual |
114 | PCMCIA card corresponds to one device instance, and is described | 103 | PCMCIA card corresponds to one device instance, and is described |
115 | by one dev_link_t structure (defined in ds.h). | 104 | by one dev_link_t structure (defined in ds.h). |
@@ -152,20 +141,18 @@ typedef struct local_info_t { | |||
152 | 141 | ||
153 | ======================================================================*/ | 142 | ======================================================================*/ |
154 | 143 | ||
155 | static dev_link_t *airo_attach(void) | 144 | static int airo_attach(struct pcmcia_device *p_dev) |
156 | { | 145 | { |
157 | client_reg_t client_reg; | ||
158 | dev_link_t *link; | 146 | dev_link_t *link; |
159 | local_info_t *local; | 147 | local_info_t *local; |
160 | int ret; | 148 | |
161 | |||
162 | DEBUG(0, "airo_attach()\n"); | 149 | DEBUG(0, "airo_attach()\n"); |
163 | 150 | ||
164 | /* Initialize the dev_link_t structure */ | 151 | /* Initialize the dev_link_t structure */ |
165 | link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); | 152 | link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); |
166 | if (!link) { | 153 | if (!link) { |
167 | printk(KERN_ERR "airo_cs: no memory for new device\n"); | 154 | printk(KERN_ERR "airo_cs: no memory for new device\n"); |
168 | return NULL; | 155 | return -ENOMEM; |
169 | } | 156 | } |
170 | 157 | ||
171 | /* Interrupt setup */ | 158 | /* Interrupt setup */ |
@@ -189,23 +176,17 @@ static dev_link_t *airo_attach(void) | |||
189 | if (!local) { | 176 | if (!local) { |
190 | printk(KERN_ERR "airo_cs: no memory for new device\n"); | 177 | printk(KERN_ERR "airo_cs: no memory for new device\n"); |
191 | kfree (link); | 178 | kfree (link); |
192 | return NULL; | 179 | return -ENOMEM; |
193 | } | 180 | } |
194 | link->priv = local; | 181 | link->priv = local; |
195 | 182 | ||
196 | /* Register with Card Services */ | 183 | link->handle = p_dev; |
197 | link->next = NULL; | 184 | p_dev->instance = link; |
198 | client_reg.dev_info = &dev_info; | 185 | |
199 | client_reg.Version = 0x0210; | 186 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
200 | client_reg.event_callback_args.client_data = link; | 187 | airo_config(link); |
201 | ret = pcmcia_register_client(&link->handle, &client_reg); | 188 | |
202 | if (ret != 0) { | 189 | return 0; |
203 | cs_error(link->handle, RegisterClient, ret); | ||
204 | airo_detach(link->handle); | ||
205 | return NULL; | ||
206 | } | ||
207 | |||
208 | return link; | ||
209 | } /* airo_attach */ | 190 | } /* airo_attach */ |
210 | 191 | ||
211 | /*====================================================================== | 192 | /*====================================================================== |
@@ -497,34 +478,6 @@ static int airo_resume(struct pcmcia_device *p_dev) | |||
497 | return 0; | 478 | return 0; |
498 | } | 479 | } |
499 | 480 | ||
500 | /*====================================================================== | ||
501 | |||
502 | The card status event handler. Mostly, this schedules other | ||
503 | stuff to run after an event is received. | ||
504 | |||
505 | When a CARD_REMOVAL event is received, we immediately set a | ||
506 | private flag to block future accesses to this device. All the | ||
507 | functions that actually access the device should check this flag | ||
508 | to make sure the card is still present. | ||
509 | |||
510 | ======================================================================*/ | ||
511 | |||
512 | static int airo_event(event_t event, int priority, | ||
513 | event_callback_args_t *args) | ||
514 | { | ||
515 | dev_link_t *link = args->client_data; | ||
516 | |||
517 | DEBUG(1, "airo_event(0x%06x)\n", event); | ||
518 | |||
519 | switch (event) { | ||
520 | case CS_EVENT_CARD_INSERTION: | ||
521 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
522 | airo_config(link); | ||
523 | break; | ||
524 | } | ||
525 | return 0; | ||
526 | } /* airo_event */ | ||
527 | |||
528 | static struct pcmcia_device_id airo_ids[] = { | 481 | static struct pcmcia_device_id airo_ids[] = { |
529 | PCMCIA_DEVICE_MANF_CARD(0x015f, 0x000a), | 482 | PCMCIA_DEVICE_MANF_CARD(0x015f, 0x000a), |
530 | PCMCIA_DEVICE_MANF_CARD(0x015f, 0x0005), | 483 | PCMCIA_DEVICE_MANF_CARD(0x015f, 0x0005), |
@@ -539,8 +492,7 @@ static struct pcmcia_driver airo_driver = { | |||
539 | .drv = { | 492 | .drv = { |
540 | .name = "airo_cs", | 493 | .name = "airo_cs", |
541 | }, | 494 | }, |
542 | .attach = airo_attach, | 495 | .probe = airo_attach, |
543 | .event = airo_event, | ||
544 | .remove = airo_detach, | 496 | .remove = airo_detach, |
545 | .id_table = airo_ids, | 497 | .id_table = airo_ids, |
546 | .suspend = airo_suspend, | 498 | .suspend = airo_suspend, |