Skip to contentSkip to conversation

device-dax: use DEVICE_ATTR_ADMIN_RO() helper macro

PATCH New Zhen Lei 1 participant 1 message Jun 3, 2021

Subsystems (2)
lore
Share & tools
lore

Zhen Lei

author
#0 lore raw

PATCH 1/1 device-dax: use DEVICE_ATTR_ADMIN_RO() helper macro

Use DEVICE_ATTR_ADMIN_RO() helper macro instead of plain DEVICE_ATTR(), which makes the code a bit shorter and easier to read.

---
 drivers/dax/bus.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/dax/bus.c +5 -5
index 5aee26e1bbd6dba..a8a26398a313cd9 100644
@@ -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)
Signature · 1 line
2.26.0.106.g9fadedd