In dynamic_debug_init(), add 2nd cursor pair to walk the __dyndbg_sites section in parallel with the __dyndbg section. This avoids using the _ddebug.site pointer during initialization, which is a 1st step towards dropping the member entirely, and reducing the struct size and section footprint. no functional change Signed-off-by: Jim Cromie <jim.cromie@xxxxxxxxx> --- lib/dynamic_debug.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 0ad9f1bc00f0..51af6a75ae92 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1501,6 +1501,7 @@ static int __init dynamic_debug_init_control(void) static int __init dynamic_debug_init(void) { + struct _ddebug_site *site, *site_mod_start; struct _ddebug *iter, *iter_mod_start; int ret, i, mod_sites, mod_ct; const char *modname; @@ -1508,9 +1509,11 @@ static int __init dynamic_debug_init(void) struct _ddebug_info di = { .descs = __start___dyndbg, + .sites = __start___dyndbg_sites, .classes = __start___dyndbg_classes, .class_users = __start___dyndbg_class_users, .num_descs = __stop___dyndbg - __start___dyndbg, + .num_sites = __stop___dyndbg_sites - __start___dyndbg_sites, .num_classes = __stop___dyndbg_classes - __start___dyndbg_classes, .num_class_users = __stop___dyndbg_class_users - __start___dyndbg_class_users, }; @@ -1533,16 +1536,19 @@ static int __init dynamic_debug_init(void) return 0; } + site = site_mod_start = di.sites; iter = iter_mod_start = __start___dyndbg; modname = desc_modname(iter); i = mod_sites = mod_ct = 0; - for (; iter < __stop___dyndbg; iter++, i++, mod_sites++) { + for (; iter < __stop___dyndbg; iter++, site++, i++, mod_sites++) { if (strcmp(modname, desc_modname(iter))) { mod_ct++; di.num_descs = mod_sites; + di.num_sites = mod_sites; di.descs = iter_mod_start; + di.sites = site_mod_start; ret = ddebug_add_module(&di, modname); if (ret) goto out_err; @@ -1550,10 +1556,13 @@ static int __init dynamic_debug_init(void) mod_sites = 0; modname = desc_modname(iter); iter_mod_start = iter; + site_mod_start = site; } } di.num_descs = mod_sites; + di.num_sites = mod_sites; di.descs = iter_mod_start; + di.sites = site_mod_start; ret = ddebug_add_module(&di, modname); if (ret) goto out_err; -- 2.41.0