Skip to contentSkip to conversation

Staging: wilc1000: Remove useless type conversion

PATCH New Bhumika Goyal 1 participant 1 message Oct 8, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: wilc1000: Remove useless type conversion

Some type conversions like casting a pointer to a pointer of same type, casting to the original type using addressof(&) operator etc. are not needed. Therefore, remove them. Done using coccinelle:

@@
type t;
t *p;
t a;
@@
(
- (t)(a)
+ a
|
- (t *)(p)
+ p
|
- (t *)(&a)
+ &a
)

---
 drivers/staging/wilc1000/host_interface.c | 12 ++++++------
 drivers/staging/wilc1000/wilc_debugfs.c   |  2 +-
 drivers/staging/wilc1000/wilc_wlan.c      |  2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)
drivers/staging/wilc1000/host_interface.c +6 -6
index 78f5613..b98aa3c 100644
@@ -385,7 +385,7 @@ static void handle_set_ip_address(struct wilc_vif *vif, u8 *ip_addr, u8 idx)
 
 	wid.id = (u16)WID_IP_ADDRESS;
 	wid.type = WID_STR;
-	wid.val = (u8 *)ip_addr;
+	wid.val = ip_addr;
 	wid.size = IP_ALEN;
 
 	ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
@@ -473,7 +473,7 @@ static void handle_cfg_param(struct wilc_vif *vif,
 			wid_list[i].val = (s8 *)&cfg_param_attr->auth_type;
 			wid_list[i].type = WID_CHAR;
 			wid_list[i].size = sizeof(char);
-			hif_drv->cfg_values.auth_type = (u8)cfg_param_attr->auth_type;
+			hif_drv->cfg_values.auth_type = cfg_param_attr->auth_type;
 		} else {
 			netdev_err(vif->ndev, "Impossible value\n");
 			goto unlock;
@@ -500,7 +500,7 @@ static void handle_cfg_param(struct wilc_vif *vif,
 			wid_list[i].val = (s8 *)&cfg_param_attr->power_mgmt_mode;
 			wid_list[i].type = WID_CHAR;
 			wid_list[i].size = sizeof(char);
-			hif_drv->cfg_values.power_mgmt_mode = (u8)cfg_param_attr->power_mgmt_mode;
+			hif_drv->cfg_values.power_mgmt_mode = cfg_param_attr->power_mgmt_mode;
 		} else {
 			netdev_err(vif->ndev, "Invalid power mode\n");
 			goto unlock;
@@ -582,7 +582,7 @@ static void handle_cfg_param(struct wilc_vif *vif,
 			wid_list[i].val = (s8 *)&cfg_param_attr->short_slot_allowed;
 			wid_list[i].type = WID_CHAR;
 			wid_list[i].size = sizeof(char);
-			hif_drv->cfg_values.short_slot_allowed = (u8)cfg_param_attr->short_slot_allowed;
+			hif_drv->cfg_values.short_slot_allowed = cfg_param_attr->short_slot_allowed;
 		} else {
 			netdev_err(vif->ndev, "Short slot(2) over\n");
 			goto unlock;
@@ -595,7 +595,7 @@ static void handle_cfg_param(struct wilc_vif *vif,
 			wid_list[i].val = (s8 *)&cfg_param_attr->txop_prot_disabled;
 			wid_list[i].type = WID_CHAR;
 			wid_list[i].size = sizeof(char);
-			hif_drv->cfg_values.txop_prot_disabled = (u8)cfg_param_attr->txop_prot_disabled;
+			hif_drv->cfg_values.txop_prot_disabled = cfg_param_attr->txop_prot_disabled;
 		} else {
 			netdev_err(vif->ndev, "TXOP prot disable\n");
 			goto unlock;
@@ -1879,7 +1879,7 @@ static s32 Handle_GetStatistics(struct wilc_vif *vif,
 	strWIDList[u32WidsCount].id = WID_RSSI;
 	strWIDList[u32WidsCount].type = WID_CHAR;
 	strWIDList[u32WidsCount].size = sizeof(char);
-	strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->rssi;
+	strWIDList[u32WidsCount].val = &pstrStatistics->rssi;
 	u32WidsCount++;
 
 	strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT;
drivers/staging/wilc1000/wilc_debugfs.c +1 -1
index 802bb1d..dad1108 100644
@@ -66,7 +66,7 @@ static ssize_t wilc_debug_level_write(struct file *filp, const char __user *buf,
 		return -EINVAL;
 	}
 
-	atomic_set(&WILC_DEBUG_LEVEL, (int)flag);
+	atomic_set(&WILC_DEBUG_LEVEL, flag);
 
 	if (flag == 0)
 		printk(KERN_INFO "Debug-level disabled\n");
drivers/staging/wilc1000/wilc_wlan.c +1 -1
index bc5ad20..890e196 100644
@@ -1175,7 +1175,7 @@ static int wilc_wlan_cfg_commit(struct wilc_vif *vif, int type,
 	struct wilc_cfg_frame *cfg = &wilc->cfg_frame;
 	int total_len = wilc->cfg_frame_offset + 4 + DRIVER_HANDLER_SIZE;
 	int seq_no = wilc->cfg_seq_no % 256;
-	int driver_handler = (u32)drv_handler;
+	int driver_handler = drv_handler;
 
 	if (type == WILC_CFG_SET)
 		cfg->wid_header[0] = 'W';
Signature · 1 line
1.9.1