Commit f6774cbcad7aa21ac0d4fc92a5e4deae901f6534

Authored by Linus Torvalds

Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild

Pull misc kbuild changes from Michal Marek:
 "This is the non-critical part of kbuild for v3.6-rc1:

   - Two new coccinelle semantic patches
   - New scripts/tags.sh regexp
   - scripts/config improvements that I mistakenly applied here instead
     of in the kconfig branch (but there are no conflicts)
   - Debian packaging fixes"

* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
  scripts/tags.sh: Teach [ce]tags about libtraceeevent error codes
  scripts/coccinelle: list iterator variable semantic patch
  scripts/coccinelle: Find threaded IRQs requests which are missing IRQF_ONESHOT
  deb-pkg: Add all Makefiles to header package
  deb-pkg: Install linux-firmware-image in versioned dir
  scripts/config: add option to undef a symbol
  scripts/config: allow alternate prefix to config option symbol
  scripts/config: add option to not upper-case symbols

Showing 5 changed files Side-by-side Diff

scripts/coccinelle/iterators/use_after_iter.cocci
  1 +/// If list_for_each_entry, etc complete a traversal of the list, the iterator
  2 +/// variable ends up pointing to an address at an offset from the list head,
  3 +/// and not a meaningful structure. Thus this value should not be used after
  4 +/// the end of the iterator.
  5 +//#False positives arise when there is a goto in the iterator and the
  6 +//#reported reference is at the label of this goto. Some flag tests
  7 +//#may also cause a report to be a false positive.
  8 +///
  9 +// Confidence: Moderate
  10 +// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
  11 +// Copyright: (C) 2012 Gilles Muller, INRIA/LIP6. GPLv2.
  12 +// URL: http://coccinelle.lip6.fr/
  13 +// Comments:
  14 +// Options: -no_includes -include_headers
  15 +
  16 +virtual context
  17 +virtual org
  18 +virtual report
  19 +
  20 +@r exists@
  21 +identifier c,member;
  22 +expression E,x;
  23 +iterator name list_for_each_entry;
  24 +iterator name list_for_each_entry_reverse;
  25 +iterator name list_for_each_entry_continue;
  26 +iterator name list_for_each_entry_continue_reverse;
  27 +iterator name list_for_each_entry_from;
  28 +iterator name list_for_each_entry_safe;
  29 +iterator name list_for_each_entry_safe_continue;
  30 +iterator name list_for_each_entry_safe_from;
  31 +iterator name list_for_each_entry_safe_reverse;
  32 +iterator name hlist_for_each_entry;
  33 +iterator name hlist_for_each_entry_continue;
  34 +iterator name hlist_for_each_entry_from;
  35 +iterator name hlist_for_each_entry_safe;
  36 +statement S;
  37 +position p1,p2;
  38 +@@
  39 +
  40 +(
  41 +list_for_each_entry@p1(c,...,member) { ... when != break;
  42 + when forall
  43 + when strict
  44 +}
  45 +|
  46 +list_for_each_entry_reverse@p1(c,...,member) { ... when != break;
  47 + when forall
  48 + when strict
  49 +}
  50 +|
  51 +list_for_each_entry_continue@p1(c,...,member) { ... when != break;
  52 + when forall
  53 + when strict
  54 +}
  55 +|
  56 +list_for_each_entry_continue_reverse@p1(c,...,member) { ... when != break;
  57 + when forall
  58 + when strict
  59 +}
  60 +|
  61 +list_for_each_entry_from@p1(c,...,member) { ... when != break;
  62 + when forall
  63 + when strict
  64 +}
  65 +|
  66 +list_for_each_entry_safe@p1(c,...,member) { ... when != break;
  67 + when forall
  68 + when strict
  69 +}
  70 +|
  71 +list_for_each_entry_safe_continue@p1(c,...,member) { ... when != break;
  72 + when forall
  73 + when strict
  74 +}
  75 +|
  76 +list_for_each_entry_safe_from@p1(c,...,member) { ... when != break;
  77 + when forall
  78 + when strict
  79 +}
  80 +|
  81 +list_for_each_entry_safe_reverse@p1(c,...,member) { ... when != break;
  82 + when forall
  83 + when strict
  84 +}
  85 +)
  86 +...
  87 +(
  88 +list_for_each_entry(c,...) S
  89 +|
  90 +list_for_each_entry_reverse(c,...) S
  91 +|
  92 +list_for_each_entry_continue(c,...) S
  93 +|
  94 +list_for_each_entry_continue_reverse(c,...) S
  95 +|
  96 +list_for_each_entry_from(c,...) S
  97 +|
  98 +list_for_each_entry_safe(c,...) S
  99 +|
  100 +list_for_each_entry_safe(x,c,...) S
  101 +|
  102 +list_for_each_entry_safe_continue(c,...) S
  103 +|
  104 +list_for_each_entry_safe_continue(x,c,...) S
  105 +|
  106 +list_for_each_entry_safe_from(c,...) S
  107 +|
  108 +list_for_each_entry_safe_from(x,c,...) S
  109 +|
  110 +list_for_each_entry_safe_reverse(c,...) S
  111 +|
  112 +list_for_each_entry_safe_reverse(x,c,...) S
  113 +|
  114 +hlist_for_each_entry(c,...) S
  115 +|
  116 +hlist_for_each_entry_continue(c,...) S
  117 +|
  118 +hlist_for_each_entry_from(c,...) S
  119 +|
  120 +hlist_for_each_entry_safe(c,...) S
  121 +|
  122 +list_remove_head(x,c,...)
  123 +|
  124 +sizeof(<+...c...+>)
  125 +|
  126 +&c->member
  127 +|
  128 +c = E
  129 +|
  130 +*c@p2
  131 +)
  132 +
  133 +@script:python depends on org@
  134 +p1 << r.p1;
  135 +p2 << r.p2;
  136 +@@
  137 +
  138 +cocci.print_main("invalid iterator index reference",p2)
  139 +cocci.print_secs("iterator",p1)
  140 +
  141 +@script:python depends on report@
  142 +p1 << r.p1;
  143 +p2 << r.p2;
  144 +@@
  145 +
  146 +msg = "ERROR: invalid reference to the index variable of the iterator on line %s" % (p1[0].line)
  147 +coccilib.report.print_report(p2[0], msg)
scripts/coccinelle/misc/irqf_oneshot.cocci
  1 +/// Make sure threaded IRQs without a primary handler are always request with
  2 +/// IRQF_ONESHOT
  3 +///
  4 +//
  5 +// Confidence: Good
  6 +// Comments:
  7 +// Options: --no-includes
  8 +
  9 +virtual patch
  10 +virtual context
  11 +virtual org
  12 +virtual report
  13 +
  14 +@r1@
  15 +expression irq;
  16 +expression thread_fn;
  17 +expression flags;
  18 +position p;
  19 +@@
  20 +request_threaded_irq@p(irq, NULL, thread_fn,
  21 +(
  22 +flags | IRQF_ONESHOT
  23 +|
  24 +IRQF_ONESHOT
  25 +)
  26 +, ...)
  27 +
  28 +@depends on patch@
  29 +expression irq;
  30 +expression thread_fn;
  31 +expression flags;
  32 +position p != r1.p;
  33 +@@
  34 +request_threaded_irq@p(irq, NULL, thread_fn,
  35 +(
  36 +-0
  37 ++IRQF_ONESHOT
  38 +|
  39 +-flags
  40 ++flags | IRQF_ONESHOT
  41 +)
  42 +, ...)
  43 +
  44 +@depends on context@
  45 +position p != r1.p;
  46 +@@
  47 +*request_threaded_irq@p(...)
  48 +
  49 +@match depends on report || org@
  50 +expression irq;
  51 +position p != r1.p;
  52 +@@
  53 +request_threaded_irq@p(irq, NULL, ...)
  54 +
  55 +@script:python depends on org@
  56 +p << match.p;
  57 +@@
  58 +msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT"
  59 +coccilib.org.print_todo(p[0],msg)
  60 +
  61 +@script:python depends on report@
  62 +p << match.p;
  63 +@@
  64 +msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT"
  65 +coccilib.report.print_report(p[0],msg)
1 1 #!/bin/bash
2 2 # Manipulate options in a .config file from the command line
3 3  
  4 +# If no prefix forced, use the default CONFIG_
  5 +CONFIG_="${CONFIG_-CONFIG_}"
  6 +
4 7 usage() {
5 8 cat >&2 <<EOL
6 9 Manipulate options in a .config file from the command line.
... ... @@ -14,6 +17,7 @@
14 17 Set option to "string"
15 18 --set-val option value
16 19 Set option to value
  20 + --undefine|-u option Undefine option
17 21 --state|-s option Print state of option (n,y,m,undef)
18 22  
19 23 --enable-after|-E beforeopt option
20 24  
... ... @@ -26,10 +30,17 @@
26 30 commands can be repeated multiple times
27 31  
28 32 options:
29   - --file .config file to change (default .config)
  33 + --file config-file .config file to change (default .config)
  34 + --keep-case|-k Keep next symbols' case (dont' upper-case it)
30 35  
31 36 config doesn't check the validity of the .config file. This is done at next
32   - make time.
  37 +make time.
  38 +
  39 +By default, config will upper-case the given symbol. Use --keep-case to keep
  40 +the case of all following symbols unchanged.
  41 +
  42 +config uses 'CONFIG_' as the default symbol prefix. Set the environment
  43 +variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" config ...
33 44 EOL
34 45 exit 1
35 46 }
36 47  
... ... @@ -40,11 +51,13 @@
40 51 usage
41 52 fi
42 53 case "$ARG" in
43   - CONFIG_*)
44   - ARG="${ARG/CONFIG_/}"
  54 + ${CONFIG_}*)
  55 + ARG="${ARG/${CONFIG_}/}"
45 56 ;;
46 57 esac
47   - ARG="`echo $ARG | tr a-z A-Z`"
  58 + if [ "$MUNGE_CASE" = "yes" ] ; then
  59 + ARG="`echo $ARG | tr a-z A-Z`"
  60 + fi
48 61 }
49 62  
50 63 set_var() {
... ... @@ -61,6 +74,12 @@
61 74 fi
62 75 }
63 76  
  77 +undef_var() {
  78 + local name=$1
  79 +
  80 + sed -ri "/^($name=|# $name is not set)/d" "$FN"
  81 +}
  82 +
64 83 if [ "$1" = "--file" ]; then
65 84 FN="$2"
66 85 if [ "$FN" = "" ] ; then
67 86  
... ... @@ -75,10 +94,16 @@
75 94 usage
76 95 fi
77 96  
  97 +MUNGE_CASE=yes
78 98 while [ "$1" != "" ] ; do
79 99 CMD="$1"
80 100 shift
81 101 case "$CMD" in
  102 + --keep-case|-k)
  103 + MUNGE_CASE=no
  104 + shift
  105 + continue
  106 + ;;
82 107 --refresh)
83 108 ;;
84 109 --*-after)
85 110  
86 111  
87 112  
88 113  
89 114  
90 115  
91 116  
92 117  
... ... @@ -95,37 +120,40 @@
95 120 esac
96 121 case "$CMD" in
97 122 --enable|-e)
98   - set_var "CONFIG_$ARG" "CONFIG_$ARG=y"
  123 + set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=y"
99 124 ;;
100 125  
101 126 --disable|-d)
102   - set_var "CONFIG_$ARG" "# CONFIG_$ARG is not set"
  127 + set_var "${CONFIG_}$ARG" "# ${CONFIG_}$ARG is not set"
103 128 ;;
104 129  
105 130 --module|-m)
106   - set_var "CONFIG_$ARG" "CONFIG_$ARG=m"
  131 + set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=m"
107 132 ;;
108 133  
109 134 --set-str)
110 135 # sed swallows one level of escaping, so we need double-escaping
111   - set_var "CONFIG_$ARG" "CONFIG_$ARG=\"${1//\"/\\\"}\""
  136 + set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=\"${1//\"/\\\"}\""
112 137 shift
113 138 ;;
114 139  
115 140 --set-val)
116   - set_var "CONFIG_$ARG" "CONFIG_$ARG=$1"
  141 + set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=$1"
117 142 shift
118 143 ;;
  144 + --undefine|-u)
  145 + undef_var "${CONFIG_}$ARG"
  146 + ;;
119 147  
120 148 --state|-s)
121   - if grep -q "# CONFIG_$ARG is not set" $FN ; then
  149 + if grep -q "# ${CONFIG_}$ARG is not set" $FN ; then
122 150 echo n
123 151 else
124   - V="$(grep "^CONFIG_$ARG=" $FN)"
  152 + V="$(grep "^${CONFIG_}$ARG=" $FN)"
125 153 if [ $? != 0 ] ; then
126 154 echo undef
127 155 else
128   - V="${V/#CONFIG_$ARG=/}"
  156 + V="${V/#${CONFIG_}$ARG=/}"
129 157 V="${V/#\"/}"
130 158 V="${V/%\"/}"
131 159 V="${V//\\\"/\"}"
132 160  
133 161  
... ... @@ -135,15 +163,15 @@
135 163 ;;
136 164  
137 165 --enable-after|-E)
138   - set_var "CONFIG_$B" "CONFIG_$B=y" "CONFIG_$A"
  166 + set_var "${CONFIG_}$B" "${CONFIG_}$B=y" "${CONFIG_}$A"
139 167 ;;
140 168  
141 169 --disable-after|-D)
142   - set_var "CONFIG_$B" "# CONFIG_$B is not set" "CONFIG_$A"
  170 + set_var "${CONFIG_}$B" "# ${CONFIG_}$B is not set" "${CONFIG_}$A"
143 171 ;;
144 172  
145 173 --module-after|-M)
146   - set_var "CONFIG_$B" "CONFIG_$B=m" "CONFIG_$A"
  174 + set_var "${CONFIG_}$B" "${CONFIG_}$B=m" "${CONFIG_}$A"
147 175 ;;
148 176  
149 177 # undocumented because it ignores --file (fixme)
scripts/package/builddeb
... ... @@ -92,7 +92,7 @@
92 92 mkdir -m 755 -p "$tmpdir/DEBIAN"
93 93 mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename"
94 94 mkdir -m 755 -p "$fwdir/DEBIAN"
95   -mkdir -p "$fwdir/lib" "$fwdir/usr/share/doc/$fwpackagename"
  95 +mkdir -p "$fwdir/lib/firmware/$version/" "$fwdir/usr/share/doc/$fwpackagename"
96 96 mkdir -m 755 -p "$libc_headers_dir/DEBIAN"
97 97 mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename"
98 98 mkdir -m 755 -p "$kernel_headers_dir/DEBIAN"
... ... @@ -243,7 +243,7 @@
243 243 fi
244 244  
245 245 # Build header package
246   -(cd $srctree; find . -name Makefile -o -name Kconfig\* -o -name \*.pl > "$objtree/debian/hdrsrcfiles")
  246 +(cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl > "$objtree/debian/hdrsrcfiles")
247 247 (cd $srctree; find arch/$SRCARCH/include include scripts -type f >> "$objtree/debian/hdrsrcfiles")
248 248 (cd $objtree; find arch/$SRCARCH/include .config Module.symvers include scripts -type f >> "$objtree/debian/hdrobjfiles")
249 249 destdir=$kernel_headers_dir/usr/src/linux-headers-$version
... ... @@ -267,7 +267,8 @@
267 267  
268 268 # Do we have firmware? Move it out of the way and build it into a package.
269 269 if [ -e "$tmpdir/lib/firmware" ]; then
270   - mv "$tmpdir/lib/firmware" "$fwdir/lib/"
  270 + mv "$tmpdir/lib/firmware"/* "$fwdir/lib/firmware/$version/"
  271 + rmdir "$tmpdir/lib/firmware"
271 272  
272 273 cat <<EOF >> debian/control
273 274  
... ... @@ -153,7 +153,8 @@
153 153 --regex-c++='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \
154 154 --regex-c++='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
155 155 --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
156   - --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/'
  156 + --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \
  157 + --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/'
157 158  
158 159 all_kconfigs | xargs $1 -a \
159 160 --langdef=kconfig --language-force=kconfig \
... ... @@ -195,7 +196,8 @@
195 196 --regex='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \
196 197 --regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
197 198 --regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
198   - --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/'
  199 + --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \
  200 + --regex='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/'
199 201  
200 202 all_kconfigs | xargs $1 -a \
201 203 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'