dyndbg: fix usability bug by adding pr_errs for -EINVALs

A recent usability grumble on LKML prompted a review of error
reporting when writing dyndbg queries.  For each -EINVAL, this adds
pr_err()s to explain the error.

To: Jason Baron <jbaron@redhat.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CC: Jianpeng Ma <majianpeng@gmail.com>
dyndbg: spelling fix s/conrol/control/

fix name of control file in comment
dyndbg: add more info to -E2BIG log warning

tell user how big the attempted write was, in case its not obvious.
dyndbg: increase verbosity for proc-show, proc-next

catting /dbg/dynamic_debug/control creates reams of log entries under
verbose, add v2pr_info(), v3pr_info() macros, and use them in
proc-file-ish functions to reduce log clutter.
dyndbg-prob-demo: include jump_label.h, break compile

We want to add struct static_key key to struct _ddebug, so that
dynamic_debug can be optimized using jump-labels.

But adding #include <linux/jump_label.h> breaks the compile, by
causing an include loop.

[jimc@groucho build-dell]$ make
make[3]: Nothing to be done for `all'.
make[3]: Nothing to be done for `relocs'.
  Using /home/jimc/projects/lx/linux-2.6 as source for kernel
  GEN     /home/jimc/projects/lx/build-dell/Makefile
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      kernel/bounds.s
In file included from /home/jimc/projects/lx/linux-2.6/include/linux/cpumask.h:11:0,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/cpumask.h:4,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/msr.h:18,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/processor.h:20,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/thread_info.h:22,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/thread_info.h:54,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/preempt.h:9,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/spinlock.h:50,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/seqlock.h:29,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/time.h:8,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/ktime.h:24,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/timer.h:5,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/workqueue.h:8,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/jump_label.h:51,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/dynamic_debug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/kernel.h:23,
                 from /home/jimc/projects/lx/linux-2.6/include/asm-generic/bug.h:13,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/bug.h:38,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/bug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/page-flags.h:9,
                 from /home/jimc/projects/lx/linux-2.6/kernel/bounds.c:9:
/home/jimc/projects/lx/linux-2.6/include/linux/bitmap.h: In function ‘bitmap_zero’:
/home/jimc/projects/lx/linux-2.6/include/linux/bitmap.h:164:3: error: implicit declaration of function ‘DIV_ROUND_UP’ [-Werror=implicit-function-declaration]
In file included from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/cpumask.h:4:0,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/msr.h:18,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/processor.h:20,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/thread_info.h:22,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/thread_info.h:54,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/preempt.h:9,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/spinlock.h:50,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/seqlock.h:29,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/time.h:8,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/ktime.h:24,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/timer.h:5,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/workqueue.h:8,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/jump_label.h:51,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/dynamic_debug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/kernel.h:23,
                 from /home/jimc/projects/lx/linux-2.6/include/asm-generic/bug.h:13,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/bug.h:38,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/bug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/page-flags.h:9,
                 from /home/jimc/projects/lx/linux-2.6/kernel/bounds.c:9:
/home/jimc/projects/lx/linux-2.6/include/linux/cpumask.h: At top level:
/home/jimc/projects/lx/linux-2.6/include/linux/cpumask.h:14:26: error: variably modified ‘bits’ at file scope
/home/jimc/projects/lx/linux-2.6/include/linux/cpumask.h: In function ‘cpumask_check’:
/home/jimc/projects/lx/linux-2.6/include/linux/cpumask.h:108:2: error: implicit declaration of function ‘WARN_ON_ONCE’ [-Werror=implicit-function-declaration]
/home/jimc/projects/lx/linux-2.6/include/linux/cpumask.h: At top level:
/home/jimc/projects/lx/linux-2.6/include/linux/cpumask.h:700:14: error: variably modified ‘cpu_all_bits’ at file scope
/home/jimc/projects/lx/linux-2.6/include/linux/cpumask.h:746:2: error: variably modified ‘cpu_bit_bitmap’ at file scope
In file included from /home/jimc/projects/lx/linux-2.6/include/linux/thread_info.h:54:0,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/preempt.h:9,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/spinlock.h:50,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/seqlock.h:29,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/time.h:8,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/ktime.h:24,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/timer.h:5,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/workqueue.h:8,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/jump_label.h:51,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/dynamic_debug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/kernel.h:23,
                 from /home/jimc/projects/lx/linux-2.6/include/asm-generic/bug.h:13,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/bug.h:38,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/bug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/page-flags.h:9,
                 from /home/jimc/projects/lx/linux-2.6/kernel/bounds.c:9:
/home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/thread_info.h: In function ‘set_restore_sigmask’:
/home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/thread_info.h:249:2: error: implicit declaration of function ‘WARN_ON’ [-Werror=implicit-function-declaration]
In file included from /home/jimc/projects/lx/linux-2.6/include/linux/spinlock.h:263:0,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/seqlock.h:29,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/time.h:8,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/ktime.h:24,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/timer.h:5,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/workqueue.h:8,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/jump_label.h:51,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/dynamic_debug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/kernel.h:23,
                 from /home/jimc/projects/lx/linux-2.6/include/asm-generic/bug.h:13,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/bug.h:38,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/bug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/page-flags.h:9,
                 from /home/jimc/projects/lx/linux-2.6/kernel/bounds.c:9:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h: In function ‘__raw_spin_trylock’:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:90:3: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:90:3: note: each undeclared identifier is reported only once for each function it appears in
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h: In function ‘__raw_spin_lock_irqsave’:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:110:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h: In function ‘__raw_spin_lock_irq’:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:128:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h: In function ‘__raw_spin_lock_bh’:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:136:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h: In function ‘__raw_spin_lock’:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:143:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h: In function ‘__raw_spin_unlock’:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:151:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h: In function ‘__raw_spin_unlock_irqrestore’:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:159:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h: In function ‘__raw_spin_unlock_irq’:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:167:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h: In function ‘__raw_spin_unlock_bh’:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:175:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h: In function ‘__raw_spin_trylock_bh’:
/home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:186:3: error: ‘_RET_IP_’ undeclared (first use in this function)
In file included from /home/jimc/projects/lx/linux-2.6/include/linux/spinlock_api_smp.h:194:0,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/spinlock.h:263,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/seqlock.h:29,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/time.h:8,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/ktime.h:24,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/timer.h:5,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/workqueue.h:8,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/jump_label.h:51,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/dynamic_debug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/kernel.h:23,
                 from /home/jimc/projects/lx/linux-2.6/include/asm-generic/bug.h:13,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/bug.h:38,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/bug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/page-flags.h:9,
                 from /home/jimc/projects/lx/linux-2.6/kernel/bounds.c:9:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_read_trylock’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:121:3: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_write_trylock’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:132:3: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_read_lock’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:149:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_read_lock_irqsave’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:159:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_read_lock_irq’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:169:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_read_lock_bh’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:177:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_write_lock_irqsave’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:187:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_write_lock_irq’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:197:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_write_lock_bh’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:205:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_write_lock’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:212:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_write_unlock’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:220:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_read_unlock’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:227:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_read_unlock_irqrestore’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:235:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_read_unlock_irq’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:243:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_read_unlock_bh’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:251:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_write_unlock_irqrestore’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:260:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_write_unlock_irq’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:268:2: error: ‘_RET_IP_’ undeclared (first use in this function)
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h: In function ‘__raw_write_unlock_bh’:
/home/jimc/projects/lx/linux-2.6/include/linux/rwlock_api_smp.h:276:2: error: ‘_RET_IP_’ undeclared (first use in this function)
In file included from /home/jimc/projects/lx/linux-2.6/include/linux/jump_label.h:51:0,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/dynamic_debug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/kernel.h:23,
                 from /home/jimc/projects/lx/linux-2.6/include/asm-generic/bug.h:13,
                 from /home/jimc/projects/lx/linux-2.6/arch/x86/include/asm/bug.h:38,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/bug.h:4,
                 from /home/jimc/projects/lx/linux-2.6/include/linux/page-flags.h:9,
                 from /home/jimc/projects/lx/linux-2.6/kernel/bounds.c:9:
/home/jimc/projects/lx/linux-2.6/include/linux/workqueue.h: In function ‘to_delayed_work’:
/home/jimc/projects/lx/linux-2.6/include/linux/workqueue.h:99:2: error: implicit declaration of function ‘container_of’ [-Werror=implicit-function-declaration]
/home/jimc/projects/lx/linux-2.6/include/linux/workqueue.h:99:28: error: expected expression before ‘struct’
cc1: some warnings being treated as errors
make[3]: *** [kernel/bounds.s] Error 1
make[2]: *** [prepare0] Error 2
make[1]: *** [sub-make] Error 2
make: *** [all] Error 2

bisect-skip: this breaks compile

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
dyndbg: take dynamic_debug.h out of kernel.h

Remove the cause of the include loop, result breaks differently.
Next patch fixes them all, the brute-force way.  Theres probably
a more elegant way, but its not obvious ATM.

skip-bisect: lots of compile errs, missing pr_debug, *dev_dbg

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
dyndbg: insert include linux/dynamic_debug.h everywhere its now needed

Previous patch dropped include from kernel.h, and broke compile
on many files.  This patch (by script below) inserts the include
everywhere either pr_debug, dev_dbg, or netdev_dbg are used.

use Getopt::Std;
use Data::Dump;

getopts("prch", \my %opt) or die <<EOH;
    -p	: prep-lists
    -r	: reduce-lists (needs product of -p)
    -c  : patch the *.c files (needs -pr)
    -h  : patch the *.h files (needs -pr)
EOH

my $ulistc	= "../dbg-caller-list-c";
my $ulisth	= "../dbg-caller-list-h";
my $ilist	= "../dbg-inc-list";
my $patchlistc	= "../dbg-patch-list";
my $patchlisth	= "../dbg-patch-list-incs";

sub prep_lists {
    # find callers in code, ./include and others separately.
    # this treats arch/*/include* as C files, so far thats ok

    # use grep -rl to build lists of files - it does recursive search
    # without fuss, and grep's DFA faster than perl's NFA

    qx{grep -lrP 'pr_debug|dev_dbg' . |grep -P '\\.[ch]\$' > $ulistc };
    qx{grep -lrP 'pr_debug|dev_dbg' . |grep -P '\\.h\$' > $ulisth };

    # find code already including header
    qx{grep -rl 'include <linux/dynamic_debug.h>' . > $ilist };
}

sub reduce_list {
    # exclude files already including header from to-be-modified list
    # this helps with incremental work, and guards inadequacies in insertion
    # both lists have entries starting with "./"

    my (%c,%h);
    open U, $ulistc or die "ulistc: $!\n";
    my @ulistc = <U>;
    chomp @ulistc;
    $c{$_}++ for @ulistc;
    close U;

    open U, $ulisth or die "ulisth: $!\n";
    my @ulisth = <U>;
    chomp @ulisth;
    $h{$_}++ for @ulisth;
    close U;

    open I, $ilist or die "$ilist: $!\n";
    my @ilist = <I>;
    chomp @ilist;
    delete $c{$_} for @ilist; # eliminate C-files already including header
    close I;

    delete $h{$_} for @ilist; # eliminate h-files already including header

    delete $h{"./include/linux/printk.h"};

    # save reduced list, avoiding git repo, tools/* (its user-space),
    # and include-dir (handled separately)

    open my $oh, ">", $patchlistc;
    print $oh "$_\n"
	for grep {!m{^\./(include|.git|tools)/}} sort keys %c;
    close $oh;

    # save ./include/* files separately just to be safe
    open my $oh, ">", $patchlisth;
    print $oh "$_\n"
	for grep {m{^\./include/}} sort keys %h;
    close $oh;
}

sub header_users {
    # check for where includes using dbg are included
    # UNUSED - keep for now

    open my $ih, $patchlisth or die "$patchlisth: $!\n";
    my @incs = grep s|./include/||, <$ih>;
    chomp @incs;
    dd \@incs;
    my $rexstr = '\Q' . join('\E|\Q', @incs) . '\E';
    my $rex = qr/#include <$rexstr>/;
    for my $src (@ARGV) {
	# qx{ grep -P $rex $src };

	print "look at: $src\n";
	open my $sh, $src or die;
	print grep /$rex/, <$sh>;
    }
}

sub do_changes {
    # insert include-lines into files named to-be-modified list
    my $listfile = shift;

    my $s1 = 's|^(#include.+)$|$1\n#include <linux/dynamic_debug.h>\n|m';

    open L, $listfile or die "$!: $listfile\n";
    my @files = <L>;
    chomp @files;
    local $/ = undef;
    for my $f (@files) {
	open my $sf, "$f" or die;
	my ($buf) = <$sf>;

	$buf =~ s{(^\#include.+?\n)}
		 {\1#include <linux/dynamic_debug.h>\n}ms

	    && "patched after 1st include\n"
	    or

	$buf =~ s{(^\#define.+?\n\n)\n?}
		 {\1#include <linux/dynamic_debug.h>\n\n}ms

	    && "patched after 1st define\n"
	    or

	# find end of a comment with blank line, insert after
	$buf =~ s{(\*/\n\n)}
		 {\1#include <linux/dynamic_debug.h>\n\n}ms

	    && "patched after 1st comment\n"

	    or
	    print "no patch on $f\n" and next;

	open my $sf, ">", "$f" or die;
	print $sf $buf;
    }
}

prep_lists()	if $opt{p};
reduce_list()	if $opt{r};

do_changes($patchlistc)		if $opt{c};
do_changes($patchlisth)		if $opt{h};

__END__

=head1 Dev Notes

Doing ./include separately cuz may want to try to put includes in
headers to satisfy needs of C files.  OTOH thats harder, and somewhat
counter to preference for explicit dependencies.  So punt on that for
now, but keep the separation cuz its cheap.

Insertion of include statement is done into whole buffer rather than
line-by-line so that regexs can find multi-line pattern w/o fussing
with state tracking otherwise needed.
dyndbg: fixup pr_fmt b4 include dyndbg

Script used for previous commit inserted #include <linux/dynamic_debug.h>
above the pr_fmt definition, causing compile warnings.  This fixes it.
dyndbg-jump: use jumplabel where its available

Now that jump-label.h in dynamic-debug.h include loop is "fixed", use
static-key (ie jumplabels) to optimize dynamic-debug.

update_jump() is called by ddebug_change() when _DPRINTK_FLAGS_PRINT
flag is changed, or from ddebug_add_module() if that flag was enabled
at compile time.

Make the static_key field and its initializer conditional on
HAVE_JUMP_LABEL, and avoid the storage when it provides no advantage.