Patchwork ACPI, APEI, EINJ: Change to use DEFINE_SHOW_ATTRIBUTE macro

login
register
mail settings
Submitter Yangtao Li
Date Nov. 30, 2018, 5:01 p.m.
Message ID <20181130170106.4031-1-tiny.windzz@gmail.com>
Download mbox | patch
Permalink /patch/669373/
State New
Headers show

Comments

Yangtao Li - Nov. 30, 2018, 5:01 p.m.
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 drivers/acpi/apei/einj.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
Rafael J. Wysocki - Dec. 17, 2018, 11:40 a.m.
On Friday, November 30, 2018 6:01:06 PM CET Yangtao Li wrote:
> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> ---
>  drivers/acpi/apei/einj.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
> index b38737c83a24..fcccbfdbdd1a 100644
> --- a/drivers/acpi/apei/einj.c
> +++ b/drivers/acpi/apei/einj.c
> @@ -607,17 +607,7 @@ static int available_error_type_show(struct seq_file *m, void *v)
>  	return 0;
>  }
>  
> -static int available_error_type_open(struct inode *inode, struct file *file)
> -{
> -	return single_open(file, available_error_type_show, NULL);
> -}
> -
> -static const struct file_operations available_error_type_fops = {
> -	.open		= available_error_type_open,
> -	.read		= seq_read,
> -	.llseek		= seq_lseek,
> -	.release	= single_release,
> -};
> +DEFINE_SHOW_ATTRIBUTE(available_error_type);
>  
>  static int error_type_get(void *data, u64 *val)
>  {
> 

Applied, thanks!

Patch

diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index b38737c83a24..fcccbfdbdd1a 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -607,17 +607,7 @@  static int available_error_type_show(struct seq_file *m, void *v)
 	return 0;
 }
 
-static int available_error_type_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, available_error_type_show, NULL);
-}
-
-static const struct file_operations available_error_type_fops = {
-	.open		= available_error_type_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(available_error_type);
 
 static int error_type_get(void *data, u64 *val)
 {