diff options
author | Tejun Heo <tj@kernel.org> | 2015-02-13 17:37:12 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-14 00:21:37 -0500 |
commit | bf58b4879c33b3475a33740562ebf6583f531d4a (patch) | |
tree | 41f7bb24b58214aa07a38a3bf03d4781bf61348c /arch/x86/kernel/cpu/intel_cacheinfo.c | |
parent | 839b268033c5d1316b2f8cf49184984e6f335fee (diff) |
x86: 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.
* Unnecessary buffer size calculation and condition on the lenght
removed from intel_cacheinfo.c::show_shared_cpu_map_func().
* uv_nmi_nr_cpus_pr() got overly smart and implemented "..."
abbreviation if the output stretched over the predefined 1024 byte
buffer. Replaced with plain printk.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Mike Travis <travis@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86/kernel/cpu/intel_cacheinfo.c')
-rw-r--r-- | arch/x86/kernel/cpu/intel_cacheinfo.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index c7035073dfc1..659643376dbf 100644 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c | |||
@@ -952,20 +952,18 @@ static ssize_t show_size(struct _cpuid4_info *this_leaf, char *buf, | |||
952 | static ssize_t show_shared_cpu_map_func(struct _cpuid4_info *this_leaf, | 952 | static ssize_t show_shared_cpu_map_func(struct _cpuid4_info *this_leaf, |
953 | int type, char *buf) | 953 | int type, char *buf) |
954 | { | 954 | { |
955 | ptrdiff_t len = PTR_ALIGN(buf + PAGE_SIZE - 1, PAGE_SIZE) - buf; | 955 | const struct cpumask *mask = to_cpumask(this_leaf->shared_cpu_map); |
956 | int n = 0; | 956 | int ret; |
957 | 957 | ||
958 | if (len > 1) { | 958 | if (type) |
959 | const struct cpumask *mask; | 959 | ret = scnprintf(buf, PAGE_SIZE - 1, "%*pbl", |
960 | 960 | cpumask_pr_args(mask)); | |
961 | mask = to_cpumask(this_leaf->shared_cpu_map); | 961 | else |
962 | n = type ? | 962 | ret = scnprintf(buf, PAGE_SIZE - 1, "%*pb", |
963 | cpulist_scnprintf(buf, len-2, mask) : | 963 | cpumask_pr_args(mask)); |
964 | cpumask_scnprintf(buf, len-2, mask); | 964 | buf[ret++] = '\n'; |
965 | buf[n++] = '\n'; | 965 | buf[ret] = '\0'; |
966 | buf[n] = '\0'; | 966 | return ret; |
967 | } | ||
968 | return n; | ||
969 | } | 967 | } |
970 | 968 | ||
971 | static inline ssize_t show_shared_cpu_map(struct _cpuid4_info *leaf, char *buf, | 969 | static inline ssize_t show_shared_cpu_map(struct _cpuid4_info *leaf, char *buf, |