mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>
Cc: Denis Efremov <efremov@linux.com>,
	Julia Lawall <julia.lawall@inria.fr>,
	Alex Dewar <alex.dewar90@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH V3 7/8] drivers core: Use sysfs_emit for shared_cpu_map_show and shared_cpu_list_show
Date: Wed, 16 Sep 2020 13:40:44 -0700	[thread overview]
Message-ID: <80457b467ab6cde13a173cfd8a4f49cd8467a7fd.1600285923.git.joe@perches.com> (raw)
In-Reply-To: <cover.1600285923.git.joe@perches.com>

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>
---
 drivers/base/cacheinfo.c | 16 +++++++---------
 1 file 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,
-- 
2.26.0


  parent reply	other threads:[~2020-09-16 20:41 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16 20:40 [PATCH V3 0/8] sysfs: drivers core: Add and use sysfs_emit and sysfs_emit_at Joe Perches
2020-09-16 20:40 ` [PATCH V3 1/8] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output Joe Perches
2020-09-30 11:57   ` Greg Kroah-Hartman
2020-09-30 13:58     ` Joe Perches
2020-10-02 11:25       ` Greg Kroah-Hartman
2020-10-01  4:17     ` Kees Cook
2020-10-01  4:22       ` Joe Perches
2020-10-02 22:30         ` Kees Cook
2020-10-03 13:55           ` Greg Kroah-Hartman
2020-10-03 14:59             ` Joe Perches
2020-10-03 22:15             ` Kees Cook
2020-10-01 20:50       ` Greg Kroah-Hartman
2020-10-02 22:27         ` Kees Cook
2020-09-16 20:40 ` [PATCH V3 2/8] drivers core: Use sysfs_emit and sysfs_emit_at for show(device *...) functions Joe Perches
2020-09-16 20:40 ` [PATCH V3 3/8] drivers core: Remove strcat uses around sysfs_emit and neaten Joe Perches
2020-09-16 20:40 ` [PATCH V3 4/8] drivers core: Reindent a couple uses around sysfs_emit Joe Perches
2020-09-16 20:40 ` [PATCH V3 5/8] drivers core: Miscellaneous changes for sysfs_emit Joe Perches
2020-09-16 20:40 ` [PATCH V3 6/8] mm: and drivers core: Convert hugetlb_report_node_meminfo to sysfs_emit Joe Perches
2020-09-18 20:29   ` Mike Kravetz
2020-09-19  6:22   ` Greg Kroah-Hartman
2020-09-19 16:51     ` Joe Perches
2020-09-25 18:32     ` Joe Perches
2020-09-29  0:53     ` Joe Perches
2020-09-29  4:17       ` Greg Kroah-Hartman
2020-09-16 20:40 ` Joe Perches [this message]
2020-09-16 20:40 ` [PATCH V3 8/8] drivers core: node: Use a more typical macro definition style for ACCESS_ATTR Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80457b467ab6cde13a173cfd8a4f49cd8467a7fd.1600285923.git.joe@perches.com \
    --to=joe@perches.com \
    --cc=alex.dewar90@gmail.com \
    --cc=efremov@linux.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=julia.lawall@inria.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®