linux-edac.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] RAS/CEC: Convert to DEFINE_SHOW_ATTRIBUTE
@ 2020-07-16  8:58 Qinglang Miao
  2020-08-17 10:31 ` Borislav Petkov
  0 siblings, 1 reply; 3+ messages in thread
From: Qinglang Miao @ 2020-07-16  8:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Tony Luck, Borislav Petkov; +Cc: linux-edac, linux-kernel

From: Yongqiang Liu <liuyongqiang13@huawei.com>

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yongqiang Liu <liuyongqiang13@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 a992bb426..ed47b59e4 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_iter	 = seq_read_iter,
-	.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.17.1


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

* Re: [PATCH -next] RAS/CEC: Convert to DEFINE_SHOW_ATTRIBUTE
  2020-07-16  8:58 [PATCH -next] RAS/CEC: Convert to DEFINE_SHOW_ATTRIBUTE Qinglang Miao
@ 2020-08-17 10:31 ` Borislav Petkov
  2020-09-19  1:21   ` miaoqinglang
  0 siblings, 1 reply; 3+ messages in thread
From: Borislav Petkov @ 2020-08-17 10:31 UTC (permalink / raw)
  To: Qinglang Miao; +Cc: Greg Kroah-Hartman, Tony Luck, linux-edac, linux-kernel

On Thu, Jul 16, 2020 at 04:58:34PM +0800, Qinglang Miao wrote:
> From: Yongqiang Liu <liuyongqiang13@huawei.com>
> 
> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
> 
> Signed-off-by: Yongqiang Liu <liuyongqiang13@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 a992bb426..ed47b59e4 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_iter	 = seq_read_iter,

$ test-apply.sh /tmp/01-ras-cec-convert_to_define_show_attribute.patch
checking file drivers/ras/cec.c
Hunk #2 FAILED at 467.
1 out of 3 hunks FAILED
Apply? (y/n) n

Where did this .read_iter come from?

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

* Re: [PATCH -next] RAS/CEC: Convert to DEFINE_SHOW_ATTRIBUTE
  2020-08-17 10:31 ` Borislav Petkov
@ 2020-09-19  1:21   ` miaoqinglang
  0 siblings, 0 replies; 3+ messages in thread
From: miaoqinglang @ 2020-09-19  1:21 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: Greg Kroah-Hartman, Tony Luck, linux-edac, linux-kernel



在 2020/8/17 18:31, Borislav Petkov 写道:
> On Thu, Jul 16, 2020 at 04:58:34PM +0800, Qinglang Miao wrote:
>> From: Yongqiang Liu <liuyongqiang13@huawei.com>
>>
>> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
>>
>> Signed-off-by: Yongqiang Liu <liuyongqiang13@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 a992bb426..ed47b59e4 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_iter	 = seq_read_iter,
> 
> $ test-apply.sh /tmp/01-ras-cec-convert_to_define_show_attribute.patch
> checking file drivers/ras/cec.c
> Hunk #2 FAILED at 467.
> 1 out of 3 hunks FAILED
> Apply? (y/n) n
> 
> Where did this .read_iter come from?
> 
Hi Borislav,

.read_iter come from <4d4901c6d7> which has been reverted in Linux-next.

So I resent a new patch against linux-next(20200917), and it can
be applied to mainline cleanly now.

Thanks.


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

end of thread, other threads:[~2020-09-19  1:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16  8:58 [PATCH -next] RAS/CEC: Convert to DEFINE_SHOW_ATTRIBUTE Qinglang Miao
2020-08-17 10:31 ` Borislav Petkov
2020-09-19  1:21   ` miaoqinglang

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