[PATCH 12/12] dynamic debug: declare table as external array

From: Vegard Nossum
Date: Sun Oct 16 2016 - 11:20:37 EST


Cc: Greg Banks <gnb@xxxxxxx>
Cc: Jason Baron <jbaron@xxxxxxxxxx>
Signed-off-by: Vegard Nossum <vegard.nossum@xxxxxxxxxx>
---
lib/dynamic_debug.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index da796e2..101a420 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -13,6 +13,7 @@

#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__

+#include <linux/extarray.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
@@ -37,8 +38,7 @@
#include <linux/device.h>
#include <linux/netdevice.h>

-extern struct _ddebug __start___verbose[];
-extern struct _ddebug __stop___verbose[];
+DECLARE_EXTARRAY(struct _ddebug, __verbose);

struct ddebug_table {
struct list_head link;
@@ -978,14 +978,14 @@ static int __init dynamic_debug_init(void)
int n = 0, entries = 0, modct = 0;
int verbose_bytes = 0;

- if (__start___verbose == __stop___verbose) {
+ if (!ext_size(__verbose)) {
pr_warn("_ddebug table is empty in a CONFIG_DYNAMIC_DEBUG build\n");
return 1;
}
- iter = __start___verbose;
+ iter = ext_start(__verbose);
modname = iter->modname;
iter_start = iter;
- for (; iter < __stop___verbose; iter++) {
+ for (; iter < ext_end(__verbose); iter++) {
entries++;
verbose_bytes += strlen(iter->modname) + strlen(iter->function)
+ strlen(iter->filename) + strlen(iter->format);
@@ -1008,7 +1008,7 @@ static int __init dynamic_debug_init(void)
ddebug_init_success = 1;
vpr_info("%d modules, %d entries and %d bytes in ddebug tables, %d bytes in (readonly) verbose section\n",
modct, entries, (int)(modct * sizeof(struct ddebug_table)),
- verbose_bytes + (int)(__stop___verbose - __start___verbose));
+ verbose_bytes + (int)(ext_size(__verbose) * sizeof(struct _ddebug)));

/* apply ddebug_query boot param, dont unload tables on err */
if (ddebug_setup_string[0] != '\0') {
--
2.10.0.479.g221bd91