]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
staging: wilc1000: Replace semaphore cfg_event with completion
authorBinoy Jayan <binoy.jayan@linaro.org>
Wed, 15 Jun 2016 05:30:36 +0000 (11:00 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 Jun 2016 21:39:53 +0000 (14:39 -0700)
The semaphore 'cfg_event' is used as completion, so convert
it to a struct completion type.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/linux_wlan.c
drivers/staging/wilc1000/wilc_wfi_netdevice.h
drivers/staging/wilc1000/wilc_wlan.c

index 5dc645c539a823f508eece19f0dc24a218ce2e68..5c5e8adc6ff626e49bb740c801ef1d9fcfa93a02 100644 (file)
@@ -683,7 +683,7 @@ static int wlan_init_locks(struct net_device *dev)
 
        init_completion(&wl->txq_event);
 
-       sema_init(&wl->cfg_event, 0);
+       init_completion(&wl->cfg_event);
        sema_init(&wl->sync_event, 0);
        init_completion(&wl->txq_thread_started);
 
index 239cd436861cfb7f95cf5771dbbe16348663d1b0..5fbc07c456618f13fe126d5fd29a3ceef56492a6 100644 (file)
@@ -178,7 +178,7 @@ struct wilc {
        struct mutex rxq_cs;
        struct mutex hif_cs;
 
-       struct semaphore cfg_event;
+       struct completion cfg_event;
        struct semaphore sync_event;
        struct completion txq_event;
        struct completion txq_thread_started;
index 9afbe8dc327f61548dbff3ef8adb31f323b89438..19a580939dfc09d0f122a3fe8515f4d172542176 100644 (file)
@@ -310,7 +310,7 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc_vif *vif, u8 *buffer,
        netdev_dbg(vif->ndev, "Adding config packet ...\n");
        if (wilc->quit) {
                netdev_dbg(vif->ndev, "Return due to clear function\n");
-               up(&wilc->cfg_event);
+               complete(&wilc->cfg_event);
                return 0;
        }
 
@@ -769,7 +769,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
 
        do {
                if (wilc->quit) {
-                       up(&wilc->cfg_event);
+                       complete(&wilc->cfg_event);
                        break;
                }
                rqe = wilc_wlan_rxq_remove(wilc);
@@ -820,7 +820,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
                                        wilc_wlan_cfg_indicate_rx(wilc, &buffer[pkt_offset + offset], pkt_len, &rsp);
                                        if (rsp.type == WILC_CFG_RSP) {
                                                if (wilc->cfg_seq_no == rsp.seq_no)
-                                                       up(&wilc->cfg_event);
+                                                       complete(&wilc->cfg_event);
                                        } else if (rsp.type == WILC_CFG_RSP_STATUS) {
                                                wilc_mac_indicate(wilc, WILC_MAC_INDICATE_STATUS);
 
@@ -1228,11 +1228,12 @@ int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, u16 wid, u8 *buffer,
                if (wilc_wlan_cfg_commit(vif, WILC_CFG_SET, drv_handler))
                        ret_size = 0;
 
-               if (wilc_lock_timeout(wilc, &wilc->cfg_event,
-                                           CFG_PKTS_TIMEOUT)) {
+               if (!wait_for_completion_timeout(&wilc->cfg_event,
+                                       msecs_to_jiffies(CFG_PKTS_TIMEOUT))) {
                        netdev_dbg(vif->ndev, "Set Timed Out\n");
                        ret_size = 0;
                }
+
                wilc->cfg_frame_in_use = 0;
                wilc->cfg_frame_offset = 0;
                wilc->cfg_seq_no += 1;
@@ -1265,8 +1266,8 @@ int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, u16 wid, int commit,
                if (wilc_wlan_cfg_commit(vif, WILC_CFG_QUERY, drv_handler))
                        ret_size = 0;
 
-               if (wilc_lock_timeout(wilc, &wilc->cfg_event,
-                                           CFG_PKTS_TIMEOUT)) {
+               if (!wait_for_completion_timeout(&wilc->cfg_event,
+                                       msecs_to_jiffies(CFG_PKTS_TIMEOUT))) {
                        netdev_dbg(vif->ndev, "Get Timed Out\n");
                        ret_size = 0;
                }