aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/dynamic_debug.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 09f2cda88058..3b06f926d5b8 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -862,39 +862,43 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
862} 862}
863EXPORT_SYMBOL_GPL(ddebug_add_module); 863EXPORT_SYMBOL_GPL(ddebug_add_module);
864 864
865/* handle both dyndbg=".." and $module.dyndbg=".." params at boot */ 865/* helper for ddebug_dyndbg_(boot|module)_param_cb */
866static int ddebug_dyndbg_boot_param_cb(char *param, char *val, 866static int ddebug_dyndbg_param_cb(char *param, char *val,
867 const char *unused) 867 const char *modname, int on_err)
868{ 868{
869 const char *modname = NULL;
870 char *sep; 869 char *sep;
871 870
872 sep = strchr(param, '.'); 871 sep = strchr(param, '.');
873 if (sep) { 872 if (sep) {
873 /* needed only for ddebug_dyndbg_boot_param_cb */
874 *sep = '\0'; 874 *sep = '\0';
875 modname = param; 875 modname = param;
876 param = sep + 1; 876 param = sep + 1;
877 } 877 }
878 if (strcmp(param, "dyndbg")) 878 if (strcmp(param, "dyndbg"))
879 return 0; /* skip all other params w/o error */ 879 return on_err; /* determined by caller */
880
881 vpr_info("module: %s %s=\"%s\"\n", modname, param, val);
882 880
883 ddebug_exec_queries(val ? val : "+p"); 881 ddebug_exec_queries(val ? val : "+p");
884 return 0; /* query failure shouldnt stop module load */ 882 return 0; /* query failure shouldnt stop module load */
885} 883}
886 884
887/* handle dyndbg args to modprobe */ 885/* handle both dyndbg and $module.dyndbg params at boot */
888int ddebug_dyndbg_module_param_cb(char *param, char *val, const char *doing) 886static int ddebug_dyndbg_boot_param_cb(char *param, char *val,
887 const char *unused)
889{ 888{
890 if (strcmp(param, "dyndbg")) 889 vpr_info("%s=\"%s\"\n", param, val);
891 return -ENOENT; 890 return ddebug_dyndbg_param_cb(param, val, NULL, 0);
892 891}
893 vpr_info("module: %s %s=\"%s\"\n", doing, param, val);
894
895 ddebug_exec_queries((val ? val : "+p"));
896 892
897 return 0; /* query failure shouldnt stop module load */ 893/*
894 * modprobe foo finds foo.params in boot-args, strips "foo.", and
895 * passes them to load_module(). This callback gets unknown params,
896 * processes dyndbg params, rejects others.
897 */
898int ddebug_dyndbg_module_param_cb(char *param, char *val, const char *module)
899{
900 vpr_info("module: %s %s=\"%s\"\n", module, param, val);
901 return ddebug_dyndbg_param_cb(param, val, module, -ENOENT);
898} 902}
899 903
900static void ddebug_table_free(struct ddebug_table *dt) 904static void ddebug_table_free(struct ddebug_table *dt)