summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2020-09-16 13:40:44 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-10-02 13:24:40 +0200
commite015e036aea58fe5b7f92d2d4fff9f4364e649c8 (patch)
tree08213ad24192567287d3030f64c95383ba78c5e0 /drivers/base
parent7981593bf083801035b1f1377661849805acb216 (diff)
downloadlinux-stable-e015e036aea58fe5b7f92d2d4fff9f4364e649c8.tar.gz
linux-stable-e015e036aea58fe5b7f92d2d4fff9f4364e649c8.tar.bz2
linux-stable-e015e036aea58fe5b7f92d2d4fff9f4364e649c8.zip
drivers core: Use sysfs_emit for shared_cpu_map_show and shared_cpu_list_show
Do not indirect the bitmap printing of these shared_cpu show functions by using cpumap_print_to_pagebuf/bitmap_print_to_pagebuf. Use the more typical style with the vsnprintf %*pb and %*pbl extensions directly so there is no possible mixup about the use of offset_in_page(buf) by bitmap_print_to_pagebuf. Signed-off-by: Joe Perches <joe@perches.com> Link: https://lore.kernel.org/r/80457b467ab6cde13a173cfd8a4f49cd8467a7fd.1600285923.git.joe@perches.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/cacheinfo.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c
index 4946647bd985..bfc095956dd1 100644
--- a/drivers/base/cacheinfo.c
+++ b/drivers/base/cacheinfo.c
@@ -380,24 +380,22 @@ static ssize_t size_show(struct device *dev,
return sysfs_emit(buf, "%uK\n", this_leaf->size >> 10);
}
-static ssize_t shared_cpumap_show_func(struct device *dev, bool list, char *buf)
+static ssize_t shared_cpu_map_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
struct cacheinfo *this_leaf = dev_get_drvdata(dev);
const struct cpumask *mask = &this_leaf->shared_cpu_map;
- return cpumap_print_to_pagebuf(list, buf, mask);
-}
-
-static ssize_t shared_cpu_map_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- return shared_cpumap_show_func(dev, false, buf);
+ return sysfs_emit(buf, "%*pb\n", nr_cpu_ids, mask);
}
static ssize_t shared_cpu_list_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
- return shared_cpumap_show_func(dev, true, buf);
+ struct cacheinfo *this_leaf = dev_get_drvdata(dev);
+ const struct cpumask *mask = &this_leaf->shared_cpu_map;
+
+ return sysfs_emit(buf, "%*pbl\n", nr_cpu_ids, mask);
}
static ssize_t type_show(struct device *dev,