Skip to contentSkip to conversation

xen/pcpu: Use DEVICE_ATTR_RW macro

PATCH In review YueHaibing 2 participants 3 messages May 23, 2021 – May 25, 2021 Xen hypervisor interface

lore
Share & tools
lore

YueHaibing

author
#0 lore raw

PATCH 1/1 xen/pcpu: Use DEVICE_ATTR_RW macro

Use DEVICE_ATTR_RW helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

---
 drivers/xen/pcpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/xen/pcpu.c +3 -3
index 1bcdd5227771..47aa3a1ccaf5 100644
@@ -92,7 +92,7 @@ static int xen_pcpu_up(uint32_t cpu_id)
 	return HYPERVISOR_platform_op(&op);
 }
 
-static ssize_t show_online(struct device *dev,
+static ssize_t online_show(struct device *dev,
 			   struct device_attribute *attr,
 			   char *buf)
 {
@@ -101,7 +101,7 @@ static ssize_t show_online(struct device *dev,
 	return sprintf(buf, "%u\n", !!(cpu->flags & XEN_PCPU_FLAGS_ONLINE));
 }
 
-static ssize_t __ref store_online(struct device *dev,
+static ssize_t __ref online_store(struct device *dev,
 				  struct device_attribute *attr,
 				  const char *buf, size_t count)
 {
@@ -130,7 +130,7 @@ static ssize_t __ref store_online(struct device *dev,
 		ret = count;
 	return ret;
 }
-static DEVICE_ATTR(online, S_IRUGO | S_IWUSR, show_online, store_online);
+static DEVICE_ATTR_RW(online);
 
 static struct attribute *pcpu_dev_attrs[] = {
 	&dev_attr_online.attr,
Signature · 1 line
2.17.1
#1 lore raw
Quoted 4 lines · YueHaibing

Use DEVICE_ATTR_RW helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

Do you think you can also make similar change in drivers/xen/xen-balloon.c and drivers/xen/xenbus/xenbus_probe.c?

Thanks.

-boris

author
#2 lore raw
Quoted 10 lines · Boris Ostrovsky
Quoted 4 lines · YueHaibing

Use DEVICE_ATTR_RW helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

Do you think you can also make similar change in drivers/xen/xen-balloon.c and drivers/xen/xenbus/xenbus_probe.c?

Sure, will do that in v2.

Quoted 8 lines

Thanks.

-boris

.