linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] xen/pcpu: Use DEVICE_ATTR_RW macro
@ 2021-05-23  7:02 YueHaibing
  2021-05-24 12:48 ` Boris Ostrovsky
  0 siblings, 1 reply; 3+ messages in thread
From: YueHaibing @ 2021-05-23  7:02 UTC (permalink / raw)
  To: boris.ostrovsky, jgross, sstabellini, yuehaibing; +Cc: xen-devel, linux-kernel

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

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/xen/pcpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/xen/pcpu.c b/drivers/xen/pcpu.c
index 1bcdd5227771..47aa3a1ccaf5 100644
--- a/drivers/xen/pcpu.c
+++ b/drivers/xen/pcpu.c
@@ -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,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] xen/pcpu: Use DEVICE_ATTR_RW macro
  2021-05-23  7:02 [PATCH -next] xen/pcpu: Use DEVICE_ATTR_RW macro YueHaibing
@ 2021-05-24 12:48 ` Boris Ostrovsky
  2021-05-25  6:17   ` YueHaibing
  0 siblings, 1 reply; 3+ messages in thread
From: Boris Ostrovsky @ 2021-05-24 12:48 UTC (permalink / raw)
  To: YueHaibing, jgross, sstabellini; +Cc: xen-devel, linux-kernel


On 5/23/21 3:02 AM, YueHaibing wrote:
> Use DEVICE_ATTR_RW helper instead of plain DEVICE_ATTR,
> which makes the code a bit shorter and easier to read.
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>


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



Thanks.

-boris


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] xen/pcpu: Use DEVICE_ATTR_RW macro
  2021-05-24 12:48 ` Boris Ostrovsky
@ 2021-05-25  6:17   ` YueHaibing
  0 siblings, 0 replies; 3+ messages in thread
From: YueHaibing @ 2021-05-25  6:17 UTC (permalink / raw)
  To: Boris Ostrovsky, jgross, sstabellini; +Cc: xen-devel, linux-kernel



On 2021/5/24 20:48, Boris Ostrovsky wrote:
> 
> On 5/23/21 3:02 AM, YueHaibing wrote:
>> Use DEVICE_ATTR_RW helper instead of plain DEVICE_ATTR,
>> which makes the code a bit shorter and easier to read.
>>
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> 
> 
> 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.
> 
> 
> Thanks.
> 
> -boris
> 
> .
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-25  6:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-23  7:02 [PATCH -next] xen/pcpu: Use DEVICE_ATTR_RW macro YueHaibing
2021-05-24 12:48 ` Boris Ostrovsky
2021-05-25  6:17   ` YueHaibing

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).