linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM: dump: Convert to use DEFINE_SHOW_ATTRIBUTE macro
  2018-06-13  1:11 [PATCH 0/2] Re-use DEFINE_SHOW_ATTRIBUTE() macro Peng Donglin
@ 2018-06-13  1:11 ` Peng Donglin
  2018-12-27 14:56   ` Donglin Peng
  2018-06-13  1:11 ` [PATCH 2/2] ARM64: " Peng Donglin
  1 sibling, 1 reply; 4+ messages in thread
From: Peng Donglin @ 2018-06-13  1:11 UTC (permalink / raw)
  To: catalin.marinas, will.deacon; +Cc: linux-arm-kernel, linux-kernel, Peng Donglin

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Peng Donglin <dolinux.peng@gmail.com>
---
 arch/arm/mm/ptdump_debugfs.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/arch/arm/mm/ptdump_debugfs.c b/arch/arm/mm/ptdump_debugfs.c
index be8d87b..79002fe 100644
--- a/arch/arm/mm/ptdump_debugfs.c
+++ b/arch/arm/mm/ptdump_debugfs.c
@@ -11,18 +11,7 @@ static int ptdump_show(struct seq_file *m, void *v)
 	ptdump_walk_pgd(m, info);
 	return 0;
 }
-
-static int ptdump_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, ptdump_show, inode->i_private);
-}
-
-static const struct file_operations ptdump_fops = {
-	.open		= ptdump_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(ptdump);
 
 int ptdump_debugfs_register(struct ptdump_info *info, const char *name)
 {
-- 
2.7.4


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

* [PATCH 2/2] ARM64: dump: Convert to use DEFINE_SHOW_ATTRIBUTE macro
  2018-06-13  1:11 [PATCH 0/2] Re-use DEFINE_SHOW_ATTRIBUTE() macro Peng Donglin
  2018-06-13  1:11 ` [PATCH 1/2] ARM: dump: Convert to use DEFINE_SHOW_ATTRIBUTE macro Peng Donglin
@ 2018-06-13  1:11 ` Peng Donglin
  1 sibling, 0 replies; 4+ messages in thread
From: Peng Donglin @ 2018-06-13  1:11 UTC (permalink / raw)
  To: catalin.marinas, will.deacon; +Cc: linux-arm-kernel, linux-kernel, Peng Donglin

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Peng Donglin <dolinux.peng@gmail.com>
---
 arch/arm64/mm/ptdump_debugfs.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/arch/arm64/mm/ptdump_debugfs.c b/arch/arm64/mm/ptdump_debugfs.c
index 02b18f8..24d786f 100644
--- a/arch/arm64/mm/ptdump_debugfs.c
+++ b/arch/arm64/mm/ptdump_debugfs.c
@@ -10,18 +10,7 @@ static int ptdump_show(struct seq_file *m, void *v)
 	ptdump_walk_pgd(m, info);
 	return 0;
 }
-
-static int ptdump_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, ptdump_show, inode->i_private);
-}
-
-static const struct file_operations ptdump_fops = {
-	.open		= ptdump_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(ptdump);
 
 int ptdump_debugfs_register(struct ptdump_info *info, const char *name)
 {
-- 
2.7.4


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

* [PATCH 0/2] Re-use DEFINE_SHOW_ATTRIBUTE() macro
  2018-06-13  1:11 ` [PATCH 1/2] ARM: dump: Convert to use DEFINE_SHOW_ATTRIBUTE macro Peng Donglin
@ 2018-06-13  1:11 Peng Donglin
  2018-06-13  1:11 ` [PATCH 1/2] ARM: dump: Convert to use DEFINE_SHOW_ATTRIBUTE macro Peng Donglin
  2018-06-13  1:11 ` [PATCH 2/2] ARM64: " Peng Donglin
  0 siblings, 2 replies; 4+ messages in thread
From: Peng Donglin @ 2018-06-13  1:11 UTC (permalink / raw)
  To: catalin.marinas, will.deacon; +Cc: linux-arm-kernel, linux-kernel, Peng Donglin

...instead of open coding file operations followed by custom ->open()
callbacks per each attribute.

Peng Donglin (2):
  ARM: dump: Convert to use DEFINE_SHOW_ATTRIBUTE macro
  ARM64: dump: Convert to use DEFINE_SHOW_ATTRIBUTE macro

 arch/arm/mm/ptdump_debugfs.c   | 13 +------------
 arch/arm64/mm/ptdump_debugfs.c | 13 +------------
 2 files changed, 2 insertions(+), 24 deletions(-)

-- 
2.7.4


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

* Re: [PATCH 1/2] ARM: dump: Convert to use DEFINE_SHOW_ATTRIBUTE macro
  2018-06-13  1:11 ` [PATCH 1/2] ARM: dump: Convert to use DEFINE_SHOW_ATTRIBUTE macro Peng Donglin
@ 2018-12-27 14:56   ` Donglin Peng
  0 siblings, 0 replies; 4+ messages in thread
From: Donglin Peng @ 2018-12-27 14:56 UTC (permalink / raw)
  To: catalin.marinas, will.deacon; +Cc: linux-arm-kernel, Linux Kernel Mailing List

On Wed, Jun 13, 2018 at 9:15 AM Peng Donglin <dolinux.peng@gmail.com> wrote:
>
> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
>
> Signed-off-by: Peng Donglin <dolinux.peng@gmail.com>
> ---
>  arch/arm/mm/ptdump_debugfs.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
>
> diff --git a/arch/arm/mm/ptdump_debugfs.c b/arch/arm/mm/ptdump_debugfs.c
> index be8d87b..79002fe 100644
> --- a/arch/arm/mm/ptdump_debugfs.c
> +++ b/arch/arm/mm/ptdump_debugfs.c
> @@ -11,18 +11,7 @@ static int ptdump_show(struct seq_file *m, void *v)
>         ptdump_walk_pgd(m, info);
>         return 0;
>  }
> -
> -static int ptdump_open(struct inode *inode, struct file *file)
> -{
> -       return single_open(file, ptdump_show, inode->i_private);
> -}
> -
> -static const struct file_operations ptdump_fops = {
> -       .open           = ptdump_open,
> -       .read           = seq_read,
> -       .llseek         = seq_lseek,
> -       .release        = single_release,
> -};
> +DEFINE_SHOW_ATTRIBUTE(ptdump);
>
>  int ptdump_debugfs_register(struct ptdump_info *info, const char *name)
>  {
> --
> 2.7.4
>

any suggestion?

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

end of thread, other threads:[~2018-12-27 14:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-13  1:11 [PATCH 0/2] Re-use DEFINE_SHOW_ATTRIBUTE() macro Peng Donglin
2018-06-13  1:11 ` [PATCH 1/2] ARM: dump: Convert to use DEFINE_SHOW_ATTRIBUTE macro Peng Donglin
2018-12-27 14:56   ` Donglin Peng
2018-06-13  1:11 ` [PATCH 2/2] ARM64: " Peng Donglin

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