diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2005-11-14 15:25:51 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-01-05 18:03:24 -0500 |
commit | f8cfa618dccbdc6dab5297f75779566a388a98fd (patch) | |
tree | b91e0952038dafc6e03bf8b1d8948b1fdefec031 /drivers/net/wireless/orinoco_cs.c | |
parent | b463581154f3f3eecda27cae60df813fefcd84d3 (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/net/wireless/orinoco_cs.c')
-rw-r--r-- | drivers/net/wireless/orinoco_cs.c | 58 |
1 files changed, 10 insertions, 48 deletions
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index bfeeef49f0b..b664708481c 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); | |||
43 | MODULE_PARM_DESC(ignore_cis_vcc, "Allow voltage mismatch between card and socket"); | 43 | MODULE_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 | */ | ||
54 | static 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 | ||
66 | static void orinoco_cs_config(dev_link_t *link); | ||
77 | static void orinoco_cs_release(dev_link_t *link); | 67 | static void orinoco_cs_release(dev_link_t *link); |
78 | static void orinoco_cs_detach(struct pcmcia_device *p_dev); | 68 | static 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. */ |
116 | static dev_link_t * | 106 | static int |
117 | orinoco_cs_attach(void) | 107 | orinoco_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 | */ | ||
528 | static int | ||
529 | orinoco_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, |