2018-07-29 07:36:17

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 0/8] staging: wilc1000: changes to address TODO items

This patch series contains changes to address below TODO items.
- rework comments and function headers(also coding style)
All checkpatch reported issues related to coding style are addressed
except DT compatible string un-documented. Checkpatch warning related to
DT compatible string warning will be removed once "microchip,wilc1000-sdio"
& microchip,wilc1000-spi" reference is move to
./Documentation/devicetree/bindings/ .

- make spi and sdio components coexist in one build
Instead of compiling wilc1000.ko module separately compile it along with
wilc1000-sdio.ko & wilc1000-spi.ko module.


Ajay Singh (8):
staging: wilc1000: fix TODO to compile spi and sdio components in
single module
staging: wilc1000: remove unnecessary comments and comments
description
staging: wilc1000: remove unnecessary copyright information in file
staging: wilc1000: modified debug log messages description
staging: wilc1000: added comments for 'hif_cs' mutex lock
staging: wilc1000: rename 'rcvd_ch_cnt' element in 'user_scan_req'
struct
staging: wilc1000: replace udelay with usleep_range
staging: wilc1000: added parentheses in macro to avoid checkpatch
issue

drivers/staging/wilc1000/Makefile | 3 +-
drivers/staging/wilc1000/TODO | 2 -
drivers/staging/wilc1000/host_interface.c | 150 +++++++++++-----------
drivers/staging/wilc1000/host_interface.h | 2 +-
drivers/staging/wilc1000/linux_mon.c | 15 ++-
drivers/staging/wilc1000/linux_wlan.c | 6 +-
drivers/staging/wilc1000/wilc_debugfs.c | 28 +---
drivers/staging/wilc1000/wilc_sdio.c | 15 +--
drivers/staging/wilc1000/wilc_spi.c | 6 -
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 13 +-
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 6 +-
drivers/staging/wilc1000/wilc_wlan.c | 17 +--
drivers/staging/wilc1000/wilc_wlan.h | 8 +-
drivers/staging/wilc1000/wilc_wlan_cfg.c | 13 --
drivers/staging/wilc1000/wilc_wlan_cfg.h | 8 --
drivers/staging/wilc1000/wilc_wlan_if.h | 2 +
16 files changed, 109 insertions(+), 185 deletions(-)

--
2.7.4


2018-07-29 07:36:35

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 5/8] staging: wilc1000: added comments for 'hif_cs' mutex lock

Added comments for 'hif_cs' mutex to avoid checkpatch.pl reported
issues.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 371a87f..a0e2e11 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -130,6 +130,7 @@ struct wilc {
spinlock_t txq_spinlock;
/*protect rxq_entry_t receiver queue*/
struct mutex rxq_cs;
+ /* lock to protect hif access */
struct mutex hif_cs;

struct completion cfg_event;
--
2.7.4

2018-07-29 07:36:33

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 4/8] staging: wilc1000: modified debug log messages description

Cleanup patch to update the debug logs message to provide correct
information. Also added the function name tag for same description log
to help identify the place from where log was captured.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 134 +++++++++++-----------
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 13 ++-
drivers/staging/wilc1000/wilc_wlan.c | 9 +-
3 files changed, 80 insertions(+), 76 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index d960147..0df4d9c 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -342,7 +342,8 @@ static void handle_set_operation_mode(struct work_struct *work)
complete(&hif_driver_comp);

if (ret)
- netdev_err(vif->ndev, "Failed to set driver handler\n");
+ netdev_err(vif->ndev, "Failed to set operation mode\n");
+
kfree(msg);
}

@@ -747,7 +748,7 @@ static int handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
}

if (!hif_drv) {
- netdev_err(vif->ndev, "Driver handler is NULL\n");
+ netdev_err(vif->ndev, "%s: hif driver is NULL\n", __func__);
return result;
}

@@ -1155,7 +1156,7 @@ static void handle_connect_timeout(struct work_struct *work)
struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
- netdev_err(vif->ndev, "Driver handler is NULL\n");
+ netdev_err(vif->ndev, "%s: hif driver is NULL\n", __func__);
goto out;
}

@@ -1187,7 +1188,7 @@ static void handle_connect_timeout(struct work_struct *work)
kfree(info.req_ies);
info.req_ies = NULL;
} else {
- netdev_err(vif->ndev, "Connect callback is NULL\n");
+ netdev_err(vif->ndev, "%s: conn_result is NULL\n", __func__);
}

wid.id = WID_DISCONNECT;
@@ -1400,7 +1401,8 @@ static void handle_rcvd_ntwrk_info(struct work_struct *work)

wilc_parse_network_info(rcvd_info->buffer, &info);
if (!info || !scan_req->scan_result) {
- netdev_err(vif->ndev, "driver is null\n");
+ netdev_err(vif->ndev, "%s: info or scan result NULL\n",
+ __func__);
goto done;
}

@@ -1519,7 +1521,7 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif,
if (mac_status == MAC_STATUS_CONNECTED &&
conn_info.status != WLAN_STATUS_SUCCESS) {
netdev_err(vif->ndev,
- "Received MAC status is MAC_STATUS_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n");
+ "Received MAC status is MAC_STATUS_CONNECTED, Assoc Resp is not SUCCESS\n");
eth_zero_addr(wilc_connected_ssid);
} else if (mac_status == MAC_STATUS_DISCONNECTED) {
netdev_err(vif->ndev, "Received MAC status is MAC_STATUS_DISCONNECTED\n");
@@ -1594,7 +1596,7 @@ static inline void host_int_handle_disconnect(struct wilc_vif *vif)
conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, 0,
&disconn_info, hif_drv->usr_conn_req.arg);
} else {
- netdev_err(vif->ndev, "Connect result NULL\n");
+ netdev_err(vif->ndev, "%s: conn_result is NULL\n", __func__);
}

eth_zero_addr(hif_drv->assoc_bssid);
@@ -1613,12 +1615,12 @@ static void handle_rcvd_gnrl_async_info(struct work_struct *work)
struct host_if_drv *hif_drv = vif->hif_drv;

if (!rcvd_info->buffer) {
- netdev_err(vif->ndev, "Received buffer is NULL\n");
+ netdev_err(vif->ndev, "%s: buffer is NULL\n", __func__);
goto free_msg;
}

if (!hif_drv) {
- netdev_err(vif->ndev, "Driver handler is NULL\n");
+ netdev_err(vif->ndev, "%s: hif driver is NULL\n", __func__);
goto free_rcvd_info;
}

@@ -1626,7 +1628,8 @@ static void handle_rcvd_gnrl_async_info(struct work_struct *work)
hif_drv->hif_state == HOST_IF_CONNECTED ||
hif_drv->usr_scan_req.scan_result) {
if (!hif_drv->usr_conn_req.conn_result) {
- netdev_err(vif->ndev, "driver is null\n");
+ netdev_err(vif->ndev, "%s: conn_result is NULL\n",
+ __func__);
goto free_rcvd_info;
}

@@ -1969,7 +1972,7 @@ static void handle_disconnect(struct work_struct *work)
conn_req->conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL,
0, &disconn_info, conn_req->arg);
} else {
- netdev_err(vif->ndev, "conn_result = NULL\n");
+ netdev_err(vif->ndev, "%s: conn_result is NULL\n", __func__);
}

hif_drv->hif_state = HOST_IF_IDLE;
@@ -2101,7 +2104,7 @@ static void handle_get_inactive_time(struct work_struct *work)
kfree(wid.val);

if (result) {
- netdev_err(vif->ndev, "Failed to SET inactive time\n");
+ netdev_err(vif->ndev, "Failed to set inactive mac\n");
goto out;
}

@@ -2293,7 +2296,7 @@ static void handle_del_all_sta(struct work_struct *work)
result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
- netdev_err(vif->ndev, "Failed to send add station\n");
+ netdev_err(vif->ndev, "Failed to send delete all station\n");

error:
kfree(wid.val);
@@ -2323,7 +2326,7 @@ static void handle_del_station(struct work_struct *work)
result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
- netdev_err(vif->ndev, "Failed to send add station\n");
+ netdev_err(vif->ndev, "Failed to del station\n");

error:
kfree(wid.val);
@@ -2523,7 +2526,7 @@ static void listen_timer_cb(struct timer_list *t)

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "wilc_mq_send fail\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
}
}
@@ -2719,7 +2722,7 @@ int wilc_remove_wep_key(struct wilc_vif *vif, u8 index)

if (!hif_drv) {
result = -EFAULT;
- netdev_err(vif->ndev, "Failed to send setup multicast\n");
+ netdev_err(vif->ndev, "%s: hif driver is NULL", __func__);
return result;
}

@@ -2733,7 +2736,7 @@ int wilc_remove_wep_key(struct wilc_vif *vif, u8 index)

result = wilc_enqueue_work(msg);
if (result)
- netdev_err(vif->ndev, "Request to remove WEP key\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
else
wait_for_completion(&msg->work_comp);

@@ -2749,7 +2752,7 @@ int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index)

if (!hif_drv) {
result = -EFAULT;
- netdev_err(vif->ndev, "driver is null\n");
+ netdev_err(vif->ndev, "%s: hif driver is NULL\n", __func__);
return result;
}

@@ -2763,7 +2766,7 @@ int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index)

result = wilc_enqueue_work(msg);
if (result)
- netdev_err(vif->ndev, "Default key index\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
else
wait_for_completion(&msg->work_comp);

@@ -2779,7 +2782,7 @@ int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
- netdev_err(vif->ndev, "driver is null\n");
+ netdev_err(vif->ndev, "%s: hif driver is NULL", __func__);
return -EFAULT;
}

@@ -2820,7 +2823,7 @@ int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
- netdev_err(vif->ndev, "driver is null\n");
+ netdev_err(vif->ndev, "%s: hif driver is NULL\n", __func__);
return -EFAULT;
}

@@ -2865,7 +2868,7 @@ int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
u8 key_len = ptk_key_len;

if (!hif_drv) {
- netdev_err(vif->ndev, "driver is null\n");
+ netdev_err(vif->ndev, "%s: hif driver is NULL", __func__);
return -EFAULT;
}

@@ -2907,7 +2910,7 @@ int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "PTK Key\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
goto free_key;
}

@@ -2932,7 +2935,7 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
u8 key_len = gtk_key_len;

if (!hif_drv) {
- netdev_err(vif->ndev, "driver is null\n");
+ netdev_err(vif->ndev, "%s: hif driver is NULL", __func__);
return -EFAULT;
}

@@ -2985,7 +2988,7 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "RX GTK\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
goto free_key;
}

@@ -3025,7 +3028,7 @@ int wilc_set_pmkid_info(struct wilc_vif *vif,

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "PMKID Info\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
}

@@ -3045,7 +3048,7 @@ int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)

result = wilc_enqueue_work(msg);
if (result)
- netdev_err(vif->ndev, "Failed to send get mac address\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
else
wait_for_completion(&msg->work_comp);

@@ -3065,12 +3068,14 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv || !connect_result) {
- netdev_err(vif->ndev, "Driver is null\n");
+ netdev_err(vif->ndev,
+ "%s: hif driver or connect result is NULL",
+ __func__);
return -EFAULT;
}

if (!join_params) {
- netdev_err(vif->ndev, "Unable to Join - JoinParams is NULL\n");
+ netdev_err(vif->ndev, "%s: joinparams is NULL\n", __func__);
return -EFAULT;
}

@@ -3115,7 +3120,7 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "send message: Set join request\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
goto free_ies;
}

@@ -3146,7 +3151,7 @@ int wilc_disconnect(struct wilc_vif *vif, u16 reason_code)
struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
- netdev_err(vif->ndev, "Driver is null\n");
+ netdev_err(vif->ndev, "%s: hif driver is NULL", __func__);
return -EFAULT;
}

@@ -3156,7 +3161,7 @@ int wilc_disconnect(struct wilc_vif *vif, u16 reason_code)

result = wilc_enqueue_work(msg);
if (result)
- netdev_err(vif->ndev, "Failed to send message: disconnect\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
else
wait_for_completion(&msg->work_comp);

@@ -3177,7 +3182,7 @@ int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel)

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "wilc mq send fail\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
}

@@ -3200,7 +3205,7 @@ int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "wilc mq send fail\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
}

@@ -3219,7 +3224,7 @@ int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode)
msg->body.mode.mode = mode;
result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "wilc mq send fail\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
}

@@ -3234,7 +3239,7 @@ s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac,
struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
- netdev_err(vif->ndev, "driver is null\n");
+ netdev_err(vif->ndev, "%s: hif driver is NULL", __func__);
return -EFAULT;
}

@@ -3246,7 +3251,7 @@ s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac,

result = wilc_enqueue_work(msg);
if (result)
- netdev_err(vif->ndev, "Failed to send get host ch param\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
else
wait_for_completion(&msg->work_comp);

@@ -3262,7 +3267,7 @@ int wilc_get_rssi(struct wilc_vif *vif, s8 *rssi_level)
struct host_if_msg *msg;

if (!rssi_level) {
- netdev_err(vif->ndev, "RSS pointer value is null\n");
+ netdev_err(vif->ndev, "%s: RSSI level is NULL\n", __func__);
return -EFAULT;
}

@@ -3278,7 +3283,7 @@ int wilc_get_rssi(struct wilc_vif *vif, s8 *rssi_level)

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "Failed to send get host ch param\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
} else {
wait_for_completion(&msg->work_comp);
*rssi_level = *msg->body.data;
@@ -3304,7 +3309,7 @@ wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats, bool is_sync)

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "Failed to send get host channel\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
return result;
}
@@ -3366,7 +3371,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "Error in sending message queue\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
goto free_ies;
}

@@ -3395,7 +3400,7 @@ int wilc_hif_set_cfg(struct wilc_vif *vif,
int result;

if (!hif_drv) {
- netdev_err(vif->ndev, "hif_drv NULL\n");
+ netdev_err(vif->ndev, "%s: hif driver is NULL", __func__);
return -EFAULT;
}

@@ -3416,7 +3421,7 @@ static void get_periodic_rssi(struct timer_list *unused)
struct wilc_vif *vif = periodic_rssi_vif;

if (!vif->hif_drv) {
- netdev_err(vif->ndev, "Driver handler is NULL\n");
+ netdev_err(vif->ndev, "%s: hif driver is NULL", __func__);
return;
}

@@ -3494,7 +3499,7 @@ int wilc_deinit(struct wilc_vif *vif)
struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
- netdev_err(vif->ndev, "hif_drv = NULL\n");
+ netdev_err(vif->ndev, "%s: hif driver is NULL", __func__);
return -EFAULT;
}

@@ -3578,7 +3583,7 @@ void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length)

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "message parameters (%d)\n", result);
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg->body.net_info.buffer);
kfree(msg);
}
@@ -3612,7 +3617,7 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length)
}

if (!hif_drv->usr_conn_req.conn_result) {
- netdev_err(vif->ndev, "there is no current Connect Request\n");
+ netdev_err(vif->ndev, "%s: conn_result is NULL\n", __func__);
mutex_unlock(&hif_deinit_lock);
return;
}
@@ -3633,7 +3638,7 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length)

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "synchronous info (%d)\n", result);
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg->body.async_info.buffer);
kfree(msg);
}
@@ -3669,7 +3674,8 @@ void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length)

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "complete param (%d)\n", result);
+ netdev_err(vif->ndev, "%s: enqueue work failed\n",
+ __func__);
kfree(msg);
}
}
@@ -3697,7 +3703,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "wilc mq send fail\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
}

@@ -3711,7 +3717,7 @@ int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id)
struct host_if_drv *hif_drv = vif->hif_drv;

if (!hif_drv) {
- netdev_err(vif->ndev, "driver is null\n");
+ netdev_err(vif->ndev, "%s: hif driver is NULL", __func__);
return -EFAULT;
}

@@ -3725,7 +3731,7 @@ int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id)

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "wilc mq send fail\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
}

@@ -3758,7 +3764,7 @@ int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg)

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "wilc mq send fail\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
}

@@ -3799,7 +3805,7 @@ int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,

result = wilc_enqueue_work(msg);
if (result)
- netdev_err(vif->ndev, "wilc mq send fail\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);

error:
if (result) {
@@ -3822,7 +3828,7 @@ int wilc_del_beacon(struct wilc_vif *vif)

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "wilc_mq_send fail\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
}

@@ -3853,7 +3859,7 @@ int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param)

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "wilc_mq_send fail\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(add_sta_info->rates);
kfree(msg);
}
@@ -3879,7 +3885,7 @@ int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr)

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "wilc_mq_send fail\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
}
return result;
@@ -3916,7 +3922,7 @@ int wilc_del_allstation(struct wilc_vif *vif, u8 mac_addr[][ETH_ALEN])
result = wilc_enqueue_work(msg);

if (result)
- netdev_err(vif->ndev, "wilc_mq_send fail\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
else
wait_for_completion(&msg->work_comp);

@@ -3950,7 +3956,7 @@ int wilc_edit_station(struct wilc_vif *vif,

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "wilc_mq_send fail\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(add_sta_info->rates);
kfree(msg);
}
@@ -3975,7 +3981,7 @@ int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, u32 timeout)

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "wilc_mq_send fail\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
}
return result;
@@ -3996,7 +4002,7 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled,

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "wilc_mq_send fail\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
}
return result;
@@ -4016,7 +4022,7 @@ int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx)

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "wilc_mq_send fail\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
}

@@ -4037,7 +4043,7 @@ static int host_int_get_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx)

result = wilc_enqueue_work(msg);
if (result) {
- netdev_err(vif->ndev, "wilc_mq_send fail\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
}

@@ -4057,7 +4063,7 @@ int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)

ret = wilc_enqueue_work(msg);
if (ret) {
- netdev_err(vif->ndev, "wilc_mq_send fail\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
kfree(msg);
}

@@ -4075,7 +4081,7 @@ int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power)

ret = wilc_enqueue_work(msg);
if (ret) {
- netdev_err(vif->ndev, "Failed to get TX PWR\n");
+ netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__);
} else {
wait_for_completion(&msg->work_comp);
*tx_power = msg->body.tx_power.tx_pwr;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 42c0128..0eb2715 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -741,7 +741,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
security = ENCRYPT_ENABLED | WPA | AES;
} else {
ret = -ENOTSUPP;
- netdev_err(dev, "Not supported cipher\n");
+ netdev_err(dev, "%s: Unsupported cipher\n",
+ __func__);
wilc_connecting = 0;
return ret;
}
@@ -995,7 +996,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
break;

default:
- netdev_err(netdev, "Not supported cipher\n");
+ netdev_err(netdev, "%s: Unsupported cipher\n", __func__);
ret = -ENOTSUPP;
}

@@ -1413,8 +1414,8 @@ void wilc_wfi_p2p_rx(struct net_device *dev, u8 *buff, u32 size)

default:
netdev_dbg(dev,
- "NOT HANDLED PUBLIC ACTION FRAME TYPE:%x\n",
- buff[ACTION_SUBTYPE_ID]);
+ "%s: Not handled action frame type:%x\n",
+ __func__, buff[ACTION_SUBTYPE_ID]);
break;
}
}
@@ -1620,8 +1621,8 @@ static int mgmt_tx(struct wiphy *wiphy,

default:
netdev_dbg(vif->ndev,
- "NOT HANDLED PUBLIC ACTION FRAME TYPE:%x\n",
- buf[ACTION_SUBTYPE_ID]);
+ "%s: Not handled action frame type:%x\n",
+ __func__, buf[ACTION_SUBTYPE_ID]);
break;
}
}
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 61dca05..6bac3f7 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1148,10 +1148,7 @@ int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, u16 wid, u8 *buffer,
if (!commit)
return ret_size;

- netdev_dbg(vif->ndev,
- "[WILC]PACKET Commit with sequence number %d\n",
- wilc->cfg_seq_no);
- netdev_dbg(vif->ndev, "Processing cfg_set()\n");
+ netdev_dbg(vif->ndev, "%s: seqno[%d]\n", __func__, wilc->cfg_seq_no);
wilc->cfg_frame_in_use = 1;

if (wilc_wlan_cfg_commit(vif, WILC_CFG_SET, drv_handler))
@@ -1159,7 +1156,7 @@ int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, u16 wid, u8 *buffer,

if (!wait_for_completion_timeout(&wilc->cfg_event,
msecs_to_jiffies(CFG_PKTS_TIMEOUT))) {
- netdev_dbg(vif->ndev, "Set Timed Out\n");
+ netdev_dbg(vif->ndev, "%s: Timed Out\n", __func__);
ret_size = 0;
}

@@ -1198,7 +1195,7 @@ int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, u16 wid, int commit,

if (!wait_for_completion_timeout(&wilc->cfg_event,
msecs_to_jiffies(CFG_PKTS_TIMEOUT))) {
- netdev_dbg(vif->ndev, "Get Timed Out\n");
+ netdev_dbg(vif->ndev, "%s: Timed Out\n", __func__);
ret_size = 0;
}
wilc->cfg_frame_in_use = 0;
--
2.7.4

2018-07-29 07:36:40

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 6/8] staging: wilc1000: rename 'rcvd_ch_cnt' element in 'user_scan_req' struct

Cleanup patch to use shorter name for 'rcvd_ch_cnt' to 'ch_cnt' to avoid
line over 80 character issue reported by checkpatch.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 12 ++++++------
drivers/staging/wilc1000/host_interface.h | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 0df4d9c..86d8aaf 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -792,7 +792,7 @@ static void handle_scan(struct work_struct *work)
goto error;
}

- hif_drv->usr_scan_req.rcvd_ch_cnt = 0;
+ hif_drv->usr_scan_req.ch_cnt = 0;

wid_list[index].id = WID_SSID_PROBE_REQ;
wid_list[index].type = WID_STR;
@@ -1406,7 +1406,7 @@ static void handle_rcvd_ntwrk_info(struct work_struct *work)
goto done;
}

- for (i = 0; i < scan_req->rcvd_ch_cnt; i++) {
+ for (i = 0; i < scan_req->ch_cnt; i++) {
if (memcmp(scan_req->net_info[i].bssid, info->bssid, 6) == 0) {
if (info->rssi <= scan_req->net_info[i].rssi) {
goto done;
@@ -1419,13 +1419,13 @@ static void handle_rcvd_ntwrk_info(struct work_struct *work)
}

if (found) {
- if (scan_req->rcvd_ch_cnt < MAX_NUM_SCANNED_NETWORKS) {
- scan_req->net_info[scan_req->rcvd_ch_cnt].rssi = info->rssi;
+ if (scan_req->ch_cnt < MAX_NUM_SCANNED_NETWORKS) {
+ scan_req->net_info[scan_req->ch_cnt].rssi = info->rssi;

- memcpy(scan_req->net_info[scan_req->rcvd_ch_cnt].bssid,
+ memcpy(scan_req->net_info[scan_req->ch_cnt].bssid,
info->bssid, 6);

- scan_req->rcvd_ch_cnt++;
+ scan_req->ch_cnt++;

info->new_network = true;
params = host_int_parse_join_bss_param(info);
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 9a016c5..3ddeec2 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -199,7 +199,7 @@ struct hidden_network {
struct user_scan_req {
wilc_scan_result scan_result;
void *arg;
- u32 rcvd_ch_cnt;
+ u32 ch_cnt;
struct found_net_info net_info[MAX_NUM_SCANNED_NETWORKS];
};

--
2.7.4

2018-07-29 07:36:21

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 1/8] staging: wilc1000: fix TODO to compile spi and sdio components in single module

Changes to compile module component along with SPI and SDIO module.
Previously 'wilc1000.ko' used to generate along with wilc-spi.ko or
wilc1000-sdio.ko module. After these changes only wilc1000-spi.ko or
wilc1000-sdio.ko modules are required for SPI and SDIO respectively.
These changes are done to address below TODO item.

- make SPI and SDIO components coexist in one build

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/Makefile | 3 ++-
drivers/staging/wilc1000/TODO | 1 -
drivers/staging/wilc1000/linux_wlan.c | 6 ++----
drivers/staging/wilc1000/wilc_debugfs.c | 7 ++-----
drivers/staging/wilc1000/wilc_wlan.c | 6 ------
drivers/staging/wilc1000/wilc_wlan_if.h | 2 ++
6 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
index ee7e26b..f7b07c0 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -1,5 +1,4 @@
# SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_WILC1000) += wilc1000.o

ccflags-y += -DFIRMWARE_1002=\"atmel/wilc1002_firmware.bin\" \
-DFIRMWARE_1003=\"atmel/wilc1003_firmware.bin\"
@@ -12,7 +11,9 @@ wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
wilc_wlan.o

obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o
+wilc1000-sdio-objs += $(wilc1000-objs)
wilc1000-sdio-objs += wilc_sdio.o

obj-$(CONFIG_WILC1000_SPI) += wilc1000-spi.o
+wilc1000-spi-objs += $(wilc1000-objs)
wilc1000-spi-objs += wilc_spi.o
diff --git a/drivers/staging/wilc1000/TODO b/drivers/staging/wilc1000/TODO
index 3d82bb0..6fd3a4c 100644
--- a/drivers/staging/wilc1000/TODO
+++ b/drivers/staging/wilc1000/TODO
@@ -1,5 +1,4 @@
TODO:
- rework comments and function headers(also coding style)
-- make spi and sdio components coexist in one build
- support soft-ap and p2p mode
- support resume/suspend function
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 64c5d69..c9e771a 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1033,8 +1033,8 @@ void wilc_netdev_cleanup(struct wilc *wilc)
}

kfree(wilc);
+ wilc_debugfs_remove();
}
-EXPORT_SYMBOL_GPL(wilc_netdev_cleanup);

static const struct net_device_ops wilc_netdev_ops = {
.ndo_init = mac_init_fn,
@@ -1057,6 +1057,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
if (!wl)
return -ENOMEM;

+ wilc_debugfs_init();
*wilc = wl;
wl->io_type = io_type;
wl->hif_func = ops;
@@ -1118,6 +1119,3 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,

return 0;
}
-EXPORT_SYMBOL_GPL(wilc_netdev_init);
-
-MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c
index 287c11b..ecbf3db 100644
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ b/drivers/staging/wilc1000/wilc_debugfs.c
@@ -28,7 +28,6 @@ static struct dentry *wilc_dir;

#define DBG_LEVEL_ALL (DEBUG | INFO | WRN | ERR)
static atomic_t WILC_DEBUG_LEVEL = ATOMIC_INIT(ERR);
-EXPORT_SYMBOL_GPL(WILC_DEBUG_LEVEL);

/*
* ----------------------------------------------------------------------------
@@ -105,7 +104,7 @@ static struct wilc_debugfs_info_t debugfs_info[] = {
},
};

-static int __init wilc_debugfs_init(void)
+int wilc_debugfs_init(void)
{
int i;
struct wilc_debugfs_info_t *info;
@@ -121,12 +120,10 @@ static int __init wilc_debugfs_init(void)
}
return 0;
}
-module_init(wilc_debugfs_init);

-static void __exit wilc_debugfs_remove(void)
+void wilc_debugfs_remove(void)
{
debugfs_remove_recursive(wilc_dir);
}
-module_exit(wilc_debugfs_remove);

#endif
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index ea2e77f..61dca05 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -407,7 +407,6 @@ void chip_allow_sleep(struct wilc *wilc)
wilc->hif_func->hif_write_reg(wilc, 0xf0, reg & ~BIT(0));
wilc->hif_func->hif_write_reg(wilc, 0xfa, 0);
}
-EXPORT_SYMBOL_GPL(chip_allow_sleep);

void chip_wakeup(struct wilc *wilc)
{
@@ -462,7 +461,6 @@ void chip_wakeup(struct wilc *wilc)
}
chip_ps_state = CHIP_WAKEDUP;
}
-EXPORT_SYMBOL_GPL(chip_wakeup);

void wilc_chip_sleep_manually(struct wilc *wilc)
{
@@ -476,7 +474,6 @@ void wilc_chip_sleep_manually(struct wilc *wilc)
chip_ps_state = CHIP_SLEEPING_MANUAL;
release_bus(wilc, RELEASE_ONLY);
}
-EXPORT_SYMBOL_GPL(wilc_chip_sleep_manually);

void host_wakeup_notify(struct wilc *wilc)
{
@@ -484,7 +481,6 @@ void host_wakeup_notify(struct wilc *wilc)
wilc->hif_func->hif_write_reg(wilc, 0x10b0, 1);
release_bus(wilc, RELEASE_ONLY);
}
-EXPORT_SYMBOL_GPL(host_wakeup_notify);

void host_sleep_notify(struct wilc *wilc)
{
@@ -492,7 +488,6 @@ void host_sleep_notify(struct wilc *wilc)
wilc->hif_func->hif_write_reg(wilc, 0x10ac, 1);
release_bus(wilc, RELEASE_ONLY);
}
-EXPORT_SYMBOL_GPL(host_sleep_notify);

int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
{
@@ -869,7 +864,6 @@ void wilc_handle_isr(struct wilc *wilc)

release_bus(wilc, RELEASE_ALLOW_SLEEP);
}
-EXPORT_SYMBOL_GPL(wilc_handle_isr);

int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer,
u32 buffer_size)
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 73b57fb..598c8dc 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -835,4 +835,6 @@ struct wilc;
int wilc_wlan_init(struct net_device *dev);
u32 wilc_get_chipid(struct wilc *wilc, bool update);

+int wilc_debugfs_init(void);
+void wilc_debugfs_remove(void);
#endif
--
2.7.4

2018-07-29 07:36:25

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 2/8] staging: wilc1000: remove unnecessary comments and comments description

Cleanup patch to remove the unnecessary comments and commented code.
Also updated description for few of comments.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 4 ++--
drivers/staging/wilc1000/linux_mon.c | 15 ++++++++-------
drivers/staging/wilc1000/wilc_debugfs.c | 11 -----------
drivers/staging/wilc1000/wilc_sdio.c | 10 +---------
drivers/staging/wilc1000/wilc_spi.c | 1 -
drivers/staging/wilc1000/wilc_wfi_netdevice.h | 5 -----
drivers/staging/wilc1000/wilc_wlan.h | 6 ------
drivers/staging/wilc1000/wilc_wlan_cfg.c | 5 -----
8 files changed, 11 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index c78b51a..d960147 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -230,7 +230,7 @@ static int wilc_enqueue_work(struct host_if_msg *msg)
return 0;
}

-/* The u8IfIdx starts from 0 to NUM_CONCURRENT_IFC -1, but 0 index used as
+/* The idx starts from 0 to (NUM_CONCURRENT_IFC - 1), but 0 index used as
* special purpose in wilc device, so we add 1 to the index to starts from 1.
* As a result, the returned index will be 1 to NUM_CONCURRENT_IFC.
*/
@@ -242,7 +242,7 @@ int wilc_get_vif_idx(struct wilc_vif *vif)
/* We need to minus 1 from idx which is from wilc device to get real index
* of wilc->vif[], because we add 1 when pass to wilc device in the function
* wilc_get_vif_idx.
- * As a result, the index should be between 0 and NUM_CONCURRENT_IFC -1.
+ * As a result, the index should be between 0 and (NUM_CONCURRENT_IFC - 1).
*/
static struct wilc_vif *wilc_get_vif_from_idx(struct wilc *wilc, int idx)
{
diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index 14405bf..fa49588 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -63,7 +63,7 @@ void wilc_wfi_monitor_rx(u8 *buff, u32 size)

cb_hdr->hdr.it_present = cpu_to_le32(TX_RADIOTAP_PRESENT);

- cb_hdr->rate = 5; /* txrate->bitrate / 5; */
+ cb_hdr->rate = 5;

if (pkt_offset & IS_MGMT_STATUS_SUCCES) {
/* success */
@@ -84,8 +84,8 @@ void wilc_wfi_monitor_rx(u8 *buff, u32 size)
hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */
hdr->hdr.it_len = cpu_to_le16(sizeof(*hdr));
hdr->hdr.it_present = cpu_to_le32
- (1 << IEEE80211_RADIOTAP_RATE); /* | */
- hdr->rate = 5; /* txrate->bitrate / 5; */
+ (1 << IEEE80211_RADIOTAP_RATE);
+ hdr->rate = 5;
}

skb->dev = wilc_wfi_mon;
@@ -178,7 +178,7 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,

cb_hdr->hdr.it_present = cpu_to_le32(TX_RADIOTAP_PRESENT);

- cb_hdr->rate = 5; /* txrate->bitrate / 5; */
+ cb_hdr->rate = 5;
cb_hdr->tx_flags = 0x0004;

skb2->dev = wilc_wfi_mon;
@@ -194,11 +194,12 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,
}
skb->dev = mon_priv->real_ndev;

- /* Identify if Ethernet or MAC header (data or mgmt) */
memcpy(srcadd, &skb->data[10], 6);
memcpy(bssid, &skb->data[16], 6);
- /* if source address and bssid fields are equal>>Mac header */
- /*send it to mgmt frames handler */
+ /*
+ * Identify if data or mgmt packet, if source address and bssid
+ * fields are equal send it to mgmt frames handler
+ */
if (!(memcmp(srcadd, bssid, 6))) {
ret = mon_mgmt_tx(mon_priv->real_ndev, skb->data, skb->len);
if (ret)
diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c
index ecbf3db..ac26e94 100644
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ b/drivers/staging/wilc1000/wilc_debugfs.c
@@ -18,9 +18,6 @@

static struct dentry *wilc_dir;

-/*
- * ----------------------------------------------------------------------------
- */
#define DEBUG BIT(0)
#define INFO BIT(1)
#define WRN BIT(2)
@@ -29,10 +26,6 @@ static struct dentry *wilc_dir;
#define DBG_LEVEL_ALL (DEBUG | INFO | WRN | ERR)
static atomic_t WILC_DEBUG_LEVEL = ATOMIC_INIT(ERR);

-/*
- * ----------------------------------------------------------------------------
- */
-
static ssize_t wilc_debug_level_read(struct file *file, char __user *userbuf,
size_t count, loff_t *ppos)
{
@@ -76,10 +69,6 @@ static ssize_t wilc_debug_level_write(struct file *filp,
return count;
}

-/*
- * ----------------------------------------------------------------------------
- */
-
#define FOPS(_open, _read, _write, _poll) { \
.owner = THIS_MODULE, \
.open = (_open), \
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 8a47147..0628237 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -809,9 +809,6 @@ static int sdio_read_size(struct wilc *wilc, u32 *size)
wilc_sdio_cmd52(wilc, &cmd);
tmp = cmd.data;

- /* cmd.read_write = 0; */
- /* cmd.function = 0; */
- /* cmd.raw = 0; */
cmd.address = 0xf3;
cmd.data = 0;
wilc_sdio_cmd52(wilc, &cmd);
@@ -1096,12 +1093,7 @@ static int sdio_sync_ext(struct wilc *wilc, int nint)
return 1;
}

-/********************************************
- *
- * Global sdio HIF function table
- *
- ********************************************/
-
+/* Global sdio HIF function table */
static const struct wilc_hif_func wilc_hif_sdio = {
.hif_init = sdio_init,
.hif_deinit = sdio_deinit,
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index fa9371b..5aa1f7b 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -767,7 +767,6 @@ static int wilc_spi_read_reg(struct wilc *wilc, u32 addr, u32 *data)
u8 clockless = 0;

if (addr < 0x30) {
- /* dev_err(&spi->dev, "***** read addr %d\n\n", addr); */
/* Clockless register */
cmd = CMD_INTERNAL_READ;
clockless = 1;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 331a971..371a87f 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -37,11 +37,6 @@ struct wilc_wfi_stats {

};

-/*
- * This structure is private to each device. It is used to pass
- * packets in and out, so there is place for a packet
- */
-
struct wilc_wfi_key {
u8 *key;
u8 *seq;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index f29d1ea..696cf1f 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -246,12 +246,6 @@ struct wilc_hif_func {
void (*disable_interrupt)(struct wilc *nic);
};

-/********************************************
- *
- * Configuration Structure
- *
- ********************************************/
-
#define MAX_CFG_FRAME_SIZE 1468

struct wilc_cfg_frame {
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index c0b9b70..331be7b 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -13,11 +13,6 @@
#include "wilc_wlan_cfg.h"
#include "coreconfigurator.h"

-/********************************************
- *
- * Global Data
- *
- ********************************************/
enum cfg_cmd_type {
CFG_BYTE_CMD = 0,
CFG_HWORD_CMD = 1,
--
2.7.4

2018-07-29 07:36:28

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 3/8] staging: wilc1000: remove unnecessary copyright information in file

Cleanup patch to remove the unnecessary copyright information in
the file, as it already has SPDX License Identifier.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_debugfs.c | 10 ----------
drivers/staging/wilc1000/wilc_sdio.c | 5 -----
drivers/staging/wilc1000/wilc_spi.c | 5 -----
drivers/staging/wilc1000/wilc_wlan_cfg.c | 8 --------
drivers/staging/wilc1000/wilc_wlan_cfg.h | 8 --------
5 files changed, 36 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c
index ac26e94..d86f457 100644
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ b/drivers/staging/wilc1000/wilc_debugfs.c
@@ -1,14 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-/*
- * NewportMedia WiFi chipset driver test tools - wilc-debug
- * Copyright (c) 2012 NewportMedia Inc.
- * Author: SSW <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */

#if defined(WILC_DEBUGFS)
#include <linux/module.h>
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 0628237..9e9279c 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -1,9 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (c) Atmel Corporation. All rights reserved.
- *
- * Module Name: wilc_sdio.c
- */

#include <linux/mmc/sdio_func.h>
#include <linux/mmc/host.h>
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 5aa1f7b..ef2460c 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -1,9 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (c) Atmel Corporation. All rights reserved.
- *
- * Module Name: wilc_spi.c
- */

#include <linux/spi/spi.h>

diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 331be7b..ec50eaf 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -1,12 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-/* ////////////////////////////////////////////////////////////////////////// */
-/* */
-/* Copyright (c) Atmel Corporation. All rights reserved. */
-/* */
-/* Module Name: wilc_wlan_cfg.c */
-/* */
-/* */
-/* ///////////////////////////////////////////////////////////////////////// */

#include "wilc_wlan_if.h"
#include "wilc_wlan.h"
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h b/drivers/staging/wilc1000/wilc_wlan_cfg.h
index 08092a5..d6c833b 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.h
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h
@@ -1,12 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 */
-/* ////////////////////////////////////////////////////////////////////////// */
-/* */
-/* Copyright (c) Atmel Corporation. All rights reserved. */
-/* */
-/* Module Name: wilc_wlan_cfg.h */
-/* */
-/* */
-/* ///////////////////////////////////////////////////////////////////////// */

#ifndef WILC_WLAN_CFG_H
#define WILC_WLAN_CFG_H
--
2.7.4

2018-07-29 07:36:43

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 7/8] staging: wilc1000: replace udelay with usleep_range

Cleanup patch to avoid the below checkpatch reported issue.

"usleep_range is preferred over udelay; see
Documentation/timers/timers-howto.txt".

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 6bac3f7..655952a 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -425,7 +425,7 @@ void chip_wakeup(struct wilc *wilc)
} while (wilc_get_chipid(wilc, true) == 0);
} else if ((wilc->io_type & 0x1) == HIF_SDIO) {
wilc->hif_func->hif_write_reg(wilc, 0xfa, 1);
- udelay(200);
+ usleep_range(200, 201);
wilc->hif_func->hif_read_reg(wilc, 0xf0, &reg);
do {
wilc->hif_func->hif_write_reg(wilc, 0xf0,
--
2.7.4

2018-07-29 07:36:47

by Ajay Singh

[permalink] [raw]
Subject: [PATCH 8/8] staging: wilc1000: added parentheses in macro to avoid checkpatch issue

Cleanup patch to fix below checkpatch reported issue:

Macro argument 'id' may be better as '(id)' to avoid precedence issues

Also updated the TODO file to remove the below item
'rework comments and function headers(also coding style)'

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/TODO | 1 -
drivers/staging/wilc1000/wilc_wlan.h | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/TODO b/drivers/staging/wilc1000/TODO
index 6fd3a4c..862e9ea 100644
--- a/drivers/staging/wilc1000/TODO
+++ b/drivers/staging/wilc1000/TODO
@@ -1,4 +1,3 @@
TODO:
-- rework comments and function headers(also coding style)
- support soft-ap and p2p mode
- support resume/suspend function
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 696cf1f..cd1ff85 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -4,7 +4,7 @@

#include <linux/types.h>

-#define ISWILC1000(id) ((id & 0xfffff000) == 0x100000 ? 1 : 0)
+#define ISWILC1000(id) (((id) & 0xfffff000) == 0x100000 ? 1 : 0)

/********************************************
*
--
2.7.4

2018-08-02 10:16:59

by Ajay Singh

[permalink] [raw]
Subject: Re: [PATCH 8/8] staging: wilc1000: added parentheses in macro to avoid checkpatch issue

Hi Greg,

On Thu, 2 Aug 2018 09:34:54 +0200
Greg KH <[email protected]> wrote:

> On Sun, Jul 29, 2018 at 11:36:57AM +0530, Ajay Singh wrote:
> > Cleanup patch to fix below checkpatch reported issue:
> > -#define ISWILC1000(id) ((id & 0xfffff000)
> > == 0x100000 ? 1 : 0) +#define ISWILC1000(id) (((id)
> > & 0xfffff000) == 0x100000 ? 1 : 0)
>
> Even better, make this an inline function that returns a boolean to
> avoid any potental problems.
>

Sure, I will make these changes and submit new patch.

Regards
Ajay

2018-08-02 10:14:25

by Ajay Singh

[permalink] [raw]
Subject: Re: [PATCH 3/8] staging: wilc1000: remove unnecessary copyright information in file

Hi Greg,

On Thu, 2 Aug 2018 09:33:17 +0200
Greg KH <[email protected]> wrote:

> On Sun, Jul 29, 2018 at 11:36:52AM +0530, Ajay Singh wrote:
> > Cleanup patch to remove the unnecessary copyright information in
> > the file, as it already has SPDX License Identifier.
> >
> > diff --git a/drivers/staging/wilc1000/wilc_debugfs.c
> > b/drivers/staging/wilc1000/wilc_debugfs.c index ac26e94..d86f457
> > 100644 --- a/drivers/staging/wilc1000/wilc_debugfs.c
> > +++ b/drivers/staging/wilc1000/wilc_debugfs.c
> > @@ -1,14 +1,4 @@
> > // SPDX-License-Identifier: GPL-2.0
> > -/*
> > - * NewportMedia WiFi chipset driver test tools - wilc-debug
> > - * Copyright (c) 2012 NewportMedia Inc.
> > - * Author: SSW <[email protected]>
>
> No, you can not just drop copyright lines for no reason at all. Did
> your lawyers approve this patch?
>

Actually, I had planned to keep Microchip Copyright header for these
files later, as currently these files has the previous
company copyright information.
I am not sure what will be right practice to either keep all
previous companies copyright or only the latest copyright information.

Its better to drop this for now and after consulting internally I will
submit the new patch.


> SPDX identifes the _license_ of the file, not the copyrights, so it is
> ok to drop these lines:
>
> > - *
> > - * This program is free software; you can redistribute it and/or
> > modify
> > - * it under the terms of the GNU General Public License version 2
> > as
> > - * published by the Free Software Foundation.
>
> As that is what it is replacing. But not the copyrights.
>
> Go show your lawyer this patch:
>
> > --- a/drivers/staging/wilc1000/wilc_sdio.c
> > +++ b/drivers/staging/wilc1000/wilc_sdio.c
> > @@ -1,9 +1,4 @@
> > // SPDX-License-Identifier: GPL-2.0
> > -/*
> > - * Copyright (c) Atmel Corporation. All rights reserved.
>
> And see what they do :)
>
> (yes, explicit copyright notices are really not needed and do not do
> "much", but it is still the norm that they are present and our
> industry does still rely on them...)
>
> thanks,
>
> greg k-h

2018-08-06 13:29:01

by Ajay Singh

[permalink] [raw]
Subject: Re: [PATCH 7/8] staging: wilc1000: replace udelay with usleep_range

Hi Greg,

On Sun, 5 Aug 2018 16:11:17 +0200
Greg KH <[email protected]> wrote:

> On Fri, Aug 03, 2018 at 01:58:51PM +0530, Ajay Singh wrote:
> > Hi Greg,
> >
> > On Thu, 2 Aug 2018 09:34:15 +0200
> > Greg KH <[email protected]> wrote:
> >
> > > On Sun, Jul 29, 2018 at 11:36:56AM +0530, Ajay Singh wrote:
> > > > Cleanup patch to avoid the below checkpatch reported issue.
> > > >
> > > > "usleep_range is preferred over udelay; see
> > > > Documentation/timers/timers-howto.txt".
> > > >
> > > > Signed-off-by: Ajay Singh <[email protected]>
> > > > ---
> > > > drivers/staging/wilc1000/wilc_wlan.c | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/staging/wilc1000/wilc_wlan.c
> > > > b/drivers/staging/wilc1000/wilc_wlan.c index 6bac3f7..655952a
> > > > 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c
> > > > +++ b/drivers/staging/wilc1000/wilc_wlan.c
> > > > @@ -425,7 +425,7 @@ void chip_wakeup(struct wilc *wilc)
> > > > } while (wilc_get_chipid(wilc, true) == 0);
> > > > } else if ((wilc->io_type & 0x1) == HIF_SDIO) {
> > > > wilc->hif_func->hif_write_reg(wilc, 0xfa, 1);
> > > > - udelay(200);
> > > > + usleep_range(200, 201);
> > >
> > > Hah, that's funny.
> > >
> > > No, do it right, don't try to game checkpatch here.
> >
> > The delay of 200us was added to have a short wait between HW
> > register write and read operation. The short delay of 200us was
> > enough for this but the duration range is not available. So to
> > replace udelay() of 200us with usleep_range(), I have used used
> > range from 200, 201.
>
> What do you mean that "the duration range is not available"? You know
> what is allowed here, please provide that range. You do know the
> reason for this suggestion from checkpatch, right? By doing what you
> did here, you are totally subverting the real goal here, you are not
> solving anything.


Actually, we need a delay of 200us but there is no upper limit for it.
usleep_range() also expects upper limit, so added '1us' to the
lower limit (200us) to use for upper limit value.

I will rework on this and resubmit the patch.

Thank you.

Regards,
Ajay

2018-08-02 09:24:49

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 8/8] staging: wilc1000: added parentheses in macro to avoid checkpatch issue

On Sun, Jul 29, 2018 at 11:36:57AM +0530, Ajay Singh wrote:
> Cleanup patch to fix below checkpatch reported issue:
>
> Macro argument 'id' may be better as '(id)' to avoid precedence issues
>
> Also updated the TODO file to remove the below item
> 'rework comments and function headers(also coding style)'
>
> Signed-off-by: Ajay Singh <[email protected]>
> ---
> drivers/staging/wilc1000/TODO | 1 -
> drivers/staging/wilc1000/wilc_wlan.h | 2 +-
> 2 files changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/TODO b/drivers/staging/wilc1000/TODO
> index 6fd3a4c..862e9ea 100644
> --- a/drivers/staging/wilc1000/TODO
> +++ b/drivers/staging/wilc1000/TODO
> @@ -1,4 +1,3 @@
> TODO:
> -- rework comments and function headers(also coding style)
> - support soft-ap and p2p mode
> - support resume/suspend function
> diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
> index 696cf1f..cd1ff85 100644
> --- a/drivers/staging/wilc1000/wilc_wlan.h
> +++ b/drivers/staging/wilc1000/wilc_wlan.h
> @@ -4,7 +4,7 @@
>
> #include <linux/types.h>
>
> -#define ISWILC1000(id) ((id & 0xfffff000) == 0x100000 ? 1 : 0)
> +#define ISWILC1000(id) (((id) & 0xfffff000) == 0x100000 ? 1 : 0)

Even better, make this an inline function that returns a boolean to
avoid any potental problems.

thanks,

greg k-h

2018-08-02 09:23:11

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 3/8] staging: wilc1000: remove unnecessary copyright information in file

On Sun, Jul 29, 2018 at 11:36:52AM +0530, Ajay Singh wrote:
> Cleanup patch to remove the unnecessary copyright information in
> the file, as it already has SPDX License Identifier.
>
> Signed-off-by: Ajay Singh <[email protected]>
> ---
> drivers/staging/wilc1000/wilc_debugfs.c | 10 ----------
> drivers/staging/wilc1000/wilc_sdio.c | 5 -----
> drivers/staging/wilc1000/wilc_spi.c | 5 -----
> drivers/staging/wilc1000/wilc_wlan_cfg.c | 8 --------
> drivers/staging/wilc1000/wilc_wlan_cfg.h | 8 --------
> 5 files changed, 36 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c
> index ac26e94..d86f457 100644
> --- a/drivers/staging/wilc1000/wilc_debugfs.c
> +++ b/drivers/staging/wilc1000/wilc_debugfs.c
> @@ -1,14 +1,4 @@
> // SPDX-License-Identifier: GPL-2.0
> -/*
> - * NewportMedia WiFi chipset driver test tools - wilc-debug
> - * Copyright (c) 2012 NewportMedia Inc.
> - * Author: SSW <[email protected]>

No, you can not just drop copyright lines for no reason at all. Did
your lawyers approve this patch?

SPDX identifes the _license_ of the file, not the copyrights, so it is
ok to drop these lines:

> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.

As that is what it is replacing. But not the copyrights.

Go show your lawyer this patch:

> --- a/drivers/staging/wilc1000/wilc_sdio.c
> +++ b/drivers/staging/wilc1000/wilc_sdio.c
> @@ -1,9 +1,4 @@
> // SPDX-License-Identifier: GPL-2.0
> -/*
> - * Copyright (c) Atmel Corporation. All rights reserved.

And see what they do :)

(yes, explicit copyright notices are really not needed and do not do
"much", but it is still the norm that they are present and our industry
does still rely on them...)

thanks,

greg k-h

2018-08-03 10:24:15

by Ajay Singh

[permalink] [raw]
Subject: Re: [PATCH 7/8] staging: wilc1000: replace udelay with usleep_range

Hi Greg,

On Thu, 2 Aug 2018 09:34:15 +0200
Greg KH <[email protected]> wrote:

> On Sun, Jul 29, 2018 at 11:36:56AM +0530, Ajay Singh wrote:
> > Cleanup patch to avoid the below checkpatch reported issue.
> >
> > "usleep_range is preferred over udelay; see
> > Documentation/timers/timers-howto.txt".
> >
> > Signed-off-by: Ajay Singh <[email protected]>
> > ---
> > drivers/staging/wilc1000/wilc_wlan.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/wilc1000/wilc_wlan.c
> > b/drivers/staging/wilc1000/wilc_wlan.c index 6bac3f7..655952a 100644
> > --- a/drivers/staging/wilc1000/wilc_wlan.c
> > +++ b/drivers/staging/wilc1000/wilc_wlan.c
> > @@ -425,7 +425,7 @@ void chip_wakeup(struct wilc *wilc)
> > } while (wilc_get_chipid(wilc, true) == 0);
> > } else if ((wilc->io_type & 0x1) == HIF_SDIO) {
> > wilc->hif_func->hif_write_reg(wilc, 0xfa, 1);
> > - udelay(200);
> > + usleep_range(200, 201);
>
> Hah, that's funny.
>
> No, do it right, don't try to game checkpatch here.

The delay of 200us was added to have a short wait between HW register
write and read operation. The short delay of 200us was enough for this
but the duration range is not available. So to replace udelay() of
200us with usleep_range(), I have used used range from 200, 201.

How should we handle these type of scenarios and is there any suggested
way to specify these range.

Should we leave this code as it is and ignore this checkpatch warning.

Please provide your suggestion/input.

Thank you.

Regards,
Ajay

2018-08-05 16:16:05

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 7/8] staging: wilc1000: replace udelay with usleep_range

On Fri, Aug 03, 2018 at 01:58:51PM +0530, Ajay Singh wrote:
> Hi Greg,
>
> On Thu, 2 Aug 2018 09:34:15 +0200
> Greg KH <[email protected]> wrote:
>
> > On Sun, Jul 29, 2018 at 11:36:56AM +0530, Ajay Singh wrote:
> > > Cleanup patch to avoid the below checkpatch reported issue.
> > >
> > > "usleep_range is preferred over udelay; see
> > > Documentation/timers/timers-howto.txt".
> > >
> > > Signed-off-by: Ajay Singh <[email protected]>
> > > ---
> > > drivers/staging/wilc1000/wilc_wlan.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/staging/wilc1000/wilc_wlan.c
> > > b/drivers/staging/wilc1000/wilc_wlan.c index 6bac3f7..655952a 100644
> > > --- a/drivers/staging/wilc1000/wilc_wlan.c
> > > +++ b/drivers/staging/wilc1000/wilc_wlan.c
> > > @@ -425,7 +425,7 @@ void chip_wakeup(struct wilc *wilc)
> > > } while (wilc_get_chipid(wilc, true) == 0);
> > > } else if ((wilc->io_type & 0x1) == HIF_SDIO) {
> > > wilc->hif_func->hif_write_reg(wilc, 0xfa, 1);
> > > - udelay(200);
> > > + usleep_range(200, 201);
> >
> > Hah, that's funny.
> >
> > No, do it right, don't try to game checkpatch here.
>
> The delay of 200us was added to have a short wait between HW register
> write and read operation. The short delay of 200us was enough for this
> but the duration range is not available. So to replace udelay() of
> 200us with usleep_range(), I have used used range from 200, 201.

What do you mean that "the duration range is not available"? You know
what is allowed here, please provide that range. You do know the reason
for this suggestion from checkpatch, right? By doing what you did here,
you are totally subverting the real goal here, you are not solving
anything.

thanks,

greg k-h

2018-08-02 09:24:09

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 7/8] staging: wilc1000: replace udelay with usleep_range

On Sun, Jul 29, 2018 at 11:36:56AM +0530, Ajay Singh wrote:
> Cleanup patch to avoid the below checkpatch reported issue.
>
> "usleep_range is preferred over udelay; see
> Documentation/timers/timers-howto.txt".
>
> Signed-off-by: Ajay Singh <[email protected]>
> ---
> drivers/staging/wilc1000/wilc_wlan.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
> index 6bac3f7..655952a 100644
> --- a/drivers/staging/wilc1000/wilc_wlan.c
> +++ b/drivers/staging/wilc1000/wilc_wlan.c
> @@ -425,7 +425,7 @@ void chip_wakeup(struct wilc *wilc)
> } while (wilc_get_chipid(wilc, true) == 0);
> } else if ((wilc->io_type & 0x1) == HIF_SDIO) {
> wilc->hif_func->hif_write_reg(wilc, 0xfa, 1);
> - udelay(200);
> + usleep_range(200, 201);

Hah, that's funny.

No, do it right, don't try to game checkpatch here.

greg k-h