aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/orinoco_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/orinoco_cs.c')
-rw-r--r--drivers/net/wireless/orinoco_cs.c58
1 files changed, 10 insertions, 48 deletions
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
index bfeeef49f0b3..b664708481cc 100644
--- a/drivers/net/wireless/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco_cs.c
@@ -43,17 +43,6 @@ module_param(ignore_cis_vcc, int, 0);
43MODULE_PARM_DESC(ignore_cis_vcc, "Allow voltage mismatch between card and socket"); 43MODULE_PARM_DESC(ignore_cis_vcc, "Allow voltage mismatch between card and socket");
44 44
45/********************************************************************/ 45/********************************************************************/
46/* Magic constants */
47/********************************************************************/
48
49/*
50 * The dev_info variable is the "key" that is used to match up this
51 * device driver with appropriate cards, through the card
52 * configuration database.
53 */
54static dev_info_t dev_info = DRIVER_NAME;
55
56/********************************************************************/
57/* Data structures */ 46/* Data structures */
58/********************************************************************/ 47/********************************************************************/
59 48
@@ -74,6 +63,7 @@ struct orinoco_pccard {
74/* Function prototypes */ 63/* Function prototypes */
75/********************************************************************/ 64/********************************************************************/
76 65
66static void orinoco_cs_config(dev_link_t *link);
77static void orinoco_cs_release(dev_link_t *link); 67static void orinoco_cs_release(dev_link_t *link);
78static void orinoco_cs_detach(struct pcmcia_device *p_dev); 68static void orinoco_cs_detach(struct pcmcia_device *p_dev);
79 69
@@ -113,19 +103,17 @@ orinoco_cs_hard_reset(struct orinoco_private *priv)
113 * The dev_link structure is initialized, but we don't actually 103 * The dev_link structure is initialized, but we don't actually
114 * configure the card at this point -- we wait until we receive a card 104 * configure the card at this point -- we wait until we receive a card
115 * insertion event. */ 105 * insertion event. */
116static dev_link_t * 106static int
117orinoco_cs_attach(void) 107orinoco_cs_attach(struct pcmcia_device *p_dev)
118{ 108{
119 struct net_device *dev; 109 struct net_device *dev;
120 struct orinoco_private *priv; 110 struct orinoco_private *priv;
121 struct orinoco_pccard *card; 111 struct orinoco_pccard *card;
122 dev_link_t *link; 112 dev_link_t *link;
123 client_reg_t client_reg;
124 int ret;
125 113
126 dev = alloc_orinocodev(sizeof(*card), orinoco_cs_hard_reset); 114 dev = alloc_orinocodev(sizeof(*card), orinoco_cs_hard_reset);
127 if (! dev) 115 if (! dev)
128 return NULL; 116 return -ENOMEM;
129 priv = netdev_priv(dev); 117 priv = netdev_priv(dev);
130 card = priv->card; 118 card = priv->card;
131 119
@@ -150,18 +138,13 @@ orinoco_cs_attach(void)
150 /* Register with Card Services */ 138 /* Register with Card Services */
151 link->next = NULL; 139 link->next = NULL;
152 140
153 client_reg.dev_info = &dev_info; 141 link->handle = p_dev;
154 client_reg.Version = 0x0210; /* FIXME: what does this mean? */ 142 p_dev->instance = link;
155 client_reg.event_callback_args.client_data = link;
156 143
157 ret = pcmcia_register_client(&link->handle, &client_reg); 144 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
158 if (ret != CS_SUCCESS) { 145 orinoco_cs_config(link);
159 cs_error(link->handle, RegisterClient, ret);
160 orinoco_cs_detach(link->handle);
161 return NULL;
162 }
163 146
164 return link; 147 return 0;
165} /* orinoco_cs_attach */ 148} /* orinoco_cs_attach */
166 149
167/* 150/*
@@ -521,26 +504,6 @@ static int orinoco_cs_resume(struct pcmcia_device *p_dev)
521} 504}
522 505
523 506
524/*
525 * The card status event handler. Mostly, this schedules other stuff
526 * to run after an event is received.
527 */
528static int
529orinoco_cs_event(event_t event, int priority,
530 event_callback_args_t * args)
531{
532 dev_link_t *link = args->client_data;
533
534 switch (event) {
535 case CS_EVENT_CARD_INSERTION:
536 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
537 orinoco_cs_config(link);
538 break;
539 }
540
541 return 0;
542} /* orinoco_cs_event */
543
544/********************************************************************/ 507/********************************************************************/
545/* Module initialization */ 508/* Module initialization */
546/********************************************************************/ 509/********************************************************************/
@@ -640,9 +603,8 @@ static struct pcmcia_driver orinoco_driver = {
640 .drv = { 603 .drv = {
641 .name = DRIVER_NAME, 604 .name = DRIVER_NAME,
642 }, 605 },
643 .attach = orinoco_cs_attach, 606 .probe = orinoco_cs_attach,
644 .remove = orinoco_cs_detach, 607 .remove = orinoco_cs_detach,
645 .event = orinoco_cs_event,
646 .id_table = orinoco_cs_ids, 608 .id_table = orinoco_cs_ids,
647 .suspend = orinoco_cs_suspend, 609 .suspend = orinoco_cs_suspend,
648 .resume = orinoco_cs_resume, 610 .resume = orinoco_cs_resume,