Commit aa86a154 authored by Jim Cromie's avatar Jim Cromie Committed by Greg Kroah-Hartman

dyndbg: cleanup auto vars in dynamic_debug_init

rework var-names for clarity, regularity
rename variables
  - n to mod_sites - it counts sites-per-module
  - entries to i - display only
  - iter_start to iter_mod_start - marks start of each module's subrange
  - modct to mod_ct - stylistic

new iterator var:
  - site - cursor parallel to iter
    1st step towards 'demotion' of iter->site, for removal later

treat vars as iters:
  - drop init at top
    init just above for-loop, in a textual block
Acked-by: default avatarJason Baron <jbaron@akamai.com>
Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
Link: https://lore.kernel.org/r/20220904214134.408619-11-jim.cromie@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e26ef3af
...@@ -1059,11 +1059,10 @@ static int __init dynamic_debug_init_control(void) ...@@ -1059,11 +1059,10 @@ static int __init dynamic_debug_init_control(void)
static int __init dynamic_debug_init(void) static int __init dynamic_debug_init(void)
{ {
struct _ddebug *iter, *iter_start; struct _ddebug *iter, *iter_mod_start;
const char *modname = NULL; int ret, i, mod_sites, mod_ct;
const char *modname;
char *cmdline; char *cmdline;
int ret = 0;
int n = 0, entries = 0, modct = 0;
if (&__start___dyndbg == &__stop___dyndbg) { if (&__start___dyndbg == &__stop___dyndbg) {
if (IS_ENABLED(CONFIG_DYNAMIC_DEBUG)) { if (IS_ENABLED(CONFIG_DYNAMIC_DEBUG)) {
...@@ -1074,30 +1073,32 @@ static int __init dynamic_debug_init(void) ...@@ -1074,30 +1073,32 @@ static int __init dynamic_debug_init(void)
ddebug_init_success = 1; ddebug_init_success = 1;
return 0; return 0;
} }
iter = __start___dyndbg;
iter = iter_mod_start = __start___dyndbg;
modname = iter->modname; modname = iter->modname;
iter_start = iter; i = mod_sites = mod_ct = 0;
for (; iter < __stop___dyndbg; iter++) {
entries++; for (; iter < __stop___dyndbg; iter++, i++, mod_sites++) {
if (strcmp(modname, iter->modname)) { if (strcmp(modname, iter->modname)) {
modct++; mod_ct++;
ret = ddebug_add_module(iter_start, n, modname); ret = ddebug_add_module(iter_mod_start, mod_sites, modname);
if (ret) if (ret)
goto out_err; goto out_err;
n = 0;
mod_sites = 0;
modname = iter->modname; modname = iter->modname;
iter_start = iter; iter_mod_start = iter;
} }
n++;
} }
ret = ddebug_add_module(iter_start, n, modname); ret = ddebug_add_module(iter_mod_start, mod_sites, modname);
if (ret) if (ret)
goto out_err; goto out_err;
ddebug_init_success = 1; ddebug_init_success = 1;
vpr_info("%d prdebugs in %d modules, %d KiB in ddebug tables, %d kiB in __dyndbg section\n", vpr_info("%d prdebugs in %d modules, %d KiB in ddebug tables, %d kiB in __dyndbg section\n",
entries, modct, (int)((modct * sizeof(struct ddebug_table)) >> 10), i, mod_ct, (int)((mod_ct * sizeof(struct ddebug_table)) >> 10),
(int)((entries * sizeof(struct _ddebug)) >> 10)); (int)((i * sizeof(struct _ddebug)) >> 10));
/* now that ddebug tables are loaded, process all boot args /* now that ddebug tables are loaded, process all boot args
* again to find and activate queries given in dyndbg params. * again to find and activate queries given in dyndbg params.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment