Instead on relying on CONFIG_DEBUG_FS, rely on the new
CONFIG_STM32_FIREWALL_DEBUG switch that groups all stm32 firewall
debug features to embed RIFSC configuration dump.
While there, use IF_DEFINED() instead of #if defined() so that
all the code is always compiled and let the compiler optimize.
Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
---
drivers/bus/stm32_rifsc.c | 48 +++++++++++++++++++++++------------------------
1 file changed, 23 insertions(+), 25 deletions(-)
diff --git a/drivers/bus/stm32_rifsc.c b/drivers/bus/stm32_rifsc.c
index debeaf8ea1bd..80bd5c5acfb4 100644
--- a/drivers/bus/stm32_rifsc.c
+++ b/drivers/bus/stm32_rifsc.c
@@ -73,7 +73,6 @@
#define RIF_CID0 0x0
#define RIF_CID1 0x1
-#if defined(CONFIG_DEBUG_FS)
#define RIFSC_RISUP_ENTRIES 128
#define RIFSC_RIMU_ENTRIES 16
#define RIFSC_RISAL_SUBREGIONS 2
@@ -434,18 +433,19 @@ struct rifsc_dbg_private {
unsigned int nb_risal;
};
-static const struct stm32_rifsc_resources_names rifsc_mp21_res_names = {
+static const struct __maybe_unused stm32_rifsc_resources_names rifsc_mp21_res_names = {
.device_names = stm32mp21_rifsc_risup_names,
.initiator_names = stm32mp21_rifsc_rimu_names,
};
-static const struct stm32_rifsc_resources_names rifsc_mp25_res_names = {
+static const struct __maybe_unused stm32_rifsc_resources_names rifsc_mp25_res_names = {
.device_names = stm32mp25_rifsc_risup_names,
.initiator_names = stm32mp25_rifsc_rimu_names,
};
-static void stm32_rifsc_fill_rimu_dbg_entry(struct rifsc_dbg_private *rifsc,
- struct rifsc_rimu_debug_data *dbg_entry, int i)
+static void __maybe_unused stm32_rifsc_fill_rimu_dbg_entry(struct rifsc_dbg_private *rifsc,
+ struct rifsc_rimu_debug_data *dbg_entry,
+ int i)
{
const struct stm32_rifsc_resources_names *dbg_names = rifsc->res_names;
u32 rimc_attr = readl_relaxed(rifsc->mmio + RIFSC_RIMC_ATTR0 + 0x4 * i);
@@ -457,8 +457,9 @@ static void stm32_rifsc_fill_rimu_dbg_entry(struct rifsc_dbg_private *rifsc,
dbg_entry->m_priv = rimc_attr & RIFSC_RIMC_MPRIV;
}
-static void stm32_rifsc_fill_dev_dbg_entry(struct rifsc_dbg_private *rifsc,
- struct rifsc_risup_debug_data *dbg_entry, int i)
+static void __maybe_unused stm32_rifsc_fill_dev_dbg_entry(struct rifsc_dbg_private *rifsc,
+ struct rifsc_risup_debug_data *dbg_entry,
+ int i)
{
const struct stm32_rifsc_resources_names *dbg_names = rifsc->res_names;
u32 cid_cfgr, sec_cfgr, priv_cfgr;
@@ -481,9 +482,9 @@ static void stm32_rifsc_fill_dev_dbg_entry(struct rifsc_dbg_private *rifsc,
}
-static void stm32_rifsc_fill_subreg_dbg_entry(struct rifsc_dbg_private *rifsc,
- struct rifsc_subreg_debug_data *dbg_entry, int i,
- int j)
+static void __maybe_unused
+stm32_rifsc_fill_subreg_dbg_entry(struct rifsc_dbg_private *rifsc,
+ struct rifsc_subreg_debug_data *dbg_entry, int i, int j)
{
u32 risc_xcfgr = readl_relaxed(rifsc->mmio + RIFSC_RISC_REG0_ACFGR + 0x10 * i + 0x8 * j);
u32 risc_xaddr;
@@ -503,7 +504,7 @@ static void stm32_rifsc_fill_subreg_dbg_entry(struct rifsc_dbg_private *rifsc,
}
}
-static int stm32_rifsc_conf_dump_show(struct seq_file *s, void *data)
+static int __maybe_unused stm32_rifsc_conf_dump_show(struct seq_file *s, void *data)
{
struct rifsc_dbg_private *rifsc = (struct rifsc_dbg_private *)s->private;
int i, j;
@@ -603,8 +604,9 @@ static int stm32_rifsc_conf_dump_show(struct seq_file *s, void *data)
}
DEFINE_SHOW_ATTRIBUTE(stm32_rifsc_conf_dump);
-static int stm32_rifsc_register_debugfs(struct stm32_firewall_controller *rifsc_controller,
- u32 nb_risup, u32 nb_rimu, u32 nb_risal)
+static int __maybe_unused
+stm32_rifsc_register_debugfs(struct stm32_firewall_controller *rifsc_controller, u32 nb_risup,
+ u32 nb_rimu, u32 nb_risal)
{
struct rifsc_dbg_private *rifsc_priv;
struct dentry *root = NULL;
@@ -630,7 +632,6 @@ static int stm32_rifsc_register_debugfs(struct stm32_firewall_controller *rifsc_
return 0;
}
-#endif /* defined(CONFIG_DEBUG_FS) */
static bool stm32_rifsc_is_semaphore_available(void __iomem *addr)
{
@@ -800,11 +801,12 @@ static int stm32_rifsc_probe(struct platform_device *pdev)
return rc;
}
-#if defined(CONFIG_DEBUG_FS)
- rc = stm32_rifsc_register_debugfs(rifsc_controller, nb_risup, nb_rimu, nb_risal);
- if (rc)
- return dev_err_probe(rifsc_controller->dev, rc, "Failed creating debugfs entry\n");
-#endif
+ if (IS_ENABLED(CONFIG_STM32_FIREWALL_DEBUG)) {
+ rc = stm32_rifsc_register_debugfs(rifsc_controller, nb_risup, nb_rimu, nb_risal);
+ if (rc)
+ return dev_err_probe(rifsc_controller->dev, rc,
+ "Failed creating debugfs entry\n");
+ }
/* Populate all allowed nodes */
return of_platform_populate(np, NULL, NULL, &pdev->dev);
@@ -813,15 +815,11 @@ static int stm32_rifsc_probe(struct platform_device *pdev)
static const struct of_device_id stm32_rifsc_of_match[] = {
{
.compatible = "st,stm32mp25-rifsc",
-#if defined(CONFIG_DEBUG_FS)
- .data = &rifsc_mp25_res_names,
-#endif
+ .data = PTR_IF(IS_ENABLED(CONFIG_STM32_FIREWALL_DEBUG), &rifsc_mp25_res_names),
},
{
.compatible = "st,stm32mp21-rifsc",
-#if defined(CONFIG_DEBUG_FS)
- .data = &rifsc_mp21_res_names,
-#endif
+ .data = PTR_IF(IS_ENABLED(CONFIG_STM32_FIREWALL_DEBUG), &rifsc_mp21_res_names)
},
{}
};
--
2.43.0
Hi Gatien,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 05f7e89ab9731565d8a62e3b5d1ec206485eeb0b]
url: https://github.com/intel-lab-lkp/linux/commits/Gatien-Chevallier/dt-bindings-bus-document-the-RISAB-firewall-peripheral/20260212-182006
base: 05f7e89ab9731565d8a62e3b5d1ec206485eeb0b
patch link: https://lore.kernel.org/r/20260212-stm32_risab-v2-3-02ef2859b596%40foss.st.com
patch subject: [PATCH v2 3/9] bus: rifsc: use new CONFIG_STM32_FIREWALL_DEBUG switch
config: loongarch-randconfig-002-20260212 (https://download.01.org/0day-ci/archive/20260213/202602130151.3v3igg2M-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 9b8addffa70cee5b2acc5454712d9cf78ce45710)
rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260213/202602130151.3v3igg2M-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/202602130151.3v3igg2M-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/bus/stm32_rifsc.c:436:21: warning: attribute declaration must precede definition [-Wignored-attributes]
436 | static const struct __maybe_unused stm32_rifsc_resources_names rifsc_mp21_res_names = {
| ^
include/linux/compiler_attributes.h:343:56: note: expanded from macro '__maybe_unused'
343 | #define __maybe_unused __attribute__((__unused__))
| ^
drivers/bus/stm32_rifsc.c:424:8: note: previous definition is here
424 | struct stm32_rifsc_resources_names {
| ^
drivers/bus/stm32_rifsc.c:441:21: warning: attribute declaration must precede definition [-Wignored-attributes]
441 | static const struct __maybe_unused stm32_rifsc_resources_names rifsc_mp25_res_names = {
| ^
include/linux/compiler_attributes.h:343:56: note: expanded from macro '__maybe_unused'
343 | #define __maybe_unused __attribute__((__unused__))
| ^
drivers/bus/stm32_rifsc.c:424:8: note: previous definition is here
424 | struct stm32_rifsc_resources_names {
| ^
2 warnings generated.
vim +436 drivers/bus/stm32_rifsc.c
435
> 436 static const struct __maybe_unused stm32_rifsc_resources_names rifsc_mp21_res_names = {
437 .device_names = stm32mp21_rifsc_risup_names,
438 .initiator_names = stm32mp21_rifsc_rimu_names,
439 };
440
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
© 2016 - 2026 Red Hat, Inc.