brcmfmac: use msecs_to_jiffies() in macro definitions
authorArend van Spriel <arend@broadcom.com>
Tue, 5 Jan 2016 10:05:48 +0000 (11:05 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 8 Jan 2016 08:44:43 +0000 (10:44 +0200)
Instead to having macro definition for millisecond timeout have
the definition directly in jiffies. This makes the unit of the
value immediately clear and may result in code that is bit more
compact.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c

index c9657be3d4c30ee40545cd97b7748098c062c38b..84788ea9e39e5aad196c7ee247c1412d637f8748 100644 (file)
@@ -568,7 +568,7 @@ struct wireless_dev *brcmf_ap_add_vif(struct wiphy *wiphy, const char *name,
 
        /* wait for firmware event */
        err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_ADD,
-                                                   msecs_to_jiffies(1500));
+                                                   BRCMF_VIF_EVENT_TIMEOUT);
        brcmf_cfg80211_arm_vif_event(cfg, NULL);
        if (!err) {
                brcmf_err("timeout occurred\n");
index 69af708b43f5afad69394d0ecbef4ad9e3b19965..40efb539ac26b233cb3888f23dd2083ffdd2dd60 100644 (file)
@@ -75,6 +75,8 @@
 #define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON      2
 #define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_OFF     4
 
+#define BRCMF_VIF_EVENT_TIMEOUT                msecs_to_jiffies(1500)
+
 /**
  * enum brcmf_scan_status - scan engine status
  *
index 7c75b1acdf00d3d059b5d272dcb1b73469c1f721..ed9998b69709ace269c103c14605b4c18d45f472 100644 (file)
@@ -40,7 +40,7 @@ MODULE_AUTHOR("Broadcom Corporation");
 MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
 MODULE_LICENSE("Dual BSD/GPL");
 
-#define MAX_WAIT_FOR_8021X_TX          50      /* msecs */
+#define MAX_WAIT_FOR_8021X_TX                  msecs_to_jiffies(50)
 
 /* AMPDU rx reordering definitions */
 #define BRCMF_RXREORDER_FLOWID_OFFSET          0
@@ -1282,7 +1282,7 @@ int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp)
 
        err = wait_event_timeout(ifp->pend_8021x_wait,
                                 !brcmf_get_pend_8021x_cnt(ifp),
-                                msecs_to_jiffies(MAX_WAIT_FOR_8021X_TX));
+                                MAX_WAIT_FOR_8021X_TX);
 
        WARN_ON(!err);
 
index 5df91386e13a62bbee271edc5499cc930235a955..c2bdb91746cf8eb0fded26afff5e1b22273e73d6 100644 (file)
@@ -34,7 +34,7 @@
 #include "tracepoint.h"
 
 
-#define MSGBUF_IOCTL_RESP_TIMEOUT              2000
+#define MSGBUF_IOCTL_RESP_TIMEOUT              msecs_to_jiffies(2000)
 
 #define MSGBUF_TYPE_GEN_STATUS                 0x1
 #define MSGBUF_TYPE_RING_STATUS                        0x2
@@ -466,7 +466,7 @@ static int brcmf_msgbuf_ioctl_resp_wait(struct brcmf_msgbuf *msgbuf)
 {
        return wait_event_timeout(msgbuf->ioctl_resp_wait,
                                  msgbuf->ctl_completed,
-                                 msecs_to_jiffies(MSGBUF_IOCTL_RESP_TIMEOUT));
+                                 MSGBUF_IOCTL_RESP_TIMEOUT);
 }
 
 
index b23dcbcd505e8ddbd039a804969e1129b1fef379..821b6494f9d11031708153998c1767a88c0b298c 100644 (file)
 #define P2P_AF_MED_DWELL_TIME          400
 #define P2P_AF_LONG_DWELL_TIME         1000
 #define P2P_AF_TX_MAX_RETRY            1
-#define P2P_AF_MAX_WAIT_TIME           2000
+#define P2P_AF_MAX_WAIT_TIME           msecs_to_jiffies(2000)
 #define P2P_INVALID_CHANNEL            -1
 #define P2P_CHANNEL_SYNC_RETRY         5
-#define P2P_AF_FRM_SCAN_MAX_WAIT       1500
+#define P2P_AF_FRM_SCAN_MAX_WAIT       msecs_to_jiffies(1500)
 #define P2P_DEFAULT_SLEEP_TIME_VSDB    200
 
 /* WiFi P2P Public Action Frame OUI Subtypes */
 #define P2PSD_ACTION_ID_GAS_CREQ       0x0c    /* GAS Comback Request AF */
 #define P2PSD_ACTION_ID_GAS_CRESP      0x0d    /* GAS Comback Response AF */
 
+#define BRCMF_P2P_DISABLE_TIMEOUT      msecs_to_jiffies(500)
 /**
  * struct brcmf_p2p_disc_st_le - set discovery state in firmware.
  *
@@ -1514,7 +1515,7 @@ static s32 brcmf_p2p_tx_action_frame(struct brcmf_p2p_info *p2p,
        p2p->af_tx_sent_jiffies = jiffies;
 
        timeout = wait_for_completion_timeout(&p2p->send_af_done,
-                                       msecs_to_jiffies(P2P_AF_MAX_WAIT_TIME));
+                                             P2P_AF_MAX_WAIT_TIME);
 
        if (test_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, &p2p->status)) {
                brcmf_dbg(TRACE, "TX action frame operation is success\n");
@@ -1988,7 +1989,7 @@ int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg,
                return err;
        }
        err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_CHANGE,
-                                                   msecs_to_jiffies(1500));
+                                                   BRCMF_VIF_EVENT_TIMEOUT);
        brcmf_cfg80211_arm_vif_event(cfg, NULL);
        if (!err)  {
                brcmf_err("No BRCMF_E_IF_CHANGE event received\n");
@@ -2090,7 +2091,7 @@ static struct wireless_dev *brcmf_p2p_create_p2pdev(struct brcmf_p2p_info *p2p,
 
        /* wait for firmware event */
        err = brcmf_cfg80211_wait_vif_event_timeout(p2p->cfg, BRCMF_E_IF_ADD,
-                                                   msecs_to_jiffies(1500));
+                                                   BRCMF_VIF_EVENT_TIMEOUT);
        brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL);
        brcmf_fweh_p2pdev_setup(pri_ifp, false);
        if (!err) {
@@ -2180,7 +2181,7 @@ struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name,
 
        /* wait for firmware event */
        err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_ADD,
-                                                   msecs_to_jiffies(1500));
+                                                   BRCMF_VIF_EVENT_TIMEOUT);
        brcmf_cfg80211_arm_vif_event(cfg, NULL);
        if (!err) {
                brcmf_err("timeout occurred\n");
@@ -2230,7 +2231,6 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev)
        struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
        struct brcmf_p2p_info *p2p = &cfg->p2p;
        struct brcmf_cfg80211_vif *vif;
-       unsigned long jiffie_timeout = msecs_to_jiffies(1500);
        bool wait_for_disable = false;
        int err;
 
@@ -2263,7 +2263,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev)
 
        if (wait_for_disable)
                wait_for_completion_timeout(&cfg->vif_disabled,
-                                           msecs_to_jiffies(500));
+                                           BRCMF_P2P_DISABLE_TIMEOUT);
 
        err = 0;
        if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE) {
@@ -2273,7 +2273,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev)
        if (!err) {
                /* wait for firmware event */
                err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_DEL,
-                                                           jiffie_timeout);
+                                                       BRCMF_VIF_EVENT_TIMEOUT);
                if (!err)
                        err = -EIO;
                else
index 3d2d790d3ad62f0c39752a01b2b408a60255bdbd..0480b70e3eb84b5b5e627dc022a9589455f85b4d 100644 (file)
@@ -191,7 +191,7 @@ static struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
 #define BRCMF_H2D_HOST_D0_INFORM_IN_USE                0x00000008
 #define BRCMF_H2D_HOST_D0_INFORM               0x00000010
 
-#define BRCMF_PCIE_MBDATA_TIMEOUT              2000
+#define BRCMF_PCIE_MBDATA_TIMEOUT              msecs_to_jiffies(2000)
 
 #define BRCMF_PCIE_CFGREG_STATUS_CMD           0x4
 #define BRCMF_PCIE_CFGREG_PM_CSR               0x4C
@@ -1885,9 +1885,8 @@ static int brcmf_pcie_pm_enter_D3(struct device *dev)
        devinfo->mbdata_completed = false;
        brcmf_pcie_send_mb_data(devinfo, BRCMF_H2D_HOST_D3_INFORM);
 
-       wait_event_timeout(devinfo->mbdata_resp_wait,
-                          devinfo->mbdata_completed,
-                          msecs_to_jiffies(BRCMF_PCIE_MBDATA_TIMEOUT));
+       wait_event_timeout(devinfo->mbdata_resp_wait, devinfo->mbdata_completed,
+                          BRCMF_PCIE_MBDATA_TIMEOUT);
        if (!devinfo->mbdata_completed) {
                brcmf_err("Timeout on response for entering D3 substate\n");
                return -EIO;
index 2f020201945c78e118837140376847088f28d382..dd6614332836a86443e505d9ee6394ec26ccfb6b 100644 (file)
@@ -45,8 +45,8 @@
 #include "chip.h"
 #include "firmware.h"
 
-#define DCMD_RESP_TIMEOUT      2000    /* In milli second */
-#define CTL_DONE_TIMEOUT       2000    /* In milli second */
+#define DCMD_RESP_TIMEOUT      msecs_to_jiffies(2000)
+#define CTL_DONE_TIMEOUT       msecs_to_jiffies(2000)
 
 #ifdef DEBUG
 
@@ -1657,7 +1657,7 @@ static int brcmf_sdio_dcmd_resp_wait(struct brcmf_sdio *bus, uint *condition,
                                     bool *pending)
 {
        DECLARE_WAITQUEUE(wait, current);
-       int timeout = msecs_to_jiffies(DCMD_RESP_TIMEOUT);
+       int timeout = DCMD_RESP_TIMEOUT;
 
        /* Wait until control frame is available */
        add_wait_queue(&bus->dcmd_resp_wait, &wait);
@@ -2842,7 +2842,7 @@ brcmf_sdio_bus_txctl(struct device *dev, unsigned char *msg, uint msglen)
 
        brcmf_sdio_trigger_dpc(bus);
        wait_event_interruptible_timeout(bus->ctrl_wait, !bus->ctrl_frame_stat,
-                                        msecs_to_jiffies(CTL_DONE_TIMEOUT));
+                                        CTL_DONE_TIMEOUT);
        ret = 0;
        if (bus->ctrl_frame_stat) {
                sdio_claim_host(bus->sdiodev->func[1]);
@@ -3552,7 +3552,7 @@ static void brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus)
        /* Poll for console output periodically */
        if (bus->sdiodev->state == BRCMF_SDIOD_DATA && BRCMF_FWCON_ON() &&
            bus->console_interval != 0) {
-               bus->console.count += BRCMF_WD_POLL_MS;
+               bus->console.count += jiffies_to_msecs(BRCMF_WD_POLL);
                if (bus->console.count >= bus->console_interval) {
                        bus->console.count -= bus->console_interval;
                        sdio_claim_host(bus->sdiodev->func[1]);
@@ -3909,7 +3909,7 @@ brcmf_sdio_watchdog(unsigned long data)
                /* Reschedule the watchdog */
                if (bus->wd_active)
                        mod_timer(&bus->timer,
-                                 jiffies + msecs_to_jiffies(BRCMF_WD_POLL_MS));
+                                 jiffies + BRCMF_WD_POLL);
        }
 }
 
@@ -4234,14 +4234,12 @@ void brcmf_sdio_wd_timer(struct brcmf_sdio *bus, bool active)
                        /* Create timer again when watchdog period is
                           dynamically changed or in the first instance
                         */
-                       bus->timer.expires =
-                               jiffies + msecs_to_jiffies(BRCMF_WD_POLL_MS);
+                       bus->timer.expires = jiffies + BRCMF_WD_POLL;
                        add_timer(&bus->timer);
                        bus->wd_active = true;
                } else {
                        /* Re arm the timer, at last watchdog period */
-                       mod_timer(&bus->timer,
-                               jiffies + msecs_to_jiffies(BRCMF_WD_POLL_MS));
+                       mod_timer(&bus->timer, jiffies + BRCMF_WD_POLL);
                }
        }
 }
index ff47ceedb1f4b7b22a9f3b7d656c6fb87c9a4c84..5ec7a6d876723029f3a98a1047e0da9bcbf53d53 100644 (file)
 /* Packet alignment for most efficient SDIO (can change based on platform) */
 #define BRCMF_SDALIGN  (1 << 6)
 
-/* watchdog polling interval in ms */
-#define BRCMF_WD_POLL_MS       10
+/* watchdog polling interval */
+#define BRCMF_WD_POLL  msecs_to_jiffies(10)
 
 /**
  * enum brcmf_sdiod_state - the state of the bus.
index 66c26a92b29cc8f5fc56f1df8f3f89bb0fa2014f..c72b7b352a77615a76bc624c4acbf34e533a9266 100644 (file)
@@ -29,7 +29,7 @@
 #include "usb.h"
 
 
-#define IOCTL_RESP_TIMEOUT             2000
+#define IOCTL_RESP_TIMEOUT             msecs_to_jiffies(2000)
 
 #define BRCMF_USB_RESET_GETVER_SPINWAIT        100     /* in unit of ms */
 #define BRCMF_USB_RESET_GETVER_LOOP_CNT        10
@@ -190,8 +190,7 @@ static struct brcmf_usbdev_info *brcmf_usb_get_businfo(struct device *dev)
 static int brcmf_usb_ioctl_resp_wait(struct brcmf_usbdev_info *devinfo)
 {
        return wait_event_timeout(devinfo->ioctl_resp_wait,
-                                 devinfo->ctl_completed,
-                                 msecs_to_jiffies(IOCTL_RESP_TIMEOUT));
+                                 devinfo->ctl_completed, IOCTL_RESP_TIMEOUT);
 }
 
 static void brcmf_usb_ioctl_resp_wake(struct brcmf_usbdev_info *devinfo)