Skip to contentSkip to conversation

ath6kl: more checkpatch fixes

PATCH Applied Kalle Valo 1 participant 6 messages Mar 12, 2012 – Mar 13, 2012 Atheros ATH6KL wireless driver

lore
Share & tools
lore

Kalle Valo

author
#0 lore raw

cover ath6kl: more checkpatch fixes

Few more checkpatch fixes and one fix for a regression from my previous checkpatch fixes.

---

Kalle Valo (4):
ath6kl: fix regression in ath6kl_upload_board_file()
ath6kl: replace strict_strtoul() with kstrtoul()
ath6kl: fix open parenthesis alignment in ath6kl_sdio_suspend()
ath6kl: use max_t() in ath6kl_cfg80211_connect()

 drivers/net/wireless/ath/ath6kl/cfg80211.c |    4 ++--
 drivers/net/wireless/ath/ath6kl/debug.c    |   19 ++-----------------
 drivers/net/wireless/ath/ath6kl/init.c     |    3 ++-
 drivers/net/wireless/ath/ath6kl/sdio.c     |    9 +++++----
 4 files changed, 11 insertions(+), 24 deletions(-)
author
#1 lore raw

PATCH 1/4 ath6kl: fix regression in ath6kl_upload_board_file()

My patch 24fc32b3 ("ath6kl: add ath6kl_bmi_write_hi32()") caused a regression in ath6kl_upload_board_file() and the board_address variable was not properly initialised in some cases:

ath6kl/init.c:1068:6: warning: ‘board_address’ may be used uninitialized in this function

Most likely this broke ar6004 support but I can't test that right now.

---
 drivers/net/wireless/ath/ath6kl/init.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/wireless/ath/ath6kl/init.c +2 -1
index 231675d..03cae14 100644
@@ -1078,8 +1078,9 @@ static int ath6kl_upload_board_file(struct ath6kl *ar)
 	 * writing board data.
 	 */
 	if (ar->hw.board_addr != 0) {
+		board_address = ar->hw.board_addr;
 		ath6kl_bmi_write_hi32(ar, hi_board_data,
-				      ar->hw.board_addr);
+				      board_address);
 	} else {
 		ath6kl_bmi_read_hi32(ar, hi_board_data, &board_address);
 	}
author
#2 lore raw

PATCH 2/4 ath6kl: replace strict_strtoul() with kstrtoul()

In reply to Kalle Valo

Recommended by checkpatch.

---
 drivers/net/wireless/ath/ath6kl/debug.c |   19 ++-----------------
 1 files changed, 2 insertions(+), 17 deletions(-)
drivers/net/wireless/ath/ath6kl/debug.c +2 -17
index 9170b05..552adb3 100755
@@ -856,17 +856,9 @@ static ssize_t ath6kl_regread_write(struct file *file,
 				    size_t count, loff_t *ppos)
 {
 	struct ath6kl *ar = file->private_data;
-	u8 buf[50];
-	unsigned int len;
 	unsigned long reg_addr;
 
-	len = min(count, sizeof(buf) - 1);
-	if (copy_from_user(buf, user_buf, len))
-		return -EFAULT;
-
-	buf[len] = '\0';
-
-	if (strict_strtoul(buf, 0, &reg_addr))
+	if (kstrtoul_from_user(user_buf, count, 0, &reg_addr))
 		return -EINVAL;
 
 	if ((reg_addr % 4) != 0)
@@ -980,15 +972,8 @@ static ssize_t ath6kl_lrssi_roam_write(struct file *file,
 {
 	struct ath6kl *ar = file->private_data;
 	unsigned long lrssi_roam_threshold;
-	char buf[32];
-	ssize_t len;
 
-	len = min(count, sizeof(buf) - 1);
-	if (copy_from_user(buf, user_buf, len))
-		return -EFAULT;
-
-	buf[len] = '\0';
-	if (strict_strtoul(buf, 0, &lrssi_roam_threshold))
+	if (kstrtoul_from_user(user_buf, count, 0, &lrssi_roam_threshold))
 		return -EINVAL;
 
 	ar->lrssi_roam_threshold = lrssi_roam_threshold;
author
#3 lore raw

PATCH 3/4 ath6kl: fix open parenthesis alignment in ath6kl_sdio_suspend()

In reply to Kalle Valo

ath6kl/sdio.c:875: CHECK: Alignment should match open parenthesis

---
 drivers/net/wireless/ath/ath6kl/sdio.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath6kl/sdio.c +5 -4
index 5a03082..5352864 100644
@@ -871,12 +871,13 @@ static int ath6kl_sdio_suspend(struct ath6kl *ar, struct cfg80211_wowlan *wow)
 		if (ret && ret != -ENOTCONN)
 			ath6kl_err("wow suspend failed: %d\n", ret);
 
-		if (ret && (!ar->wow_suspend_mode ||
-		    ar->wow_suspend_mode == WLAN_POWER_STATE_DEEP_SLEEP))
-				try_deepsleep = true;
+		if (ret &&
+		    (!ar->wow_suspend_mode ||
+		     ar->wow_suspend_mode == WLAN_POWER_STATE_DEEP_SLEEP))
+			try_deepsleep = true;
 		else if (ret &&
 			 ar->wow_suspend_mode == WLAN_POWER_STATE_CUT_PWR)
-				goto cut_pwr;
+			goto cut_pwr;
 		if (!ret)
 			return 0;
 	}
author
#4 lore raw

PATCH 4/4 ath6kl: use max_t() in ath6kl_cfg80211_connect()

In reply to Kalle Valo

ath6kl/cfg80211.c:589: WARNING: max() should probably be max_t(u16, vif->listen_intvl_t, ATH6KL_MAX_WOW_LISTEN_INTL)

---
 drivers/net/wireless/ath/ath6kl/cfg80211.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath6kl/cfg80211.c +2 -2
index 5ecc53a..00d3895 100644
@@ -586,8 +586,8 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
 	vif->reconnect_flag = 0;
 
 	if (vif->nw_type == INFRA_NETWORK) {
-		interval = max(vif->listen_intvl_t,
-			       (u16) ATH6KL_MAX_WOW_LISTEN_INTL);
+		interval = max_t(u16, vif->listen_intvl_t,
+				 ATH6KL_MAX_WOW_LISTEN_INTL);
 		status = ath6kl_wmi_listeninterval_cmd(ar->wmi, vif->fw_vif_idx,
 						       interval,
 						       0);
author Applied
#5 lore raw
In reply to Kalle Valo
Quoted 2 lines · Kalle Valo

Few more checkpatch fixes and one fix for a regression from my previous checkpatch fixes.

Applied.

Kalle