Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH] atomisp: remove unused module parameter dbg_func
@ 2026-05-11 19:32 Melih Emik
  2026-05-12  4:26 ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Melih Emik @ 2026-05-11 19:32 UTC (permalink / raw)
  To: Hans de Goede, Mauro Carvalho Chehab, Greg Kroah-Hartman
  Cc: Sakari Ailus, Andy Shevchenko, linux-media, linux-staging,
	linux-kernel, Melih Emik

atomisp_v4l2.c declared dbg_func as a module parameter to expose the
CSS debug print switch at module load time.

dbg_func remains as internal state for the CSS print environment, but
no code depends on the module parameter registration. After this removal,
git grep only finds the internal variable users and no module_param() or
MODULE_PARM_DESC() entry for dbg_func.

Remove the obsolete parameter while leaving the existing default debug
print state unchanged.

Signed-off-by: Melih Emik <melihemik@noirlang.tr>
---
 drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
index 900a67552d6a..2d19582ee7c5 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
@@ -50,9 +50,6 @@ MODULE_PARM_DESC(dbg_level, "debug message level (default:0)");
 
 /* log function switch */
 int dbg_func = 1;
-module_param(dbg_func, int, 0644);
-MODULE_PARM_DESC(dbg_func,
-		 "log function switch non/printk (default:printk)");
 
 /*
  * Set to 16x16 since this is the amount of lines and pixels the sensor
-- 
2.54.0


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

* Re: [PATCH] atomisp: remove unused module parameter dbg_func
  2026-05-11 19:32 [PATCH] atomisp: remove unused module parameter dbg_func Melih Emik
@ 2026-05-12  4:26 ` Andy Shevchenko
  2026-05-12 18:09   ` [PATCH v2] atomisp: replace dbg_func parameter with dynamic debug Melih Emik
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2026-05-12  4:26 UTC (permalink / raw)
  To: Melih Emik
  Cc: Hans de Goede, Mauro Carvalho Chehab, Greg Kroah-Hartman,
	Sakari Ailus, Andy Shevchenko, linux-media, linux-staging,
	linux-kernel

On Mon, May 11, 2026 at 10:32 PM Melih Emik <melihemik@noirlang.tr> wrote:
>
> atomisp_v4l2.c declared dbg_func as a module parameter to expose the
> CSS debug print switch at module load time.
>
> dbg_func remains as internal state for the CSS print environment, but
> no code depends on the module parameter registration. After this removal,
> git grep only finds the internal variable users and no module_param() or
> MODULE_PARM_DESC() entry for dbg_func.
>
> Remove the obsolete parameter while leaving the existing default debug
> print state unchanged.

While the direction is good, the patch is half-baked. Instead make
sure the similar infrastructure is available at runtime, exempli
gratia via trace events or dynamic debug.

-- 
With Best Regards,
Andy Shevchenko

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

* [PATCH v2] atomisp: replace dbg_func parameter with dynamic debug
  2026-05-12  4:26 ` Andy Shevchenko
@ 2026-05-12 18:09   ` Melih Emik
  2026-05-12 19:12     ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Melih Emik @ 2026-05-12 18:09 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Hans de Goede, Mauro Carvalho Chehab, Greg Kroah-Hartman,
	Sakari Ailus, Andy Shevchenko, linux-media, linux-staging,
	linux-kernel, Melih Emik

The dbg_func module parameter in atomisp_v4l2.c toggles the CSS
debug_print callback through a writable module parameter. Removing only
the parameter drops the runtime switch that users had through sysfs.

Keep the debug path available at runtime by routing CSS debug output
through dynamic debug instead. The callback remains installed, but its
output is controlled by the dynamic debug callsite. CSS error output
continues to use vprintk().

Remove the obsolete parameter, its global state and the unused get/set
helpers.

Signed-off-by: Melih Emik <melihemik@noirlang.tr>
---
 .../media/atomisp/pci/atomisp_common.h        |  1 -
 .../media/atomisp/pci/atomisp_compat_css20.c  | 47 ++++++-------------
 .../media/atomisp/pci/atomisp_compat_css20.h  |  3 --
 .../staging/media/atomisp/pci/atomisp_v4l2.c  |  6 ---
 4 files changed, 15 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_common.h b/drivers/staging/media/atomisp/pci/atomisp_common.h
index a2462fc306fb..145b35ad13cb 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_common.h
+++ b/drivers/staging/media/atomisp/pci/atomisp_common.h
@@ -21,7 +21,6 @@
 #include "ia_css.h"
 
 extern int dbg_level;
-extern int dbg_func;
 extern int pad_w;
 extern int pad_h;
 
diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
index be5f37f4a6fd..fb18c204266b 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
@@ -25,6 +25,7 @@
 #include "sh_css_hrt.h"
 #include "ia_css_isys.h"
 
+#include <linux/dynamic_debug.h>
 #include <linux/io.h>
 #include <linux/pm_runtime.h>
 
@@ -152,6 +153,19 @@ static int  __printf(1, 0) atomisp_vprintk(const char *fmt, va_list args)
 	return 0;
 }
 
+static int __printf(1, 0) atomisp_vpr_debug(const char *fmt, va_list args)
+{
+#if defined(CONFIG_DYNAMIC_DEBUG)
+	DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, "CSS debug");
+
+	if (DYNAMIC_DEBUG_BRANCH(descriptor))
+		vprintk(fmt, args);
+#elif defined(DEBUG)
+	vprintk(fmt, args);
+#endif
+	return 0;
+}
+
 void atomisp_load_uint32(hrt_address addr, uint32_t *data)
 {
 	*data = atomisp_css2_hw_load_32(addr);
@@ -745,20 +759,6 @@ int atomisp_css_init(struct atomisp_device *isp)
 	return 0;
 }
 
-static inline int __set_css_print_env(struct atomisp_device *isp, int opt)
-{
-	int ret = 0;
-
-	if (opt == 0)
-		isp->css_env.isp_css_env.print_env.debug_print = NULL;
-	else if (opt == 1)
-		isp->css_env.isp_css_env.print_env.debug_print = atomisp_vprintk;
-	else
-		ret = -EINVAL;
-
-	return ret;
-}
-
 int atomisp_css_load_firmware(struct atomisp_device *isp)
 {
 	int err;
@@ -783,8 +783,7 @@ int atomisp_css_load_firmware(struct atomisp_device *isp)
 	isp->css_env.isp_css_env.hw_access_env.load = atomisp_css2_hw_load;
 	isp->css_env.isp_css_env.hw_access_env.store = atomisp_css2_hw_store;
 
-	__set_css_print_env(isp, dbg_func);
-
+	isp->css_env.isp_css_env.print_env.debug_print = atomisp_vpr_debug;
 	isp->css_env.isp_css_env.print_env.error_print = atomisp_vprintk;
 
 	/* load isp fw into ISP memory */
@@ -3360,22 +3359,6 @@ void atomisp_css_set_isp_config_applied_frame(struct atomisp_sub_device *asd,
 	asd->params.config.output_frame = output_frame;
 }
 
-int atomisp_get_css_dbgfunc(void)
-{
-	return dbg_func;
-}
-
-int atomisp_set_css_dbgfunc(struct atomisp_device *isp, int opt)
-{
-	int ret;
-
-	ret = __set_css_print_env(isp, opt);
-	if (ret == 0)
-		dbg_func = opt;
-
-	return ret;
-}
-
 void atomisp_en_dz_capt_pipe(struct atomisp_sub_device *asd, bool enable)
 {
 	ia_css_en_dz_capt_pipe(
diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.h b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.h
index 75781807544a..e1c0b7e77974 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.h
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.h
@@ -150,9 +150,6 @@ void atomisp_css_set_isp_config_id(struct atomisp_sub_device *asd,
 void atomisp_css_set_isp_config_applied_frame(struct atomisp_sub_device *asd,
 	struct ia_css_frame *output_frame);
 
-int atomisp_get_css_dbgfunc(void);
-
-int atomisp_set_css_dbgfunc(struct atomisp_device *isp, int opt);
 struct ia_css_dvs_grid_info *atomisp_css_get_dvs_grid_info(
     struct ia_css_grid_info *grid_info);
 #endif
diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
index 900a67552d6a..d4374b7fc1ba 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
@@ -48,12 +48,6 @@ int dbg_level;
 module_param(dbg_level, int, 0644);
 MODULE_PARM_DESC(dbg_level, "debug message level (default:0)");
 
-/* log function switch */
-int dbg_func = 1;
-module_param(dbg_func, int, 0644);
-MODULE_PARM_DESC(dbg_func,
-		 "log function switch non/printk (default:printk)");
-
 /*
  * Set to 16x16 since this is the amount of lines and pixels the sensor
  * exports extra. If these are kept at the 10x8 that they were on, in yuv
-- 
2.54.0


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

* Re: [PATCH v2] atomisp: replace dbg_func parameter with dynamic debug
  2026-05-12 18:09   ` [PATCH v2] atomisp: replace dbg_func parameter with dynamic debug Melih Emik
@ 2026-05-12 19:12     ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2026-05-12 19:12 UTC (permalink / raw)
  To: Melih Emik
  Cc: Andy Shevchenko, Hans de Goede, Mauro Carvalho Chehab,
	Greg Kroah-Hartman, Sakari Ailus, Andy Shevchenko, linux-media,
	linux-staging, linux-kernel

On Tue, May 12, 2026 at 09:09:58PM +0300, Melih Emik wrote:
> The dbg_func module parameter in atomisp_v4l2.c toggles the CSS
> debug_print callback through a writable module parameter. Removing only
> the parameter drops the runtime switch that users had through sysfs.
> 
> Keep the debug path available at runtime by routing CSS debug output
> through dynamic debug instead. The callback remains installed, but its
> output is controlled by the dynamic debug callsite. CSS error output
> continues to use vprintk().
> 
> Remove the obsolete parameter, its global state and the unused get/set
> helpers.

Okay, this is the move to the right direction (however we leave dbg_level for
whatever it means).

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2026-05-12 19:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11 19:32 [PATCH] atomisp: remove unused module parameter dbg_func Melih Emik
2026-05-12  4:26 ` Andy Shevchenko
2026-05-12 18:09   ` [PATCH v2] atomisp: replace dbg_func parameter with dynamic debug Melih Emik
2026-05-12 19:12     ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox