* [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