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/hostap | |
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/hostap')
-rw-r--r-- | drivers/net/wireless/hostap/hostap_cs.c | 55 |
1 files changed, 12 insertions, 43 deletions
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index 195a5bf3d725..8bc0b528548f 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -204,8 +204,7 @@ static int hfa384x_to_bap(struct net_device *dev, u16 bap, void *buf, int len) | |||
204 | 204 | ||
205 | static void prism2_detach(struct pcmcia_device *p_dev); | 205 | static void prism2_detach(struct pcmcia_device *p_dev); |
206 | static void prism2_release(u_long arg); | 206 | static void prism2_release(u_long arg); |
207 | static int prism2_event(event_t event, int priority, | 207 | static int prism2_config(dev_link_t *link); |
208 | event_callback_args_t *args); | ||
209 | 208 | ||
210 | 209 | ||
211 | static int prism2_pccard_card_present(local_info_t *local) | 210 | static int prism2_pccard_card_present(local_info_t *local) |
@@ -502,15 +501,13 @@ static struct prism2_helper_functions prism2_pccard_funcs = | |||
502 | 501 | ||
503 | /* allocate local data and register with CardServices | 502 | /* allocate local data and register with CardServices |
504 | * initialize dev_link structure, but do not configure the card yet */ | 503 | * initialize dev_link structure, but do not configure the card yet */ |
505 | static dev_link_t *prism2_attach(void) | 504 | static int prism2_attach(struct pcmcia_device *p_dev) |
506 | { | 505 | { |
507 | dev_link_t *link; | 506 | dev_link_t *link; |
508 | client_reg_t client_reg; | ||
509 | int ret; | ||
510 | 507 | ||
511 | link = kmalloc(sizeof(dev_link_t), GFP_KERNEL); | 508 | link = kmalloc(sizeof(dev_link_t), GFP_KERNEL); |
512 | if (link == NULL) | 509 | if (link == NULL) |
513 | return NULL; | 510 | return -ENOMEM; |
514 | 511 | ||
515 | memset(link, 0, sizeof(dev_link_t)); | 512 | memset(link, 0, sizeof(dev_link_t)); |
516 | 513 | ||
@@ -518,18 +515,14 @@ static dev_link_t *prism2_attach(void) | |||
518 | link->conf.Vcc = 33; | 515 | link->conf.Vcc = 33; |
519 | link->conf.IntType = INT_MEMORY_AND_IO; | 516 | link->conf.IntType = INT_MEMORY_AND_IO; |
520 | 517 | ||
521 | /* register with CardServices */ | 518 | link->handle = p_dev; |
522 | link->next = NULL; | 519 | p_dev->instance = link; |
523 | client_reg.dev_info = &dev_info; | 520 | |
524 | client_reg.Version = 0x0210; | 521 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
525 | client_reg.event_callback_args.client_data = link; | 522 | if (prism2_config(link)) |
526 | ret = pcmcia_register_client(&link->handle, &client_reg); | 523 | PDEBUG(DEBUG_EXTRA, "prism2_config() failed\n"); |
527 | if (ret != CS_SUCCESS) { | 524 | |
528 | cs_error(link->handle, RegisterClient, ret); | 525 | return 0; |
529 | prism2_detach(link->handle); | ||
530 | return NULL; | ||
531 | } | ||
532 | return link; | ||
533 | } | 526 | } |
534 | 527 | ||
535 | 528 | ||
@@ -878,29 +871,6 @@ static int hostap_cs_resume(struct pcmcia_device *p_dev) | |||
878 | return 0; | 871 | return 0; |
879 | } | 872 | } |
880 | 873 | ||
881 | static int prism2_event(event_t event, int priority, | ||
882 | event_callback_args_t *args) | ||
883 | { | ||
884 | dev_link_t *link = args->client_data; | ||
885 | |||
886 | switch (event) { | ||
887 | case CS_EVENT_CARD_INSERTION: | ||
888 | PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_CARD_INSERTION\n", dev_info); | ||
889 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
890 | if (prism2_config(link)) { | ||
891 | PDEBUG(DEBUG_EXTRA, "prism2_config() failed\n"); | ||
892 | } | ||
893 | break; | ||
894 | |||
895 | default: | ||
896 | PDEBUG(DEBUG_EXTRA, "%s: prism2_event() - unknown event %d\n", | ||
897 | dev_info, event); | ||
898 | break; | ||
899 | } | ||
900 | return 0; | ||
901 | } | ||
902 | |||
903 | |||
904 | static struct pcmcia_device_id hostap_cs_ids[] = { | 874 | static struct pcmcia_device_id hostap_cs_ids[] = { |
905 | PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100), | 875 | PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100), |
906 | PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), | 876 | PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), |
@@ -959,10 +929,9 @@ static struct pcmcia_driver hostap_driver = { | |||
959 | .drv = { | 929 | .drv = { |
960 | .name = "hostap_cs", | 930 | .name = "hostap_cs", |
961 | }, | 931 | }, |
962 | .attach = prism2_attach, | 932 | .probe = prism2_attach, |
963 | .remove = prism2_detach, | 933 | .remove = prism2_detach, |
964 | .owner = THIS_MODULE, | 934 | .owner = THIS_MODULE, |
965 | .event = prism2_event, | ||
966 | .id_table = hostap_cs_ids, | 935 | .id_table = hostap_cs_ids, |
967 | .suspend = hostap_cs_suspend, | 936 | .suspend = hostap_cs_suspend, |
968 | .resume = hostap_cs_resume, | 937 | .resume = hostap_cs_resume, |