All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	linux-gpio@vger.kernel.org, Kent Gibson <warthog618@gmail.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 2/2] gpiolib: convert to use DEFINE_SEQ_ATTRIBUTE macro
Date: Thu, 10 Sep 2020 13:19:35 +0300	[thread overview]
Message-ID: <20200910101935.47140-2-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20200910101935.47140-1-andriy.shevchenko@linux.intel.com>

Use DEFINE_SEQ_ATTRIBUTE macro to simplify the code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpiolib.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 80137c1b3cdc..1300650dc308 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -4402,31 +4402,18 @@ static int gpiolib_seq_show(struct seq_file *s, void *v)
 	return 0;
 }
 
-static const struct seq_operations gpiolib_seq_ops = {
+static const struct seq_operations gpiolib_sops = {
 	.start = gpiolib_seq_start,
 	.next = gpiolib_seq_next,
 	.stop = gpiolib_seq_stop,
 	.show = gpiolib_seq_show,
 };
-
-static int gpiolib_open(struct inode *inode, struct file *file)
-{
-	return seq_open(file, &gpiolib_seq_ops);
-}
-
-static const struct file_operations gpiolib_operations = {
-	.owner		= THIS_MODULE,
-	.open		= gpiolib_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= seq_release,
-};
+DEFINE_SEQ_ATTRIBUTE(gpiolib);
 
 static int __init gpiolib_debugfs_init(void)
 {
 	/* /sys/kernel/debug/gpio */
-	debugfs_create_file("gpio", S_IFREG | S_IRUGO, NULL, NULL,
-			    &gpiolib_operations);
+	debugfs_create_file("gpio", 0444, NULL, NULL, &gpiolib_fops);
 	return 0;
 }
 subsys_initcall(gpiolib_debugfs_init);
-- 
2.28.0


  reply	other threads:[~2020-09-10 10:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10 10:19 [PATCH v1 1/2] gpiolib: Fix line event handling in syscall compatible mode Andy Shevchenko
2020-09-10 10:19 ` Andy Shevchenko [this message]
2020-09-11 15:45   ` [PATCH v1 2/2] gpiolib: convert to use DEFINE_SEQ_ATTRIBUTE macro Bartosz Golaszewski
2020-09-11  1:37 ` [PATCH v1 1/2] gpiolib: Fix line event handling in syscall compatible mode kernel test robot
2020-09-11  1:37   ` kernel test robot
2020-09-11  3:05 ` Kent Gibson
2020-09-11  8:31   ` Andy Shevchenko
2020-09-11  9:12     ` Kent Gibson
2020-09-11  9:53       ` Andy Shevchenko
2020-09-11 10:17         ` Kent Gibson
     [not found]           ` <20200911142846.GM1891694@smile.fi.intel.com>
2020-09-12  2:21             ` Kent Gibson
2020-09-14 12:44               ` Bartosz Golaszewski
2020-09-14 13:04                 ` Andy Shevchenko
2020-09-11 16:20 ` Arnd Bergmann
2020-09-14 14:26   ` Andy Shevchenko

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=20200910101935.47140-2-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=warthog618@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.