Skip to contentSkip to conversation

staging: wilc1000: remove cast on void pointers

PATCH New Alison Schofield 1 participant 5 messages Feb 13, 2016 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: wilc1000: remove cast on void pointers

Patchset removes casts on void pointers in wilc1000. The patchset is separated by .c file.

Alison Schofield (4):
staging: wilc1000: host_interface: remove cast on void pointers
staging: wilc1000: linux_mon: remove cast on void pointer
staging: wilc1000: linux_wlan: remove cast on void pointers
staging: wilc1000: wilc_wfi_cfgoperations: remove cast on void
pointers

 drivers/staging/wilc1000/host_interface.c         |  4 ++--
 drivers/staging/wilc1000/linux_mon.c              |  2 +-
 drivers/staging/wilc1000/linux_wlan.c             | 10 +++++-----
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 12 ++++++------
 4 files changed, 14 insertions(+), 14 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/4 staging: wilc1000: host_interface: remove cast on void pointers

Remove cast on void pointers. C programming language guarantees the conversion from void pointer to any other pointer type.

Coccinelle patch:
@r@
expression x;
void* e;
type T;
identifier f;
@@

(
*((T *)e)
|
((T *)x)[...]
|
((T *)x)->f
|
- (T *)
e
)

---
 drivers/staging/wilc1000/host_interface.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/wilc1000/host_interface.c +2 -2
index 5570707..94135f1 100644
@@ -957,7 +957,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
 		return result;
 	}
 
-	ptstrJoinBssParam = (struct join_bss_param *)pstrHostIFconnectAttr->params;
+	ptstrJoinBssParam = pstrHostIFconnectAttr->params;
 	if (!ptstrJoinBssParam) {
 		PRINT_ER("Required BSSID not found\n");
 		result = -ENOENT;
@@ -2679,7 +2679,7 @@ static int hostIFthread(void *pvArg)
 {
 	u32 u32Ret;
 	struct host_if_msg msg;
-	struct wilc *wilc = (struct wilc*)pvArg;
+	struct wilc *wilc = pvArg;
 	struct wilc_vif *vif;
 
 	memset(&msg, 0, sizeof(struct host_if_msg));
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/4 staging: wilc1000: linux_mon: remove cast on void pointer

In reply to Alison Schofield

Remove cast on void pointer. C programming language guarantees the conversion from void pointer to any other pointer type.

Coccinelle patch:
@r@
expression x;
void* e;
type T;
identifier f;
@@

(
*((T *)e)
|
((T *)x)[...]
|
((T *)x)->f
|
- (T *)
e
)

---
 drivers/staging/wilc1000/linux_mon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wilc1000/linux_mon.c +1 -1
index e9bb0ec..ba702b2 100644
@@ -137,7 +137,7 @@ struct tx_complete_mon_data {
 
 static void mgmt_tx_complete(void *priv, int status)
 {
-	struct tx_complete_mon_data *pv_data = (struct tx_complete_mon_data *)priv;
+	struct tx_complete_mon_data *pv_data = priv;
 	u8 *buf =  pv_data->buff;
 
 	if (status == 1) {
Signature · 1 line
2.1.4
#3 lore raw

PATCH 3/4 staging: wilc1000: linux_wlan: remove cast on void pointers

In reply to Alison Schofield

Remove casts on void pointers. C programming language guarantees the conversion from void pointer to any other pointer type.

Coccinelle patch:
@r@
expression x;
void* e;
type T;
identifier f;
@@

(
*((T *)e)
|
((T *)x)[...]
|
((T *)x)->f
|
- (T *)
e
)

---
 drivers/staging/wilc1000/linux_wlan.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +5 -5
index c11830f..a731b46 100644
@@ -61,7 +61,7 @@ static const struct net_device_ops wilc_netdev_ops = {
 static int dev_state_ev_handler(struct notifier_block *this,
 				unsigned long event, void *ptr)
 {
-	struct in_ifaddr *dev_iface = (struct in_ifaddr *)ptr;
+	struct in_ifaddr *dev_iface = ptr;
 	struct wilc_priv *priv;
 	struct host_if_drv *hif_drv;
 	struct net_device *dev;
@@ -144,7 +144,7 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)
 {
 	struct wilc_vif *vif;
 	struct wilc *wilc;
-	struct net_device *dev = (struct net_device *)user_data;
+	struct net_device *dev = user_data;
 
 	vif = netdev_priv(dev);
 	wilc = vif->wilc;
@@ -160,7 +160,7 @@ static irqreturn_t isr_bh_routine(int irq, void *userdata)
 {
 	struct wilc_vif *vif;
 	struct wilc *wilc;
-	struct net_device *dev = (struct net_device *)userdata;
+	struct net_device *dev = userdata;
 
 	vif = netdev_priv(userdata);
 	wilc = vif->wilc;
@@ -235,7 +235,7 @@ int wilc_lock_timeout(struct wilc *nic, void *vp, u32 timeout)
 	int error = -1;
 
 	if (vp)
-		error = down_timeout((struct semaphore *)vp,
+		error = down_timeout(vp,
 				     msecs_to_jiffies(timeout));
 	return error;
 }
@@ -1038,7 +1038,7 @@ static void wilc_set_multicast_list(struct net_device *dev)
 
 static void linux_wlan_tx_complete(void *priv, int status)
 {
-	struct tx_complete_data *pv_data = (struct tx_complete_data *)priv;
+	struct tx_complete_data *pv_data = priv;
 
 	dev_kfree_skb(pv_data->skb);
 	kfree(pv_data);
Signature · 1 line
2.1.4
#4 lore raw

PATCH 4/4 staging: wilc1000: wilc_wfi_cfgoperations: remove cast on void pointers

In reply to Alison Schofield

Remove cast on void pointers. C programming language guarantees the conversion from void pointer to any other pointer type.

Coccinelle patch:
@r@
expression x;
void* e;
type T;
identifier f;
@@

(
*((T *)e)
|
((T *)x)[...]
|
((T *)x)->f
|
- (T *)
e
)

---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +6 -6
index 97d1b80..81a2ee9 100644
@@ -228,7 +228,7 @@ static void refresh_scan(void *user_void, u8 all, bool direct_scan)
 	int i;
 	int rssi = 0;
 
-	priv = (struct wilc_priv *)user_void;
+	priv = user_void;
 	wiphy = priv->dev->ieee80211_ptr->wiphy;
 
 	for (i = 0; i < last_scanned_cnt; i++) {
@@ -404,7 +404,7 @@ static void CfgScanResult(enum scan_event scan_event,
 	struct ieee80211_channel *channel;
 	struct cfg80211_bss *bss = NULL;
 
-	priv = (struct wilc_priv *)user_void;
+	priv = user_void;
 	if (priv->bCfgScanning) {
 		if (scan_event == SCAN_EVENT_NETWORK_FOUND) {
 			wiphy = priv->dev->ieee80211_ptr->wiphy;
@@ -525,7 +525,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
 
 	wilc_connecting = 0;
 
-	priv = (struct wilc_priv *)pUserVoid;
+	priv = pUserVoid;
 	dev = priv->dev;
 	vif = netdev_priv(dev);
 	wl = vif->wilc;
@@ -1713,7 +1713,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size)
 
 static void WILC_WFI_mgmt_tx_complete(void *priv, int status)
 {
-	struct p2p_mgmt_data *pv_data = (struct p2p_mgmt_data *)priv;
+	struct p2p_mgmt_data *pv_data = priv;
 
 
 	kfree(pv_data->buff);
@@ -1724,7 +1724,7 @@ static void WILC_WFI_RemainOnChannelReady(void *pUserVoid)
 {
 	struct wilc_priv *priv;
 
-	priv = (struct wilc_priv *)pUserVoid;
+	priv = pUserVoid;
 
 	priv->bInP2PlistenState = true;
 
@@ -1739,7 +1739,7 @@ static void WILC_WFI_RemainOnChannelExpired(void *pUserVoid, u32 u32SessionID)
 {
 	struct wilc_priv *priv;
 
-	priv = (struct wilc_priv *)pUserVoid;
+	priv = pUserVoid;
 
 	if (u32SessionID == priv->strRemainOnChanParams.u32ListenSessionID) {
 		priv->bInP2PlistenState = false;
Signature · 1 line
2.1.4