The patch titled Subject: mm: reuse DEFINE_SHOW_ATTRIBUTE() macro has been added to the -mm tree. Its filename is mm-re-use-define_show_attribute-macro.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-re-use-define_show_attribute-macro.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-re-use-define_show_attribute-macro.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Subject: mm: reuse DEFINE_SHOW_ATTRIBUTE() macro ...instead of open coding file operations followed by custom ->open() callbacks per each attribute. Link: http://lkml.kernel.org/r/20180214154644.54505-1-andriy.shevchenko@xxxxxxxxxxxxxxx Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Reviewed-by: Matthew Wilcox <mawilcox@xxxxxxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Acked-by: Christoph Lameter <cl@xxxxxxxxx> Cc: Tejun Heo <tj@xxxxxxxxxx> Cc: Dennis Zhou <dennisszhou@xxxxxxxxx> Cc: Minchan Kim <minchan@xxxxxxxxxx> Cc: Nitin Gupta <ngupta@xxxxxxxxxx> Cc: Sergey Senozhatsky <sergey.senozhatsky.work@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/backing-dev.c | 12 +----------- mm/memblock.c | 12 +----------- mm/percpu-stats.c | 12 +----------- mm/zsmalloc.c | 12 +----------- 4 files changed, 4 insertions(+), 44 deletions(-) diff -puN mm/backing-dev.c~mm-re-use-define_show_attribute-macro mm/backing-dev.c --- a/mm/backing-dev.c~mm-re-use-define_show_attribute-macro +++ a/mm/backing-dev.c @@ -101,17 +101,7 @@ static int bdi_debug_stats_show(struct s return 0; } -static int bdi_debug_stats_open(struct inode *inode, struct file *file) -{ - return single_open(file, bdi_debug_stats_show, inode->i_private); -} - -static const struct file_operations bdi_debug_stats_fops = { - .open = bdi_debug_stats_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(bdi_debug_stats); static int bdi_debug_register(struct backing_dev_info *bdi, const char *name) { diff -puN mm/memblock.c~mm-re-use-define_show_attribute-macro mm/memblock.c --- a/mm/memblock.c~mm-re-use-define_show_attribute-macro +++ a/mm/memblock.c @@ -1824,17 +1824,7 @@ static int memblock_debug_show(struct se return 0; } -static int memblock_debug_open(struct inode *inode, struct file *file) -{ - return single_open(file, memblock_debug_show, inode->i_private); -} - -static const struct file_operations memblock_debug_fops = { - .open = memblock_debug_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(memblock_debug); static int __init memblock_init_debugfs(void) { diff -puN mm/percpu-stats.c~mm-re-use-define_show_attribute-macro mm/percpu-stats.c --- a/mm/percpu-stats.c~mm-re-use-define_show_attribute-macro +++ a/mm/percpu-stats.c @@ -224,17 +224,7 @@ alloc_buffer: return 0; } -static int percpu_stats_open(struct inode *inode, struct file *filp) -{ - return single_open(filp, percpu_stats_show, NULL); -} - -static const struct file_operations percpu_stats_fops = { - .open = percpu_stats_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(percpu_stats); static int __init init_percpu_stats_debugfs(void) { diff -puN mm/zsmalloc.c~mm-re-use-define_show_attribute-macro mm/zsmalloc.c --- a/mm/zsmalloc.c~mm-re-use-define_show_attribute-macro +++ a/mm/zsmalloc.c @@ -642,17 +642,7 @@ static int zs_stats_size_show(struct seq return 0; } -static int zs_stats_size_open(struct inode *inode, struct file *file) -{ - return single_open(file, zs_stats_size_show, inode->i_private); -} - -static const struct file_operations zs_stat_size_ops = { - .open = zs_stats_size_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(zs_stats_size); static void zs_pool_stat_create(struct zs_pool *pool, const char *name) { _ Patches currently in -mm which might be from andriy.shevchenko@xxxxxxxxxxxxxxx are mm-re-use-define_show_attribute-macro.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html