linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] cuse: use DEVICE_ATTR_*() macros
@ 2021-05-23  6:51 YueHaibing
  2021-06-21  8:46 ` Miklos Szeredi
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2021-05-23  6:51 UTC (permalink / raw)
  To: miklos; +Cc: linux-fsdevel, linux-kernel, YueHaibing

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

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 fs/fuse/cuse.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
index c7d882a9fe33..0df886224afe 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -574,25 +574,25 @@ static struct file_operations cuse_channel_fops; /* initialized during init */
  * CUSE exports the same set of attributes to sysfs as fusectl.
  */
 
-static ssize_t cuse_class_waiting_show(struct device *dev,
-				       struct device_attribute *attr, char *buf)
+static ssize_t waiting_show(struct device *dev,
+			    struct device_attribute *attr, char *buf)
 {
 	struct cuse_conn *cc = dev_get_drvdata(dev);
 
 	return sprintf(buf, "%d\n", atomic_read(&cc->fc.num_waiting));
 }
-static DEVICE_ATTR(waiting, 0400, cuse_class_waiting_show, NULL);
+static DEVICE_ATTR_ADMIN_RO(waiting);
 
-static ssize_t cuse_class_abort_store(struct device *dev,
-				      struct device_attribute *attr,
-				      const char *buf, size_t count)
+static ssize_t abort_store(struct device *dev,
+			   struct device_attribute *attr,
+			   const char *buf, size_t count)
 {
 	struct cuse_conn *cc = dev_get_drvdata(dev);
 
 	fuse_abort_conn(&cc->fc);
 	return count;
 }
-static DEVICE_ATTR(abort, 0200, NULL, cuse_class_abort_store);
+static DEVICE_ATTR_WO(abort);
 
 static struct attribute *cuse_class_dev_attrs[] = {
 	&dev_attr_waiting.attr,
-- 
2.17.1


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

* Re: [PATCH -next] cuse: use DEVICE_ATTR_*() macros
  2021-05-23  6:51 [PATCH -next] cuse: use DEVICE_ATTR_*() macros YueHaibing
@ 2021-06-21  8:46 ` Miklos Szeredi
  0 siblings, 0 replies; 2+ messages in thread
From: Miklos Szeredi @ 2021-06-21  8:46 UTC (permalink / raw)
  To: YueHaibing; +Cc: linux-fsdevel, linux-kernel

On Sun, 23 May 2021 at 08:52, YueHaibing <yuehaibing@huawei.com> wrote:
>
> Use DEVICE_ATTR_*() helper instead of plain DEVICE_ATTR,
> which makes the code a bit shorter and easier to read.

Sorry, I don't see really see the cleanup value of this patch.

Thanks,
Miklos

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

end of thread, other threads:[~2021-06-21  8:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-23  6:51 [PATCH -next] cuse: use DEVICE_ATTR_*() macros YueHaibing
2021-06-21  8:46 ` Miklos Szeredi

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