From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/5] mm:backing-dev: Use sysfs_emit in macro defining functions
Date: Sun, 1 Nov 2020 12:12:50 -0800 [thread overview]
Message-ID: <289a7dd0aeb738bbbf52d044778256e45fc28322.1604261483.git.joe@perches.com> (raw)
In-Reply-To: <cover.1604261483.git.joe@perches.com>
The cocci script used in commit bdacbb8d04f ("mm: Use sysfs_emit
for struct kobject * uses") does not convert the name##_show macro
because the macro uses concatenation via ##.
Convert it by hand.
Signed-off-by: Joe Perches <joe@perches.com>
---
mm/backing-dev.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index 408d5051d05b..e33797579338 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -150,11 +150,11 @@ static ssize_t read_ahead_kb_store(struct device *dev,
#define BDI_SHOW(name, expr) \
static ssize_t name##_show(struct device *dev, \
- struct device_attribute *attr, char *page) \
+ struct device_attribute *attr, char *buf) \
{ \
struct backing_dev_info *bdi = dev_get_drvdata(dev); \
\
- return snprintf(page, PAGE_SIZE-1, "%lld\n", (long long)expr); \
+ return sysfs_emit(buf, "%lld\n", (long long)expr); \
} \
static DEVICE_ATTR_RW(name);
@@ -200,11 +200,11 @@ BDI_SHOW(max_ratio, bdi->max_ratio)
static ssize_t stable_pages_required_show(struct device *dev,
struct device_attribute *attr,
- char *page)
+ char *buf)
{
dev_warn_once(dev,
"the stable_pages_required attribute has been removed. Use the stable_writes queue attribute instead.\n");
- return snprintf(page, PAGE_SIZE-1, "%d\n", 0);
+ return sysfs_emit(buf, "%d\n", 0);
}
static DEVICE_ATTR_RO(stable_pages_required);
--
2.26.0
next prev parent reply other threads:[~2020-11-01 20:13 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-01 20:12 [PATCH 0/5] mm: Convert sysfs sprintf family to sysfs_emit Joe Perches
2020-11-01 20:12 ` [PATCH 1/5] mm: Use sysfs_emit for struct kobject * uses Joe Perches
2020-11-01 20:12 ` [PATCH 2/5] mm: huge_memory: Convert remaining use of sprintf to sysfs_emit and neatening Joe Perches
2020-11-01 20:12 ` Joe Perches [this message]
2020-11-01 20:12 ` [PATCH 4/5] mm: shmem: Convert shmem_enabled_show to use sysfs_emit_at Joe Perches
2020-11-01 20:48 ` Matthew Wilcox
2020-11-01 21:04 ` Joe Perches
2020-11-01 21:19 ` Matthew Wilcox
2020-11-01 21:43 ` Joe Perches
2020-11-01 22:06 ` Matthew Wilcox
2020-11-01 22:08 ` Joe Perches
2020-11-01 22:13 ` Joe Perches
2020-11-01 22:14 ` Joe Perches
2020-11-02 13:33 ` Greg Kroah-Hartman
2020-11-02 14:08 ` Matthew Wilcox
2020-11-02 14:32 ` Greg Kroah-Hartman
2020-11-02 14:40 ` Matthew Wilcox
2020-11-02 17:01 ` Joe Perches
2020-11-01 20:12 ` [PATCH 5/5] mm: slub: Convert sysfs sprintf family to sysfs_emit/sysfs_emit_at Joe Perches
2020-11-13 12:10 ` [mm] b6efe2fcc4: BUG:kernel_NULL_pointer_dereference,address kernel test robot
2020-11-13 16:13 ` 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=289a7dd0aeb738bbbf52d044778256e45fc28322.1604261483.git.joe@perches.com \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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;
as well as URLs for NNTP newsgroup(s).