Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by: Yangtao Li tiny.windzz@gmail.com --- drivers/video/fbdev/omap2/omapfb/dss/core.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/core.c b/drivers/video/fbdev/omap2/omapfb/dss/core.c index a5e58a829ea0..7d3d9f6fad10 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/core.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/core.c @@ -99,24 +99,14 @@ int dss_set_min_bus_tput(struct device *dev, unsigned long tput) }
#if defined(CONFIG_FB_OMAP2_DSS_DEBUGFS) -static int dss_debug_show(struct seq_file *s, void *unused) +static int dss_show(struct seq_file *s, void *unused) { void (*func)(struct seq_file *) = s->private; func(s); return 0; }
-static int dss_debug_open(struct inode *inode, struct file *file) -{ - return single_open(file, dss_debug_show, inode->i_private); -} - -static const struct file_operations dss_debug_fops = { - .open = dss_debug_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(dss);
static struct dentry *dss_debugfs_dir;
@@ -130,7 +120,7 @@ static int dss_initialize_debugfs(void) }
debugfs_create_file("clk", S_IRUGO, dss_debugfs_dir, - &dss_debug_dump_clocks, &dss_debug_fops); + &dss_debug_dump_clocks, &dss_fops);
return 0; }
Hi Yangtao,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master] [also build test ERROR on v4.20-rc4 next-20181130] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Yangtao-Li/media-omap2-omapfb-conve... config: nds32-allmodconfig (attached as .config) compiler: nds32le-linux-gcc (GCC) 6.4.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=6.4.0 make.cross ARCH=nds32
All errors (new ones prefixed by >>):
drivers/video/fbdev//omap2/omapfb/dss/core.c: In function 'dss_debugfs_create_file':
drivers/video/fbdev//omap2/omapfb/dss/core.c:138:12: error: 'dss_debug_fops' undeclared (first use in this function)
write, &dss_debug_fops); ^~~~~~~~~~~~~~ drivers/video/fbdev//omap2/omapfb/dss/core.c:138:12: note: each undeclared identifier is reported only once for each function it appears in
vim +/dss_debug_fops +138 drivers/video/fbdev//omap2/omapfb/dss/core.c
f76ee892 Tomi Valkeinen 2015-12-09 132 f76ee892 Tomi Valkeinen 2015-12-09 133 int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *)) f76ee892 Tomi Valkeinen 2015-12-09 134 { f76ee892 Tomi Valkeinen 2015-12-09 135 struct dentry *d; f76ee892 Tomi Valkeinen 2015-12-09 136 f76ee892 Tomi Valkeinen 2015-12-09 137 d = debugfs_create_file(name, S_IRUGO, dss_debugfs_dir, f76ee892 Tomi Valkeinen 2015-12-09 @138 write, &dss_debug_fops); f76ee892 Tomi Valkeinen 2015-12-09 139 f76ee892 Tomi Valkeinen 2015-12-09 140 return PTR_ERR_OR_ZERO(d); f76ee892 Tomi Valkeinen 2015-12-09 141 } 35b522cf Tomi Valkeinen 2015-12-09 142 #else /* CONFIG_FB_OMAP2_DSS_DEBUGFS */ f76ee892 Tomi Valkeinen 2015-12-09 143 static inline int dss_initialize_debugfs(void) f76ee892 Tomi Valkeinen 2015-12-09 144 { f76ee892 Tomi Valkeinen 2015-12-09 145 return 0; f76ee892 Tomi Valkeinen 2015-12-09 146 } f76ee892 Tomi Valkeinen 2015-12-09 147 static inline void dss_uninitialize_debugfs(void) f76ee892 Tomi Valkeinen 2015-12-09 148 { f76ee892 Tomi Valkeinen 2015-12-09 149 } f76ee892 Tomi Valkeinen 2015-12-09 150 int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *)) f76ee892 Tomi Valkeinen 2015-12-09 151 { f76ee892 Tomi Valkeinen 2015-12-09 152 return 0; f76ee892 Tomi Valkeinen 2015-12-09 153 } 35b522cf Tomi Valkeinen 2015-12-09 154 #endif /* CONFIG_FB_OMAP2_DSS_DEBUGFS */ f76ee892 Tomi Valkeinen 2015-12-09 155
:::::: The code at line 138 was first introduced by commit :::::: f76ee892a99e68b55402b8d4b8aeffcae2aff34d omapfb: copy omapdss & displays for omapfb
:::::: TO: Tomi Valkeinen tomi.valkeinen@ti.com :::::: CC: Tomi Valkeinen tomi.valkeinen@ti.com
--- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi Yangtao,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master] [also build test ERROR on v4.20-rc4 next-20181130] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Yangtao-Li/media-omap2-omapfb-conve... config: xtensa-allmodconfig (attached as .config) compiler: xtensa-linux-gcc (GCC) 8.1.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=8.1.0 make.cross ARCH=xtensa
All errors (new ones prefixed by >>):
drivers/video/fbdev/omap2/omapfb/dss/core.c: In function 'dss_debugfs_create_file':
drivers/video/fbdev/omap2/omapfb/dss/core.c:138:12: error: 'dss_debug_fops' undeclared (first use in this function); did you mean 'dss_debugfs_dir'?
write, &dss_debug_fops); ^~~~~~~~~~~~~~ dss_debugfs_dir drivers/video/fbdev/omap2/omapfb/dss/core.c:138:12: note: each undeclared identifier is reported only once for each function it appears in
vim +138 drivers/video/fbdev/omap2/omapfb/dss/core.c
f76ee892 Tomi Valkeinen 2015-12-09 132 f76ee892 Tomi Valkeinen 2015-12-09 133 int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *)) f76ee892 Tomi Valkeinen 2015-12-09 134 { f76ee892 Tomi Valkeinen 2015-12-09 135 struct dentry *d; f76ee892 Tomi Valkeinen 2015-12-09 136 f76ee892 Tomi Valkeinen 2015-12-09 137 d = debugfs_create_file(name, S_IRUGO, dss_debugfs_dir, f76ee892 Tomi Valkeinen 2015-12-09 @138 write, &dss_debug_fops); f76ee892 Tomi Valkeinen 2015-12-09 139 f76ee892 Tomi Valkeinen 2015-12-09 140 return PTR_ERR_OR_ZERO(d); f76ee892 Tomi Valkeinen 2015-12-09 141 } 35b522cf Tomi Valkeinen 2015-12-09 142 #else /* CONFIG_FB_OMAP2_DSS_DEBUGFS */ f76ee892 Tomi Valkeinen 2015-12-09 143 static inline int dss_initialize_debugfs(void) f76ee892 Tomi Valkeinen 2015-12-09 144 { f76ee892 Tomi Valkeinen 2015-12-09 145 return 0; f76ee892 Tomi Valkeinen 2015-12-09 146 } f76ee892 Tomi Valkeinen 2015-12-09 147 static inline void dss_uninitialize_debugfs(void) f76ee892 Tomi Valkeinen 2015-12-09 148 { f76ee892 Tomi Valkeinen 2015-12-09 149 } f76ee892 Tomi Valkeinen 2015-12-09 150 int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *)) f76ee892 Tomi Valkeinen 2015-12-09 151 { f76ee892 Tomi Valkeinen 2015-12-09 152 return 0; f76ee892 Tomi Valkeinen 2015-12-09 153 } 35b522cf Tomi Valkeinen 2015-12-09 154 #endif /* CONFIG_FB_OMAP2_DSS_DEBUGFS */ f76ee892 Tomi Valkeinen 2015-12-09 155
:::::: The code at line 138 was first introduced by commit :::::: f76ee892a99e68b55402b8d4b8aeffcae2aff34d omapfb: copy omapdss & displays for omapfb
:::::: TO: Tomi Valkeinen tomi.valkeinen@ti.com :::::: CC: Tomi Valkeinen tomi.valkeinen@ti.com
--- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
dri-devel@lists.freedesktop.org