From: Qinglang Miao <miaoqinglang@huawei.com> To: Thierry Reding <thierry.reding@gmail.com> Cc: <dri-devel@lists.freedesktop.org>, <linux-tegra@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Qinglang Miao <miaoqinglang@huawei.com> Subject: [PATCH -next v2] gpu: host1x: debug: Convert to DEFINE_SHOW_ATTRIBUTE Date: Thu, 17 Sep 2020 20:42:46 +0800 [thread overview] Message-ID: <20200917124246.102312-1-miaoqinglang@huawei.com> (raw) Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com> --- v2: based on linux-next(20200917), and can be applied to mainline cleanly now. drivers/gpu/host1x/debug.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/host1x/debug.c b/drivers/gpu/host1x/debug.c index 1b4997bda..1aa46d430 100644 --- a/drivers/gpu/host1x/debug.c +++ b/drivers/gpu/host1x/debug.c @@ -114,7 +114,7 @@ static void show_all(struct host1x *m, struct output *o, bool show_fifo) } } -static int host1x_debug_show_all(struct seq_file *s, void *unused) +static int host1x_debug_all_show(struct seq_file *s, void *unused) { struct output o = { .fn = write_to_seqfile, @@ -126,6 +126,8 @@ static int host1x_debug_show_all(struct seq_file *s, void *unused) return 0; } +DEFINE_SHOW_ATTRIBUTE(host1x_debug_all); + static int host1x_debug_show(struct seq_file *s, void *unused) { struct output o = { @@ -138,29 +140,7 @@ static int host1x_debug_show(struct seq_file *s, void *unused) return 0; } -static int host1x_debug_open_all(struct inode *inode, struct file *file) -{ - return single_open(file, host1x_debug_show_all, inode->i_private); -} - -static const struct file_operations host1x_debug_all_fops = { - .open = host1x_debug_open_all, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - -static int host1x_debug_open(struct inode *inode, struct file *file) -{ - return single_open(file, host1x_debug_show, inode->i_private); -} - -static const struct file_operations host1x_debug_fops = { - .open = host1x_debug_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(host1x_debug); static void host1x_debugfs_init(struct host1x *host1x) { -- 2.23.0
WARNING: multiple messages have this Message-ID (diff)
From: Qinglang Miao <miaoqinglang@huawei.com> To: Thierry Reding <thierry.reding@gmail.com> Cc: linux-tegra@vger.kernel.org, Qinglang Miao <miaoqinglang@huawei.com>, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH -next v2] gpu: host1x: debug: Convert to DEFINE_SHOW_ATTRIBUTE Date: Thu, 17 Sep 2020 20:42:46 +0800 [thread overview] Message-ID: <20200917124246.102312-1-miaoqinglang@huawei.com> (raw) Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com> --- v2: based on linux-next(20200917), and can be applied to mainline cleanly now. drivers/gpu/host1x/debug.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/host1x/debug.c b/drivers/gpu/host1x/debug.c index 1b4997bda..1aa46d430 100644 --- a/drivers/gpu/host1x/debug.c +++ b/drivers/gpu/host1x/debug.c @@ -114,7 +114,7 @@ static void show_all(struct host1x *m, struct output *o, bool show_fifo) } } -static int host1x_debug_show_all(struct seq_file *s, void *unused) +static int host1x_debug_all_show(struct seq_file *s, void *unused) { struct output o = { .fn = write_to_seqfile, @@ -126,6 +126,8 @@ static int host1x_debug_show_all(struct seq_file *s, void *unused) return 0; } +DEFINE_SHOW_ATTRIBUTE(host1x_debug_all); + static int host1x_debug_show(struct seq_file *s, void *unused) { struct output o = { @@ -138,29 +140,7 @@ static int host1x_debug_show(struct seq_file *s, void *unused) return 0; } -static int host1x_debug_open_all(struct inode *inode, struct file *file) -{ - return single_open(file, host1x_debug_show_all, inode->i_private); -} - -static const struct file_operations host1x_debug_all_fops = { - .open = host1x_debug_open_all, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - -static int host1x_debug_open(struct inode *inode, struct file *file) -{ - return single_open(file, host1x_debug_show, inode->i_private); -} - -static const struct file_operations host1x_debug_fops = { - .open = host1x_debug_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(host1x_debug); static void host1x_debugfs_init(struct host1x *host1x) { -- 2.23.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2020-09-17 12:42 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-17 12:42 Qinglang Miao [this message] 2020-09-17 12:42 ` [PATCH -next v2] gpu: host1x: debug: Convert to DEFINE_SHOW_ATTRIBUTE Qinglang Miao
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=20200917124246.102312-1-miaoqinglang@huawei.com \ --to=miaoqinglang@huawei.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-tegra@vger.kernel.org \ --cc=thierry.reding@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: linkBe 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.