diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-02-01 14:03:16 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-02-01 14:03:16 -0500 |
commit | 5cb480f6b488128140c940abff3c36f524a334a8 (patch) | |
tree | 6d7459e0cf73907eae24c08412305fe636693bf0 /scripts | |
parent | 1bda2ac071cdfad217856126859bc0dc88ee6f83 (diff) | |
parent | c5e318f67eebbad491615a752c51dbfde7dc3d78 (diff) |
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull misc kbuild changes from Michal Marek:
"The non-critical part of kbuild is small this time:
- Three fixes for make deb-pkg
- A new coccinelle check
One of the deb-pkg fixes is a leftover from the last merge window,
hence the merge commit"
* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
deb-pkg: Fix building for MIPS big-endian or ARM OABI
deb-pkg: Fix cross-building linux-headers package
scripts: Coccinelle script for pm_runtime_* return checks with IS_ERR_VALUE
deb-pkg: Inhibit initramfs builders if CONFIG_BLK_DEV_INITRD is not set
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/coccinelle/api/pm_runtime.cocci | 109 | ||||
-rw-r--r-- | scripts/package/builddeb | 25 |
2 files changed, 126 insertions, 8 deletions
diff --git a/scripts/coccinelle/api/pm_runtime.cocci b/scripts/coccinelle/api/pm_runtime.cocci new file mode 100644 index 000000000000..f01789e967ec --- /dev/null +++ b/scripts/coccinelle/api/pm_runtime.cocci | |||
@@ -0,0 +1,109 @@ | |||
1 | /// Make sure pm_runtime_* calls does not use unnecessary IS_ERR_VALUE | ||
2 | // | ||
3 | // Keywords: pm_runtime | ||
4 | // Confidence: Medium | ||
5 | // Copyright (C) 2013 Texas Instruments Incorporated - GPLv2. | ||
6 | // URL: http://coccinelle.lip6.fr/ | ||
7 | // Options: --include-headers | ||
8 | |||
9 | virtual patch | ||
10 | virtual context | ||
11 | virtual org | ||
12 | virtual report | ||
13 | |||
14 | //---------------------------------------------------------- | ||
15 | // Detection | ||
16 | //---------------------------------------------------------- | ||
17 | |||
18 | @runtime_bad_err_handle exists@ | ||
19 | expression ret; | ||
20 | @@ | ||
21 | ( | ||
22 | ret = \(pm_runtime_idle\| | ||
23 | pm_runtime_suspend\| | ||
24 | pm_runtime_autosuspend\| | ||
25 | pm_runtime_resume\| | ||
26 | pm_request_idle\| | ||
27 | pm_request_resume\| | ||
28 | pm_request_autosuspend\| | ||
29 | pm_runtime_get\| | ||
30 | pm_runtime_get_sync\| | ||
31 | pm_runtime_put\| | ||
32 | pm_runtime_put_autosuspend\| | ||
33 | pm_runtime_put_sync\| | ||
34 | pm_runtime_put_sync_suspend\| | ||
35 | pm_runtime_put_sync_autosuspend\| | ||
36 | pm_runtime_set_active\| | ||
37 | pm_schedule_suspend\| | ||
38 | pm_runtime_barrier\| | ||
39 | pm_generic_runtime_suspend\| | ||
40 | pm_generic_runtime_resume\)(...); | ||
41 | ... | ||
42 | IS_ERR_VALUE(ret) | ||
43 | ... | ||
44 | ) | ||
45 | |||
46 | //---------------------------------------------------------- | ||
47 | // For context mode | ||
48 | //---------------------------------------------------------- | ||
49 | |||
50 | @depends on runtime_bad_err_handle && context@ | ||
51 | identifier pm_runtime_api; | ||
52 | expression ret; | ||
53 | @@ | ||
54 | ( | ||
55 | ret = pm_runtime_api(...); | ||
56 | ... | ||
57 | * IS_ERR_VALUE(ret) | ||
58 | ... | ||
59 | ) | ||
60 | |||
61 | //---------------------------------------------------------- | ||
62 | // For patch mode | ||
63 | //---------------------------------------------------------- | ||
64 | |||
65 | @depends on runtime_bad_err_handle && patch@ | ||
66 | identifier pm_runtime_api; | ||
67 | expression ret; | ||
68 | @@ | ||
69 | ( | ||
70 | ret = pm_runtime_api(...); | ||
71 | ... | ||
72 | - IS_ERR_VALUE(ret) | ||
73 | + ret < 0 | ||
74 | ... | ||
75 | ) | ||
76 | |||
77 | //---------------------------------------------------------- | ||
78 | // For org and report mode | ||
79 | //---------------------------------------------------------- | ||
80 | |||
81 | @r depends on runtime_bad_err_handle exists@ | ||
82 | position p1, p2; | ||
83 | identifier pm_runtime_api; | ||
84 | expression ret; | ||
85 | @@ | ||
86 | ( | ||
87 | ret = pm_runtime_api@p1(...); | ||
88 | ... | ||
89 | IS_ERR_VALUE@p2(ret) | ||
90 | ... | ||
91 | ) | ||
92 | |||
93 | @script:python depends on org@ | ||
94 | p1 << r.p1; | ||
95 | p2 << r.p2; | ||
96 | pm_runtime_api << r.pm_runtime_api; | ||
97 | @@ | ||
98 | |||
99 | cocci.print_main(pm_runtime_api,p1) | ||
100 | cocci.print_secs("IS_ERR_VALUE",p2) | ||
101 | |||
102 | @script:python depends on report@ | ||
103 | p1 << r.p1; | ||
104 | p2 << r.p2; | ||
105 | pm_runtime_api << r.pm_runtime_api; | ||
106 | @@ | ||
107 | |||
108 | msg = "%s returns < 0 as error. Unecessary IS_ERR_VALUE at line %s" % (pm_runtime_api, p2[0].line) | ||
109 | coccilib.report.print_report(p1[0],msg) | ||
diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 90e521fde35f..f46e4dd0558d 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb | |||
@@ -41,9 +41,9 @@ create_package() { | |||
41 | parisc*) | 41 | parisc*) |
42 | debarch=hppa ;; | 42 | debarch=hppa ;; |
43 | mips*) | 43 | mips*) |
44 | debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo el) ;; | 44 | debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo el || true) ;; |
45 | arm*) | 45 | arm*) |
46 | debarch=arm$(grep -q CONFIG_AEABI=y $KCONFIG_CONFIG && echo el) ;; | 46 | debarch=arm$(grep -q CONFIG_AEABI=y $KCONFIG_CONFIG && echo el || true) ;; |
47 | *) | 47 | *) |
48 | echo "" >&2 | 48 | echo "" >&2 |
49 | echo "** ** ** WARNING ** ** **" >&2 | 49 | echo "** ** ** WARNING ** ** **" >&2 |
@@ -62,7 +62,7 @@ create_package() { | |||
62 | fi | 62 | fi |
63 | 63 | ||
64 | # Create the package | 64 | # Create the package |
65 | dpkg-gencontrol -isp $forcearch -p$pname -P"$pdir" | 65 | dpkg-gencontrol -isp $forcearch -Vkernel:debarch="${debarch:-$(dpkg --print-architecture)}" -p$pname -P"$pdir" |
66 | dpkg --build "$pdir" .. | 66 | dpkg --build "$pdir" .. |
67 | } | 67 | } |
68 | 68 | ||
@@ -172,8 +172,15 @@ fi | |||
172 | 172 | ||
173 | # Install the maintainer scripts | 173 | # Install the maintainer scripts |
174 | # Note: hook scripts under /etc/kernel are also executed by official Debian | 174 | # Note: hook scripts under /etc/kernel are also executed by official Debian |
175 | # kernel packages, as well as kernel packages built using make-kpkg | 175 | # kernel packages, as well as kernel packages built using make-kpkg. |
176 | # make-kpkg sets $INITRD to indicate whether an initramfs is wanted, and | ||
177 | # so do we; recent versions of dracut and initramfs-tools will obey this. | ||
176 | debhookdir=${KDEB_HOOKDIR:-/etc/kernel} | 178 | debhookdir=${KDEB_HOOKDIR:-/etc/kernel} |
179 | if grep -q '^CONFIG_BLK_DEV_INITRD=y' $KCONFIG_CONFIG; then | ||
180 | want_initrd=Yes | ||
181 | else | ||
182 | want_initrd=No | ||
183 | fi | ||
177 | for script in postinst postrm preinst prerm ; do | 184 | for script in postinst postrm preinst prerm ; do |
178 | mkdir -p "$tmpdir$debhookdir/$script.d" | 185 | mkdir -p "$tmpdir$debhookdir/$script.d" |
179 | cat <<EOF > "$tmpdir/DEBIAN/$script" | 186 | cat <<EOF > "$tmpdir/DEBIAN/$script" |
@@ -184,6 +191,9 @@ set -e | |||
184 | # Pass maintainer script parameters to hook scripts | 191 | # Pass maintainer script parameters to hook scripts |
185 | export DEB_MAINT_PARAMS="\$*" | 192 | export DEB_MAINT_PARAMS="\$*" |
186 | 193 | ||
194 | # Tell initramfs builder whether it's wanted | ||
195 | export INITRD=$want_initrd | ||
196 | |||
187 | test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d | 197 | test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d |
188 | exit 0 | 198 | exit 0 |
189 | EOF | 199 | EOF |
@@ -288,15 +298,14 @@ mkdir -p "$destdir" | |||
288 | (cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be | 298 | (cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be |
289 | ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build" | 299 | ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build" |
290 | rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" | 300 | rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" |
291 | arch=$(dpkg --print-architecture) | ||
292 | 301 | ||
293 | cat <<EOF >> debian/control | 302 | cat <<EOF >> debian/control |
294 | 303 | ||
295 | Package: $kernel_headers_packagename | 304 | Package: $kernel_headers_packagename |
296 | Provides: linux-headers, linux-headers-2.6 | 305 | Provides: linux-headers, linux-headers-2.6 |
297 | Architecture: $arch | 306 | Architecture: any |
298 | Description: Linux kernel headers for $KERNELRELEASE on $arch | 307 | Description: Linux kernel headers for $KERNELRELEASE on \${kernel:debarch} |
299 | This package provides kernel header files for $KERNELRELEASE on $arch | 308 | This package provides kernel header files for $KERNELRELEASE on \${kernel:debarch} |
300 | . | 309 | . |
301 | This is useful for people who need to build external modules | 310 | This is useful for people who need to build external modules |
302 | EOF | 311 | EOF |