libertas: remove ps_supported flag, use fwcapinfo
authorAndrey Yurovsky <andrey@cozybit.com>
Tue, 16 Jun 2009 20:20:01 +0000 (13:20 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 10 Jul 2009 18:57:41 +0000 (14:57 -0400)
Power save support depends on the firmware capabilities rather than the
card's hardware interface.  Use the FW_CAPINFO_PS bit in the firmware
capabilities mask throughout the driver in place of the redundant
ps_supported flag and don't make decisions about PS support in the
interface drivers (with the exception of a special case in the USB
driver).

V2: put the USB special case in the right place.

Signed-off-by: Andrey Yurovsky <andrey@cozybit.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/libertas/dev.h
drivers/net/wireless/libertas/if_cs.c
drivers/net/wireless/libertas/if_sdio.c
drivers/net/wireless/libertas/if_spi.c
drivers/net/wireless/libertas/if_usb.c
drivers/net/wireless/libertas/wext.c

index f9ec69e047340578a82f0967ced3f84d8a6512c2..578c69783589b5d4400fc5cd7eedc93518fe1ccb 100644 (file)
@@ -260,7 +260,6 @@ struct lbs_private {
        u16 psmode;             /* Wlan802_11PowermodeCAM=disable
                                   Wlan802_11PowermodeMAX_PSP=enable */
        u32 psstate;
-       char ps_supported;
        u8 needtowakeup;
 
        struct assoc_request * pending_assoc_req;
index 2a5b083bf9bd5824af70cd7cf3a4f60cfda02ff9..f658fd6a2c0c2590b1f10aa784725cb418b7287e 100644 (file)
@@ -933,9 +933,6 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
                goto out3;
        }
 
-       /* The firmware for the CF card supports powersave */
-       priv->ps_supported = 1;
-
        ret = 0;
        goto out;
 
index 8cdb88c6ca282f91c49b1cb9aeed91021dc005ab..89396a788627b313d54813d48d8aab768690598d 100644 (file)
@@ -1039,9 +1039,6 @@ static int if_sdio_probe(struct sdio_func *func,
        if (ret)
                goto err_activate_card;
 
-       if (priv->fwcapinfo & FW_CAPINFO_PS)
-               priv->ps_supported = 1;
-
 out:
        lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);
 
index 6564282ce4766cb5c022730287430912a4aef884..b213de437ae6179b7f22308a806049cc4a2ee80b 100644 (file)
@@ -1118,7 +1118,6 @@ static int __devinit if_spi_probe(struct spi_device *spi)
        priv->card = card;
        priv->hw_host_to_card = if_spi_host_to_card;
        priv->fw_ready = 1;
-       priv->ps_supported = 1;
 
        /* Initialize interrupt handling stuff. */
        card->run_thread = 1;
index 1844c5adf6e9fb1ad3807f5346174a75654a71c8..92bc8c5f1ca216e337f4897a9b1cdbd44ec3a289 100644 (file)
@@ -181,13 +181,14 @@ static void if_usb_setup_firmware(struct lbs_private *priv)
        wake_method.action = cpu_to_le16(CMD_ACT_GET);
        if (lbs_cmd_with_response(priv, CMD_802_11_FW_WAKE_METHOD, &wake_method)) {
                lbs_pr_info("Firmware does not seem to support PS mode\n");
+               priv->fwcapinfo &= ~FW_CAPINFO_PS;
        } else {
                if (le16_to_cpu(wake_method.method) == CMD_WAKE_METHOD_COMMAND_INT) {
                        lbs_deb_usb("Firmware seems to support PS with wake-via-command\n");
-                       priv->ps_supported = 1;
                } else {
                        /* The versions which boot up this way don't seem to
                           work even if we set it to the command interrupt */
+                       priv->fwcapinfo &= ~FW_CAPINFO_PS;
                        lbs_pr_info("Firmware doesn't wake via command interrupt; disabling PS mode\n");
                }
        }
index 8bc1907458b1f4dd5ac57ff06dbaeaa8faa3cfc8..e96451ce470b5a39966bc80228d759cef5a3c2d9 100644 (file)
@@ -712,7 +712,7 @@ static int lbs_set_power(struct net_device *dev, struct iw_request_info *info,
 
        lbs_deb_enter(LBS_DEB_WEXT);
 
-       if (!priv->ps_supported) {
+       if (!(priv->fwcapinfo & FW_CAPINFO_PS)) {
                if (vwrq->disabled)
                        return 0;
                else