Skip to content

Commit

Permalink
staging: wilc1000: Replace semaphore sync_event with completion
Browse files Browse the repository at this point in the history
The semaphore 'sync_event' is used as completion, so convert
it to a struct completion type. Also, return -ETIME if the return
value of wait_for_completion_timeout is 0.

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>
  • Loading branch information
Binoy Jayan authored and Greg Kroah-Hartman committed Jun 25, 2016
1 parent fa65969 commit 04247e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions drivers/staging/wilc1000/linux_wlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ void wilc_mac_indicate(struct wilc *wilc, int flag)
(unsigned char *)&status, 4);
if (wilc->mac_status == WILC_MAC_STATUS_INIT) {
wilc->mac_status = status;
up(&wilc->sync_event);
complete(&wilc->sync_event);
} else {
wilc->mac_status = status;
}
Expand Down Expand Up @@ -386,9 +386,9 @@ static int linux_wlan_start_firmware(struct net_device *dev)
if (ret < 0)
return ret;

ret = wilc_lock_timeout(wilc, &wilc->sync_event, 5000);
if (ret)
return ret;
if (!wait_for_completion_timeout(&wilc->sync_event,
msecs_to_jiffies(5000)))
return -ETIME;

return 0;
}
Expand Down Expand Up @@ -684,7 +684,7 @@ static int wlan_init_locks(struct net_device *dev)
init_completion(&wl->txq_event);

init_completion(&wl->cfg_event);
sema_init(&wl->sync_event, 0);
init_completion(&wl->sync_event);
init_completion(&wl->txq_thread_started);

return 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/wilc1000/wilc_wfi_netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ struct wilc {
struct mutex hif_cs;

struct completion cfg_event;
struct semaphore sync_event;
struct completion sync_event;
struct completion txq_event;
struct completion txq_thread_started;

Expand Down

0 comments on commit 04247e7

Please sign in to comment.