Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5e88ba62 authored by Zefir Kurtisi's avatar Zefir Kurtisi Committed by John W. Linville
Browse files

ath9k: replace snprintf() with scnprintf()



Whenever the return value of snprintf() is used to calculate
remaining buffer-space, we wanted to use sncprintf() instead.

Indentation is adapted where possible. Some lines exceed the
line width limit, either they did it already before, or
since they can not be broken reasonably well.

Signed-off-by: default avatarZefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent bf7c756c
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -3427,11 +3427,11 @@ static u32 ath9k_hw_ar9003_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr,
	struct ar9300_base_eep_hdr *pBase;

	if (!dump_base_hdr) {
		len += snprintf(buf + len, size - len,
		len += scnprintf(buf + len, size - len,
				 "%20s :\n", "2GHz modal Header");
		len = ar9003_dump_modal_eeprom(buf, len, size,
						&eep->modalHeader2G);
		len += snprintf(buf + len, size - len,
		len += scnprintf(buf + len, size - len,
				 "%20s :\n", "5GHz modal Header");
		len = ar9003_dump_modal_eeprom(buf, len, size,
						&eep->modalHeader5G);
@@ -3482,7 +3482,7 @@ static u32 ath9k_hw_ar9003_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr,
	PR_EEP("Rx Gain", pBase->txrxgain & 0xf);
	PR_EEP("SW Reg", le32_to_cpu(pBase->swreg));

	len += snprintf(buf + len, size - len, "%20s : %pM\n", "MacAddress",
	len += scnprintf(buf + len, size - len, "%20s : %pM\n", "MacAddress",
			 ah->eeprom.ar9300_eep.macAddr);
out:
	if (len > size)
+2 −2
Original line number Diff line number Diff line
@@ -459,7 +459,7 @@ void ath9k_queue_reset(struct ath_softc *sc, enum ath_reset_type type);

#define ATH_DUMP_BTCOEX(_s, _val)				\
	do {							\
		len += snprintf(buf + len, size - len,		\
		len += scnprintf(buf + len, size - len,		\
				 "%20s : %10d\n", _s, (_val));	\
	} while (0)

+224 −222

File changed.

Preview size limit exceeded, changes collapsed.

+6 −6
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ struct ath_tx_stats {
#define TXSTATS sc->debug.stats.txstats
#define PR(str, elem)							\
	do {								\
		len += snprintf(buf + len, size - len,			\
		len += scnprintf(buf + len, size - len,			\
				 "%s%13u%11u%10u%10u\n", str,		\
				 TXSTATS[PR_QNUM(IEEE80211_AC_BE)].elem,\
				 TXSTATS[PR_QNUM(IEEE80211_AC_BK)].elem,\
+13 −12
Original line number Diff line number Diff line
@@ -25,10 +25,10 @@
struct ath_dfs_pool_stats global_dfs_pool_stats = { 0 };

#define ATH9K_DFS_STAT(s, p) \
	len += snprintf(buf + len, size - len, "%28s : %10u\n", s, \
	len += scnprintf(buf + len, size - len, "%28s : %10u\n", s, \
			 sc->debug.stats.dfs_stats.p);
#define ATH9K_DFS_POOL_STAT(s, p) \
	len += snprintf(buf + len, size - len, "%28s : %10u\n", s, \
	len += scnprintf(buf + len, size - len, "%28s : %10u\n", s, \
			 global_dfs_pool_stats.p);

static ssize_t read_file_dfs(struct file *file, char __user *user_buf,
@@ -44,12 +44,12 @@ static ssize_t read_file_dfs(struct file *file, char __user *user_buf,
	if (buf == NULL)
		return -ENOMEM;

	len += snprintf(buf + len, size - len, "DFS support for "
	len += scnprintf(buf + len, size - len, "DFS support for "
			 "macVersion = 0x%x, macRev = 0x%x: %s\n",
			 hw_ver->macVersion, hw_ver->macRev,
			 (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_DFS) ?
					"enabled" : "disabled");
	len += snprintf(buf + len, size - len, "Pulse detector statistics:\n");
	len += scnprintf(buf + len, size - len, "Pulse detector statistics:\n");
	ATH9K_DFS_STAT("pulse events reported   ", pulses_total);
	ATH9K_DFS_STAT("invalid pulse events    ", pulses_no_dfs);
	ATH9K_DFS_STAT("DFS pulses detected     ", pulses_detected);
@@ -59,11 +59,12 @@ static ssize_t read_file_dfs(struct file *file, char __user *user_buf,
	ATH9K_DFS_STAT("Primary channel pulses  ", pri_phy_errors);
	ATH9K_DFS_STAT("Secondary channel pulses", ext_phy_errors);
	ATH9K_DFS_STAT("Dual channel pulses     ", dc_phy_errors);
	len += snprintf(buf + len, size - len, "Radar detector statistics "
			"(current DFS region: %d)\n", sc->dfs_detector->region);
	len += scnprintf(buf + len, size - len, "Radar detector statistics "
			 "(current DFS region: %d)\n",
			 sc->dfs_detector->region);
	ATH9K_DFS_STAT("Pulse events processed  ", pulses_processed);
	ATH9K_DFS_STAT("Radars detected         ", radar_detected);
	len += snprintf(buf + len, size - len, "Global Pool statistics:\n");
	len += scnprintf(buf + len, size - len, "Global Pool statistics:\n");
	ATH9K_DFS_POOL_STAT("Pool references         ", pool_reference);
	ATH9K_DFS_POOL_STAT("Pulses allocated        ", pulse_allocated);
	ATH9K_DFS_POOL_STAT("Pulses alloc error      ", pulse_alloc_error);
Loading