staging: wilc1000: remove semaphore wrapper

The various semaphore functions all directly translate into
sema_init(), down() and up(), so we can just remove the API.

This is a mostly automated conversion using simple sed scripts,
plus some manual changes to account for down() returning no
error.

As a positive side-effect, down() no longer hangs after
receiving a signal, as the original code did by looping around
down_interruptible.

The semaphores still need to be turned into mutexes as a
follow-up step.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index c1d5118..d8ca75c 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -462,7 +462,7 @@
 				PRINT_D(CFG80211_DBG, "No networks found \n");
 			}
 
-			WILC_SemaphoreAcquire(&(priv->hSemScanReq), NULL);
+			down(&(priv->hSemScanReq));
 
 			if (priv->pstrScanReq != WILC_NULL) {
 				cfg80211_scan_done(priv->pstrScanReq, WILC_FALSE);
@@ -470,12 +470,12 @@
 				priv->bCfgScanning = WILC_FALSE;
 				priv->pstrScanReq = WILC_NULL;
 			}
-			WILC_SemaphoreRelease(&(priv->hSemScanReq), NULL);
+			up(&(priv->hSemScanReq));
 
 		}
 		/*Aborting any scan operation during mac close*/
 		else if (enuScanEvent == SCAN_EVENT_ABORTED) {
-			WILC_SemaphoreAcquire(&(priv->hSemScanReq), NULL);
+			down(&(priv->hSemScanReq));
 
 			PRINT_D(CFG80211_DBG, "Scan Aborted \n");
 			if (priv->pstrScanReq != WILC_NULL) {
@@ -487,7 +487,7 @@
 				priv->bCfgScanning = WILC_FALSE;
 				priv->pstrScanReq = WILC_NULL;
 			}
-			WILC_SemaphoreRelease(&(priv->hSemScanReq), NULL);
+			up(&(priv->hSemScanReq));
 		}
 	}
 
@@ -2839,13 +2839,13 @@
 		STATION_INFO_RX_BYTES |
 		STATION_INFO_RX_PACKETS | STATION_INFO_SIGNAL | STATION_INFO_INACTIVE_TIME;
 
-	WILC_SemaphoreAcquire(&SemHandleUpdateStats, NULL);
+	down(&SemHandleUpdateStats);
 	sinfo->inactive_time = priv->netstats.rx_time > priv->netstats.tx_time ? jiffies_to_msecs(jiffies - priv->netstats.tx_time) : jiffies_to_msecs(jiffies - priv->netstats.rx_time);
 	sinfo->rx_bytes = priv->netstats.rx_bytes;
 	sinfo->tx_bytes = priv->netstats.tx_bytes;
 	sinfo->rx_packets = priv->netstats.rx_packets;
 	sinfo->tx_packets = priv->netstats.tx_packets;
-	WILC_SemaphoreRelease(&SemHandleUpdateStats, NULL);
+	up(&SemHandleUpdateStats);
 #endif
 	return 0;
 
@@ -3767,7 +3767,7 @@
 	struct WILC_WFI_priv *priv;
 
 	priv = wiphy_priv(wiphy);
-	/* WILC_SemaphoreAcquire(&SemHandleUpdateStats,NULL); */
+	/* down(&SemHandleUpdateStats); */
 #if 1
 	switch (changed) {
 
@@ -3792,7 +3792,7 @@
 	default:
 		break;
 	}
-	/* WILC_SemaphoreRelease(&SemHandleUpdateStats,NULL); */
+	/* down(&SemHandleUpdateStats); */
 #endif
 	return 0;
 }
@@ -3898,7 +3898,7 @@
 
 	/*Return hardware description structure (wiphy)'s priv*/
 	priv = wdev_priv(wdev);
-	WILC_SemaphoreCreate(&(priv->SemHandleUpdateStats), NULL);
+	sema_init(&(priv->SemHandleUpdateStats), 1);
 
 	/*Link the wiphy with wireless structure*/
 	priv->wdev = wdev;
@@ -3991,8 +3991,6 @@
 
 	struct WILC_WFI_priv *priv;
 
-	tstrWILC_SemaphoreAttrs strSemaphoreAttrs;
-
 	PRINT_D(INIT_DBG, "Host[%p][%p]\n", net, net->ieee80211_ptr);
 	priv = wdev_priv(net->ieee80211_ptr);
 	if (op_ifcs == 0) {
@@ -4007,17 +4005,11 @@
 		return s32Error;
 	}
 
-	WILC_SemaphoreFillDefault(&strSemaphoreAttrs);
-
-	/* /////////////////////////////////////// */
-	/* strSemaphoreAttrs.u32InitCount = 0; */
-
-
 	priv->gbAutoRateAdjusted = WILC_FALSE;
 
 	priv->bInP2PlistenState = WILC_FALSE;
 
-	WILC_SemaphoreCreate(&(priv->hSemScanReq), &strSemaphoreAttrs);
+	sema_init(&(priv->hSemScanReq), 1);
 	s32Error = host_int_init(&priv->hWILCWFIDrv);
 	/* s32Error = host_int_init(&priv->hWILCWFIDrv_2); */
 	if (s32Error) {
@@ -4042,13 +4034,6 @@
 	struct WILC_WFI_priv *priv;
 	priv = wdev_priv(net->ieee80211_ptr);
 
-
-
-
-
-
-	WILC_SemaphoreDestroy(&(priv->hSemScanReq), NULL);
-
 	priv->gbAutoRateAdjusted = WILC_FALSE;
 
 	priv->bInP2PlistenState = WILC_FALSE;