This patch fixes a sparse issue if DEFINE_STATIC_SRCU() of srcutree is used by a module. Sparse will show: sparse: symbol '__srcu_struct_nodes_srcu' was not declared. Should it be static? The problem is here that the DEFINE_STATIC_SRCU() of srcutree uses __DEFINE_SRCU() and define a non-static srcu_struct. This srcu_struct will be exported by inserting it in a special module section '__section("___srcu_struct_ptrs")'. During load/unloading srcutree runs their init/cleanup functionality. It seems sparse does not understand this connection. To avoid the sparse warning we make a prototype of the exported srcu_struct with an export keyword. This way we tell the that the srcu_struct might be used outside of the module. Signed-off-by: Alexander Aring <aahringo@xxxxxxxxxx> --- include/linux/srcutree.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h index cb1f4351e8ba..f81be0749484 100644 --- a/include/linux/srcutree.h +++ b/include/linux/srcutree.h @@ -121,6 +121,7 @@ struct srcu_struct { #ifdef MODULE # define __DEFINE_SRCU(name, is_static) \ is_static struct srcu_struct name; \ + extern struct srcu_struct * const __srcu_struct_##name; \ struct srcu_struct * const __srcu_struct_##name \ __section("___srcu_struct_ptrs") = &name #else -- 2.31.1