From: Zhen Lei <thunder.leizhen@huawei.com>
To: Dan Williams <dan.j.williams@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Dave Jiang <dave.jiang@intel.com>,
nvdimm <nvdimm@lists.linux.dev>,
linux-kernel <linux-kernel@vger.kernel.org>
Cc: Zhen Lei <thunder.leizhen@huawei.com>
Subject: [PATCH 1/1] device-dax: use DEVICE_ATTR_ADMIN_RO() helper macro
Date: Thu, 3 Jun 2021 17:24:05 +0800 [thread overview]
Message-ID: <20210603092405.11824-1-thunder.leizhen@huawei.com> (raw)
Use DEVICE_ATTR_ADMIN_RO() helper macro instead of plain DEVICE_ATTR(),
which makes the code a bit shorter and easier to read.
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
drivers/dax/bus.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
index 5aee26e1bbd6dba..a8a26398a313cd9 100644
--- a/drivers/dax/bus.c
+++ b/drivers/dax/bus.c
@@ -655,7 +655,7 @@ static ssize_t start_show(struct device *dev,
return rc;
}
-static DEVICE_ATTR(start, 0400, start_show, NULL);
+static DEVICE_ATTR_ADMIN_RO(start);
static ssize_t end_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -671,9 +671,9 @@ static ssize_t end_show(struct device *dev,
return rc;
}
-static DEVICE_ATTR(end, 0400, end_show, NULL);
+static DEVICE_ATTR_ADMIN_RO(end);
-static ssize_t pgoff_show(struct device *dev,
+static ssize_t page_offset_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct dev_dax_range *dax_range;
@@ -687,7 +687,7 @@ static ssize_t pgoff_show(struct device *dev,
return rc;
}
-static DEVICE_ATTR(page_offset, 0400, pgoff_show, NULL);
+static DEVICE_ATTR_ADMIN_RO(page_offset);
static struct attribute *dax_mapping_attributes[] = {
&dev_attr_start.attr,
@@ -1191,7 +1191,7 @@ static ssize_t resource_show(struct device *dev,
return sprintf(buf, "%#llx\n", start);
}
-static DEVICE_ATTR(resource, 0400, resource_show, NULL);
+static DEVICE_ATTR_ADMIN_RO(resource);
static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
char *buf)
--
2.26.0.106.g9fadedd
reply other threads:[~2021-06-03 9:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210603092405.11824-1-thunder.leizhen@huawei.com \
--to=thunder.leizhen@huawei.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=vishal.l.verma@intel.com \
/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).