[PATCH] v4l2-async: add debugfs under CONFIG_DEBUG_FS

luo.liu posted 1 patch 2 weeks, 4 days ago
drivers/media/v4l2-core/v4l2-async.c | 6 ++++++
1 file changed, 6 insertions(+)
[PATCH] v4l2-async: add debugfs under CONFIG_DEBUG_FS
Posted by luo.liu 2 weeks, 4 days ago
All debugfs-related code is guarded by CONFIG_DEBUG_FS to avoid
bloating the kernel when debugfs is disabled.

Signed-off-by: luo.liu <luo.liu.linux@163.com>
---
 drivers/media/v4l2-core/v4l2-async.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index 1c08bba9ecb9..ad4c0441b00e 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -966,21 +966,27 @@ static int pending_subdevs_show(struct seq_file *s, void *data)
 }
 DEFINE_SHOW_ATTRIBUTE(pending_subdevs);
 
+#ifdef CONFIG_DEBUG_FS
 static struct dentry *v4l2_async_debugfs_dir;
+#endif
 
 static int __init v4l2_async_init(void)
 {
+#ifdef CONFIG_DEBUG_FS
 	v4l2_async_debugfs_dir = debugfs_create_dir("v4l2-async", NULL);
 	debugfs_create_file("pending_async_subdevices", 0444,
 			    v4l2_async_debugfs_dir, NULL,
 			    &pending_subdevs_fops);
 
+#endif
 	return 0;
 }
 
 static void __exit v4l2_async_exit(void)
 {
+#ifdef CONFIG_DEBUG_FS
 	debugfs_remove_recursive(v4l2_async_debugfs_dir);
+#endif
 }
 
 subsys_initcall(v4l2_async_init);

base-commit: d08c85ac8894995d4b0d8fb48d2f6a3e53cd79ab
-- 
2.25.1
Re: [PATCH] v4l2-async: add debugfs under CONFIG_DEBUG_FS
Posted by kernel test robot 2 weeks, 4 days ago
Hi luo.liu,

kernel test robot noticed the following build warnings:

[auto build test WARNING on d08c85ac8894995d4b0d8fb48d2f6a3e53cd79ab]

url:    https://github.com/intel-lab-lkp/linux/commits/luo-liu/v4l2-async-add-debugfs-under-CONFIG_DEBUG_FS/20260120-150913
base:   d08c85ac8894995d4b0d8fb48d2f6a3e53cd79ab
patch link:    https://lore.kernel.org/r/20260120065710.1120819-1-luo.liu.linux%40163.com
patch subject: [PATCH] v4l2-async: add debugfs under CONFIG_DEBUG_FS
config: powerpc-randconfig-002-20260120 (https://download.01.org/0day-ci/archive/20260120/202601202104.uDfihrMe-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 10.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260120/202601202104.uDfihrMe-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601202104.uDfihrMe-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/linux/debugfs.h:16,
                    from drivers/media/v4l2-core/v4l2-async.c:8:
>> drivers/media/v4l2-core/v4l2-async.c:967:23: warning: 'pending_subdevs_fops' defined but not used [-Wunused-const-variable=]
     967 | DEFINE_SHOW_ATTRIBUTE(pending_subdevs);
         |                       ^~~~~~~~~~~~~~~
   include/linux/seq_file.h:213:37: note: in definition of macro 'DEFINE_SHOW_ATTRIBUTE'
     213 | static const struct file_operations __name ## _fops = {   \
         |                                     ^~~~~~


vim +/pending_subdevs_fops +967 drivers/media/v4l2-core/v4l2-async.c

517fd2b6a058bc4 Ezequiel Garcia 2021-01-08  949  
517fd2b6a058bc4 Ezequiel Garcia 2021-01-08  950  static int pending_subdevs_show(struct seq_file *s, void *data)
517fd2b6a058bc4 Ezequiel Garcia 2021-01-08  951  {
517fd2b6a058bc4 Ezequiel Garcia 2021-01-08  952  	struct v4l2_async_notifier *notif;
adb2dcd5f2d49d3 Sakari Ailus    2023-02-16  953  	struct v4l2_async_connection *asc;
517fd2b6a058bc4 Ezequiel Garcia 2021-01-08  954  
517fd2b6a058bc4 Ezequiel Garcia 2021-01-08  955  	mutex_lock(&list_lock);
517fd2b6a058bc4 Ezequiel Garcia 2021-01-08  956  
b6d42c35c03dc1a Sakari Ailus    2023-02-22  957  	list_for_each_entry(notif, &notifier_list, notifier_entry) {
3c8c153914812a9 Sakari Ailus    2021-03-05  958  		seq_printf(s, "%s:\n", v4l2_async_nf_name(notif));
9bf19fbf0c8bc43 Sakari Ailus    2023-04-18  959  		list_for_each_entry(asc, &notif->waiting_list, asc_entry)
adb2dcd5f2d49d3 Sakari Ailus    2023-02-16  960  			print_waiting_match(s, &asc->match);
517fd2b6a058bc4 Ezequiel Garcia 2021-01-08  961  	}
517fd2b6a058bc4 Ezequiel Garcia 2021-01-08  962  
517fd2b6a058bc4 Ezequiel Garcia 2021-01-08  963  	mutex_unlock(&list_lock);
517fd2b6a058bc4 Ezequiel Garcia 2021-01-08  964  
517fd2b6a058bc4 Ezequiel Garcia 2021-01-08  965  	return 0;
517fd2b6a058bc4 Ezequiel Garcia 2021-01-08  966  }
517fd2b6a058bc4 Ezequiel Garcia 2021-01-08 @967  DEFINE_SHOW_ATTRIBUTE(pending_subdevs);
517fd2b6a058bc4 Ezequiel Garcia 2021-01-08  968  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki