All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next v2] RAS/CEC: Convert to DEFINE_SHOW_ATTRIBUTE
@ 2020-09-19  1:22 Qinglang Miao
  2020-09-25 18:26 ` [tip: ras/core] RAS/CEC: Convert to DEFINE_SHOW_ATTRIBUTE() tip-bot2 for Qinglang Miao
  0 siblings, 1 reply; 2+ messages in thread
From: Qinglang Miao @ 2020-09-19  1:22 UTC (permalink / raw)
  To: Tony Luck, Borislav Petkov; +Cc: linux-edac, linux-kernel, Qinglang Miao

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/ras/cec.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c
index 6939aa5b3..ddecf25b5 100644
--- a/drivers/ras/cec.c
+++ b/drivers/ras/cec.c
@@ -435,7 +435,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(action_threshold_ops, u64_get, action_threshold_set, "%
 
 static const char * const bins[] = { "00", "01", "10", "11" };
 
-static int array_dump(struct seq_file *m, void *v)
+static int array_show(struct seq_file *m, void *v)
 {
 	struct ce_array *ca = &ce_arr;
 	int i;
@@ -467,18 +467,7 @@ static int array_dump(struct seq_file *m, void *v)
 	return 0;
 }
 
-static int array_open(struct inode *inode, struct file *filp)
-{
-	return single_open(filp, array_dump, NULL);
-}
-
-static const struct file_operations array_ops = {
-	.owner	 = THIS_MODULE,
-	.open	 = array_open,
-	.read	 = seq_read,
-	.llseek	 = seq_lseek,
-	.release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(array);
 
 static int __init create_debugfs_nodes(void)
 {
@@ -513,7 +502,7 @@ static int __init create_debugfs_nodes(void)
 		goto err;
 	}
 
-	array = debugfs_create_file("array", S_IRUSR, d, NULL, &array_ops);
+	array = debugfs_create_file("array", S_IRUSR, d, NULL, &array_fops);
 	if (!array) {
 		pr_warn("Error creating array debugfs node!\n");
 		goto err;
-- 
2.23.0


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

* [tip: ras/core] RAS/CEC: Convert to DEFINE_SHOW_ATTRIBUTE()
  2020-09-19  1:22 [PATCH -next v2] RAS/CEC: Convert to DEFINE_SHOW_ATTRIBUTE Qinglang Miao
@ 2020-09-25 18:26 ` tip-bot2 for Qinglang Miao
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Qinglang Miao @ 2020-09-25 18:26 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Qinglang Miao, Borislav Petkov, x86, LKML

The following commit has been merged into the ras/core branch of tip:

Commit-ID:     4bd442e9a8388e8ec4ba7cf23a4774989d93b78e
Gitweb:        https://git.kernel.org/tip/4bd442e9a8388e8ec4ba7cf23a4774989d93b78e
Author:        Qinglang Miao <miaoqinglang@huawei.com>
AuthorDate:    Sat, 19 Sep 2020 09:22:52 +08:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Fri, 25 Sep 2020 19:05:31 +02:00

RAS/CEC: Convert to DEFINE_SHOW_ATTRIBUTE()

Use the DEFINE_SHOW_ATTRIBUTE() macro and simplify the code.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20200919012252.171437-1-miaoqinglang@huawei.com
---
 drivers/ras/cec.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c
index 6939aa5..ddecf25 100644
--- a/drivers/ras/cec.c
+++ b/drivers/ras/cec.c
@@ -435,7 +435,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(action_threshold_ops, u64_get, action_threshold_set, "%
 
 static const char * const bins[] = { "00", "01", "10", "11" };
 
-static int array_dump(struct seq_file *m, void *v)
+static int array_show(struct seq_file *m, void *v)
 {
 	struct ce_array *ca = &ce_arr;
 	int i;
@@ -467,18 +467,7 @@ static int array_dump(struct seq_file *m, void *v)
 	return 0;
 }
 
-static int array_open(struct inode *inode, struct file *filp)
-{
-	return single_open(filp, array_dump, NULL);
-}
-
-static const struct file_operations array_ops = {
-	.owner	 = THIS_MODULE,
-	.open	 = array_open,
-	.read	 = seq_read,
-	.llseek	 = seq_lseek,
-	.release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(array);
 
 static int __init create_debugfs_nodes(void)
 {
@@ -513,7 +502,7 @@ static int __init create_debugfs_nodes(void)
 		goto err;
 	}
 
-	array = debugfs_create_file("array", S_IRUSR, d, NULL, &array_ops);
+	array = debugfs_create_file("array", S_IRUSR, d, NULL, &array_fops);
 	if (!array) {
 		pr_warn("Error creating array debugfs node!\n");
 		goto err;

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

end of thread, other threads:[~2020-09-25 18:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-19  1:22 [PATCH -next v2] RAS/CEC: Convert to DEFINE_SHOW_ATTRIBUTE Qinglang Miao
2020-09-25 18:26 ` [tip: ras/core] RAS/CEC: Convert to DEFINE_SHOW_ATTRIBUTE() tip-bot2 for Qinglang Miao

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.