aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/spectrum_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/spectrum_cs.c')
-rw-r--r--drivers/net/wireless/spectrum_cs.c63
1 files changed, 10 insertions, 53 deletions
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c
index 1933250dad1a..fee4be1ce810 100644
--- a/drivers/net/wireless/spectrum_cs.c
+++ b/drivers/net/wireless/spectrum_cs.c
@@ -57,17 +57,6 @@ module_param(ignore_cis_vcc, int, 0);
57MODULE_PARM_DESC(ignore_cis_vcc, "Allow voltage mismatch between card and socket"); 57MODULE_PARM_DESC(ignore_cis_vcc, "Allow voltage mismatch between card and socket");
58 58
59/********************************************************************/ 59/********************************************************************/
60/* Magic constants */
61/********************************************************************/
62
63/*
64 * The dev_info variable is the "key" that is used to match up this
65 * device driver with appropriate cards, through the card
66 * configuration database.
67 */
68static dev_info_t dev_info = DRIVER_NAME;
69
70/********************************************************************/
71/* Data structures */ 60/* Data structures */
72/********************************************************************/ 61/********************************************************************/
73 62
@@ -82,8 +71,8 @@ struct orinoco_pccard {
82/* Function prototypes */ 71/* Function prototypes */
83/********************************************************************/ 72/********************************************************************/
84 73
74static void spectrum_cs_config(dev_link_t *link);
85static void spectrum_cs_release(dev_link_t *link); 75static void spectrum_cs_release(dev_link_t *link);
86static void spectrum_cs_detach(struct pcmcia_device *p_dev);
87 76
88/********************************************************************/ 77/********************************************************************/
89/* Firmware downloader */ 78/* Firmware downloader */
@@ -594,19 +583,17 @@ spectrum_cs_hard_reset(struct orinoco_private *priv)
594 * The dev_link structure is initialized, but we don't actually 583 * The dev_link structure is initialized, but we don't actually
595 * configure the card at this point -- we wait until we receive a card 584 * configure the card at this point -- we wait until we receive a card
596 * insertion event. */ 585 * insertion event. */
597static dev_link_t * 586static int
598spectrum_cs_attach(void) 587spectrum_cs_attach(struct pcmcia_device *p_dev)
599{ 588{
600 struct net_device *dev; 589 struct net_device *dev;
601 struct orinoco_private *priv; 590 struct orinoco_private *priv;
602 struct orinoco_pccard *card; 591 struct orinoco_pccard *card;
603 dev_link_t *link; 592 dev_link_t *link;
604 client_reg_t client_reg;
605 int ret;
606 593
607 dev = alloc_orinocodev(sizeof(*card), spectrum_cs_hard_reset); 594 dev = alloc_orinocodev(sizeof(*card), spectrum_cs_hard_reset);
608 if (! dev) 595 if (! dev)
609 return NULL; 596 return -ENOMEM;
610 priv = netdev_priv(dev); 597 priv = netdev_priv(dev);
611 card = priv->card; 598 card = priv->card;
612 599
@@ -628,22 +615,13 @@ spectrum_cs_attach(void)
628 link->conf.Attributes = 0; 615 link->conf.Attributes = 0;
629 link->conf.IntType = INT_MEMORY_AND_IO; 616 link->conf.IntType = INT_MEMORY_AND_IO;
630 617
631 /* Register with Card Services */ 618 link->handle = p_dev;
632 /* FIXME: need a lock? */ 619 p_dev->instance = link;
633 link->next = NULL; /* not needed */
634 620
635 client_reg.dev_info = &dev_info; 621 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
636 client_reg.Version = 0x0210; /* FIXME: what does this mean? */ 622 spectrum_cs_config(link);
637 client_reg.event_callback_args.client_data = link;
638 623
639 ret = pcmcia_register_client(&link->handle, &client_reg); 624 return 0;
640 if (ret != CS_SUCCESS) {
641 cs_error(link->handle, RegisterClient, ret);
642 spectrum_cs_detach(link->handle);
643 return NULL;
644 }
645
646 return link;
647} /* spectrum_cs_attach */ 625} /* spectrum_cs_attach */
648 626
649/* 627/*
@@ -977,26 +955,6 @@ spectrum_cs_resume(struct pcmcia_device *p_dev)
977 return 0; 955 return 0;
978} 956}
979 957
980/*
981 * The card status event handler. Mostly, this schedules other stuff
982 * to run after an event is received.
983 */
984static int
985spectrum_cs_event(event_t event, int priority,
986 event_callback_args_t * args)
987{
988 dev_link_t *link = args->client_data;
989
990 switch (event) {
991 case CS_EVENT_CARD_INSERTION:
992 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
993 spectrum_cs_config(link);
994 break;
995
996 }
997
998 return 0;
999} /* spectrum_cs_event */
1000 958
1001/********************************************************************/ 959/********************************************************************/
1002/* Module initialization */ 960/* Module initialization */
@@ -1021,11 +979,10 @@ static struct pcmcia_driver orinoco_driver = {
1021 .drv = { 979 .drv = {
1022 .name = DRIVER_NAME, 980 .name = DRIVER_NAME,
1023 }, 981 },
1024 .attach = spectrum_cs_attach, 982 .probe = spectrum_cs_attach,
1025 .remove = spectrum_cs_detach, 983 .remove = spectrum_cs_detach,
1026 .suspend = spectrum_cs_suspend, 984 .suspend = spectrum_cs_suspend,
1027 .resume = spectrum_cs_resume, 985 .resume = spectrum_cs_resume,
1028 .event = spectrum_cs_event,
1029 .id_table = spectrum_cs_ids, 986 .id_table = spectrum_cs_ids,
1030}; 987};
1031 988