diff options
author | Tejun Heo <tj@kernel.org> | 2015-02-13 17:37:45 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-14 00:21:38 -0500 |
commit | 898600380ccdc5de24e3a1fea2537df41e43fa87 (patch) | |
tree | 1cbcb8103a966d75ba8910a77cda29c7691a9404 | |
parent | f09068276c5cbe2dd76679b2c9fcc91e12eb7ebe (diff) |
wireless: use %*pb[l] to print bitmaps including cpumasks and nodemasks
printk and friends can now format bitmaps using '%*pb[l]'. cpumask
and nodemask also provide cpumask_pr_args() and nodemask_pr_args()
respectively which can be used to generate the two printf arguments
necessary to format the specified cpu/nodemask.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: "John W. Linville" <linville@tuxdriver.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 23 | ||||
-rw-r--r-- | drivers/net/wireless/ath/carl9170/debug.c | 24 |
2 files changed, 12 insertions, 35 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c index 8cef1edcc621..dc79afd7e151 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c | |||
@@ -291,26 +291,15 @@ static ssize_t read_file_slot(struct file *file, char __user *user_buf, | |||
291 | { | 291 | { |
292 | struct ath9k_htc_priv *priv = file->private_data; | 292 | struct ath9k_htc_priv *priv = file->private_data; |
293 | char buf[512]; | 293 | char buf[512]; |
294 | unsigned int len = 0; | 294 | unsigned int len; |
295 | 295 | ||
296 | spin_lock_bh(&priv->tx.tx_lock); | 296 | spin_lock_bh(&priv->tx.tx_lock); |
297 | 297 | len = scnprintf(buf, sizeof(buf), | |
298 | len += scnprintf(buf + len, sizeof(buf) - len, "TX slot bitmap : "); | 298 | "TX slot bitmap : %*pb\n" |
299 | 299 | "Used slots : %d\n", | |
300 | len += bitmap_scnprintf(buf + len, sizeof(buf) - len, | 300 | MAX_TX_BUF_NUM, priv->tx.tx_slot, |
301 | priv->tx.tx_slot, MAX_TX_BUF_NUM); | 301 | bitmap_weight(priv->tx.tx_slot, MAX_TX_BUF_NUM)); |
302 | |||
303 | len += scnprintf(buf + len, sizeof(buf) - len, "\n"); | ||
304 | |||
305 | len += scnprintf(buf + len, sizeof(buf) - len, | ||
306 | "Used slots : %d\n", | ||
307 | bitmap_weight(priv->tx.tx_slot, MAX_TX_BUF_NUM)); | ||
308 | |||
309 | spin_unlock_bh(&priv->tx.tx_lock); | 302 | spin_unlock_bh(&priv->tx.tx_lock); |
310 | |||
311 | if (len > sizeof(buf)) | ||
312 | len = sizeof(buf); | ||
313 | |||
314 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | 303 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
315 | } | 304 | } |
316 | 305 | ||
diff --git a/drivers/net/wireless/ath/carl9170/debug.c b/drivers/net/wireless/ath/carl9170/debug.c index 1c0af9cd9a85..6808db433283 100644 --- a/drivers/net/wireless/ath/carl9170/debug.c +++ b/drivers/net/wireless/ath/carl9170/debug.c | |||
@@ -214,14 +214,10 @@ DEBUGFS_DECLARE_RO_FILE(name, _read_bufsize) | |||
214 | static char *carl9170_debugfs_mem_usage_read(struct ar9170 *ar, char *buf, | 214 | static char *carl9170_debugfs_mem_usage_read(struct ar9170 *ar, char *buf, |
215 | size_t bufsize, ssize_t *len) | 215 | size_t bufsize, ssize_t *len) |
216 | { | 216 | { |
217 | ADD(buf, *len, bufsize, "jar: ["); | ||
218 | |||
219 | spin_lock_bh(&ar->mem_lock); | 217 | spin_lock_bh(&ar->mem_lock); |
220 | 218 | ||
221 | *len += bitmap_scnprintf(&buf[*len], bufsize - *len, | 219 | ADD(buf, *len, bufsize, "jar: [%*pb]\n", |
222 | ar->mem_bitmap, ar->fw.mem_blocks); | 220 | ar->fw.mem_blocks, ar->mem_bitmap); |
223 | |||
224 | ADD(buf, *len, bufsize, "]\n"); | ||
225 | 221 | ||
226 | ADD(buf, *len, bufsize, "cookies: used:%3d / total:%3d, allocs:%d\n", | 222 | ADD(buf, *len, bufsize, "cookies: used:%3d / total:%3d, allocs:%d\n", |
227 | bitmap_weight(ar->mem_bitmap, ar->fw.mem_blocks), | 223 | bitmap_weight(ar->mem_bitmap, ar->fw.mem_blocks), |
@@ -316,17 +312,13 @@ static char *carl9170_debugfs_ampdu_state_read(struct ar9170 *ar, char *buf, | |||
316 | cnt, iter->tid, iter->bsn, iter->snx, iter->hsn, | 312 | cnt, iter->tid, iter->bsn, iter->snx, iter->hsn, |
317 | iter->max, iter->state, iter->counter); | 313 | iter->max, iter->state, iter->counter); |
318 | 314 | ||
319 | ADD(buf, *len, bufsize, "\tWindow: ["); | 315 | ADD(buf, *len, bufsize, "\tWindow: [%*pb,W]\n", |
320 | 316 | CARL9170_BAW_BITS, iter->bitmap); | |
321 | *len += bitmap_scnprintf(&buf[*len], bufsize - *len, | ||
322 | iter->bitmap, CARL9170_BAW_BITS); | ||
323 | 317 | ||
324 | #define BM_STR_OFF(offset) \ | 318 | #define BM_STR_OFF(offset) \ |
325 | ((CARL9170_BAW_BITS - (offset) - 1) / 4 + \ | 319 | ((CARL9170_BAW_BITS - (offset) - 1) / 4 + \ |
326 | (CARL9170_BAW_BITS - (offset) - 1) / 32 + 1) | 320 | (CARL9170_BAW_BITS - (offset) - 1) / 32 + 1) |
327 | 321 | ||
328 | ADD(buf, *len, bufsize, ",W]\n"); | ||
329 | |||
330 | offset = BM_STR_OFF(0); | 322 | offset = BM_STR_OFF(0); |
331 | ADD(buf, *len, bufsize, "\tBase Seq: %*s\n", offset, "T"); | 323 | ADD(buf, *len, bufsize, "\tBase Seq: %*s\n", offset, "T"); |
332 | 324 | ||
@@ -448,12 +440,8 @@ static char *carl9170_debugfs_vif_dump_read(struct ar9170 *ar, char *buf, | |||
448 | ADD(buf, *len, bufsize, "registered VIFs:%d \\ %d\n", | 440 | ADD(buf, *len, bufsize, "registered VIFs:%d \\ %d\n", |
449 | ar->vifs, ar->fw.vif_num); | 441 | ar->vifs, ar->fw.vif_num); |
450 | 442 | ||
451 | ADD(buf, *len, bufsize, "VIF bitmap: ["); | 443 | ADD(buf, *len, bufsize, "VIF bitmap: [%*pb]\n", |
452 | 444 | ar->fw.vif_num, &ar->vif_bitmap); | |
453 | *len += bitmap_scnprintf(&buf[*len], bufsize - *len, | ||
454 | &ar->vif_bitmap, ar->fw.vif_num); | ||
455 | |||
456 | ADD(buf, *len, bufsize, "]\n"); | ||
457 | 445 | ||
458 | rcu_read_lock(); | 446 | rcu_read_lock(); |
459 | list_for_each_entry_rcu(iter, &ar->vif_list, list) { | 447 | list_for_each_entry_rcu(iter, &ar->vif_list, list) { |