]> err.no Git - linux-2.6/blobdiff - drivers/net/wireless/wl3501_cs.c
[PATCH] pcmcia: unify attach, EVENT_CARD_INSERTION handlers into one probe callback
[linux-2.6] / drivers / net / wireless / wl3501_cs.c
index 21e498fe7b14eff3fb4e3687694677520ffc1360..48e10b0c7e747ede33fe13c5dbd6582511aee870 100644 (file)
@@ -105,7 +105,6 @@ module_param(pc_debug, int, 0);
  */
 static void wl3501_config(dev_link_t *link);
 static void wl3501_release(dev_link_t *link);
-static int wl3501_event(event_t event, int pri, event_callback_args_t *args);
 
 /*
  * The dev_info variable is the "key" that is used to match up this
@@ -1954,18 +1953,16 @@ static const struct iw_handler_def wl3501_handler_def = {
  * The dev_link structure is initialized, but we don't actually configure the
  * card at this point -- we wait until we receive a card insertion event.
  */
-static dev_link_t *wl3501_attach(void)
+static int wl3501_attach(struct pcmcia_device *p_dev)
 {
-       client_reg_t client_reg;
        dev_link_t *link;
        struct net_device *dev;
        struct wl3501_card *this;
-       int ret;
 
        /* Initialize the dev_link_t structure */
        link = kzalloc(sizeof(*link), GFP_KERNEL);
        if (!link)
-               goto out;
+               return -ENOMEM;
 
        /* The io structure describes IO port mapping */
        link->io.NumPorts1      = 16;
@@ -2001,24 +1998,17 @@ static dev_link_t *wl3501_attach(void)
        netif_stop_queue(dev);
        link->priv = link->irq.Instance = dev;
 
-       /* Register with Card Services */
-       link->next               = wl3501_dev_list;
-       wl3501_dev_list          = link;
-       client_reg.dev_info      = &wl3501_dev_info;
-       client_reg.Version       = 0x0210;
-       client_reg.event_callback_args.client_data = link;
-       ret = pcmcia_register_client(&link->handle, &client_reg);
-       if (ret) {
-               cs_error(link->handle, RegisterClient, ret);
-               wl3501_detach(link->handle);
-               link = NULL;
-       }
-out:
-       return link;
+       link->handle = p_dev;
+       p_dev->instance = link;
+
+       link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
+       wl3501_config(link);
+
+       return 0;
 out_link:
        kfree(link);
        link = NULL;
-       goto out;
+       return -ENOMEM;
 }
 
 #define CS_CHECK(fn, ret) \
@@ -2206,33 +2196,6 @@ static int wl3501_resume(struct pcmcia_device *p_dev)
 }
 
 
-/**
- * wl3501_event - The card status event handler
- * @event - event
- * @pri - priority
- * @args - arguments for this event
- *
- * The card status event handler. Mostly, this schedules other stuff to run
- * after an event is received. A CARD_REMOVAL event also sets some flags to
- * discourage the net drivers from trying to talk to the card any more.
- *
- * When a CARD_REMOVAL event is received, we immediately set a flag to block
- * future accesses to this device. All the functions that actually access the
- * device should check this flag to make sure the card is still present.
- */
-static int wl3501_event(event_t event, int pri, event_callback_args_t *args)
-{
-       dev_link_t *link = args->client_data;
-
-       switch (event) {
-       case CS_EVENT_CARD_INSERTION:
-               link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
-               wl3501_config(link);
-               break;
-       }
-       return 0;
-}
-
 static struct pcmcia_device_id wl3501_ids[] = {
        PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0001),
        PCMCIA_DEVICE_NULL
@@ -2244,8 +2207,7 @@ static struct pcmcia_driver wl3501_driver = {
        .drv            = {
                .name   = "wl3501_cs",
        },
-       .attach         = wl3501_attach,
-       .event          = wl3501_event,
+       .probe          = wl3501_attach,
        .remove         = wl3501_detach,
        .id_table       = wl3501_ids,
        .suspend        = wl3501_suspend,