aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/wireless/libertas/if_cs.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-08-20 11:43:25 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 16:50:34 -0700
commit954ee164f4f4598afc172c0ec3865d0352e55a0b (patch)
tree51aae73210d22c0a91282a52b5198cfa1ad068b4 /drivers/net/wireless/libertas/if_cs.c
parentb1b1907dceadddc7d7317f8ae85a5efec44125d8 (diff)
[PATCH] libertas: reorganize and simplify init sequence
This patch moves all firmware load responsibility into the interface-specific code and gets rid of the firmware pointer in the generic card structure. It also removes 3 fairly unecessary callbacks: hw_register_dev, hw_unregister_dev, and hw_prog_firmware. It also makes the init sequence from interface probe functions more logical, as there are paired add/remove and start/stop calls into generic libertas code. Because the USB driver code uses the same TX URB callback for both firmware upload (where the generic libertas structure isn't initialized yet) and for normal operation (where it is), some bits of USB code have to deal with 'priv' being NULL. All USB firmware upload bits have been changed to not require 'priv' at all, but simply the USB card structure. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/if_cs.c')
-rw-r--r--drivers/net/wireless/libertas/if_cs.c54
1 files changed, 5 insertions, 49 deletions
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index 888f023a74e..4dffc5cc0d1 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -608,51 +608,6 @@ done:
/* Callback functions for libertas.ko */
/********************************************************************/
-static int if_cs_register_dev(wlan_private *priv)
-{
- struct if_cs_card *card = (struct if_cs_card *)priv->card;
-
- lbs_deb_enter(LBS_DEB_CS);
-
- card->priv = priv;
-
- return 0;
-}
-
-
-static int if_cs_unregister_dev(wlan_private *priv)
-{
- lbs_deb_enter(LBS_DEB_CS);
-
- /*
- * Nothing special here. Because the device's power gets turned off
- * anyway, there's no need to send a RESET command like in if_usb.c
- */
-
- return 0;
-}
-
-
-/*
- * This callback is a dummy. The reason is that the USB code needs
- * to have various things set up in order to be able to download the
- * firmware. That's not needed in our case.
- *
- * On the contrary, if libertas_add_card() has been called and we're
- * then later called via libertas_activate_card(), but without a valid
- * firmware, then it's quite tedious to tear down the half-installed
- * card. Therefore, we download the firmware before calling adding/
- * activating the card in the first place. If that doesn't work, we
- * won't call into libertas.ko at all.
- */
-
-static int if_cs_prog_firmware(wlan_private *priv)
-{
- priv->adapter->fw_ready = 1;
- return 0;
-}
-
-
/* Send commands or data packets to the card */
static int if_cs_host_to_card(wlan_private *priv, u8 type, u8 *buf, u16 nb)
{
@@ -902,14 +857,14 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
}
/* Store pointers to our call-back functions */
+ card->priv = priv;
priv->card = card;
- priv->hw_register_dev = if_cs_register_dev;
- priv->hw_unregister_dev = if_cs_unregister_dev;
- priv->hw_prog_firmware = if_cs_prog_firmware;
priv->hw_host_to_card = if_cs_host_to_card;
priv->hw_get_int_status = if_cs_get_int_status;
priv->hw_read_event_cause = if_cs_read_event_cause;
+ priv->adapter->fw_ready = 1;
+
/* Now actually get the IRQ */
ret = request_irq(p_dev->irq.AssignedIRQ, if_cs_interrupt,
IRQF_SHARED, DRV_NAME, card);
@@ -919,7 +874,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
}
/* And finally bring the card up */
- if (libertas_activate_card(priv) != 0) {
+ if (libertas_start_card(priv) != 0) {
lbs_pr_err("could not activate card\n");
goto out3;
}
@@ -951,6 +906,7 @@ static void if_cs_detach(struct pcmcia_device *p_dev)
lbs_deb_enter(LBS_DEB_CS);
+ libertas_stop_card(card->priv);
libertas_remove_card(card->priv);
if_cs_release(p_dev);
kfree(card);