aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-02-01 14:03:16 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-02-01 14:03:16 -0500
commit5cb480f6b488128140c940abff3c36f524a334a8 (patch)
tree6d7459e0cf73907eae24c08412305fe636693bf0 /scripts
parent1bda2ac071cdfad217856126859bc0dc88ee6f83 (diff)
parentc5e318f67eebbad491615a752c51dbfde7dc3d78 (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.cocci109
-rw-r--r--scripts/package/builddeb25
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
9virtual patch
10virtual context
11virtual org
12virtual report
13
14//----------------------------------------------------------
15// Detection
16//----------------------------------------------------------
17
18@runtime_bad_err_handle exists@
19expression ret;
20@@
21(
22ret = \(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...
42IS_ERR_VALUE(ret)
43...
44)
45
46//----------------------------------------------------------
47// For context mode
48//----------------------------------------------------------
49
50@depends on runtime_bad_err_handle && context@
51identifier pm_runtime_api;
52expression ret;
53@@
54(
55ret = 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@
66identifier pm_runtime_api;
67expression ret;
68@@
69(
70ret = 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@
82position p1, p2;
83identifier pm_runtime_api;
84expression ret;
85@@
86(
87ret = pm_runtime_api@p1(...);
88...
89IS_ERR_VALUE@p2(ret)
90...
91)
92
93@script:python depends on org@
94p1 << r.p1;
95p2 << r.p2;
96pm_runtime_api << r.pm_runtime_api;
97@@
98
99cocci.print_main(pm_runtime_api,p1)
100cocci.print_secs("IS_ERR_VALUE",p2)
101
102@script:python depends on report@
103p1 << r.p1;
104p2 << r.p2;
105pm_runtime_api << r.pm_runtime_api;
106@@
107
108msg = "%s returns < 0 as error. Unecessary IS_ERR_VALUE at line %s" % (pm_runtime_api, p2[0].line)
109coccilib.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.
176debhookdir=${KDEB_HOOKDIR:-/etc/kernel} 178debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
179if grep -q '^CONFIG_BLK_DEV_INITRD=y' $KCONFIG_CONFIG; then
180 want_initrd=Yes
181else
182 want_initrd=No
183fi
177for script in postinst postrm preinst prerm ; do 184for 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
185export DEB_MAINT_PARAMS="\$*" 192export DEB_MAINT_PARAMS="\$*"
186 193
194# Tell initramfs builder whether it's wanted
195export INITRD=$want_initrd
196
187test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d 197test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d
188exit 0 198exit 0
189EOF 199EOF
@@ -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
289ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build" 299ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
290rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" 300rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
291arch=$(dpkg --print-architecture)
292 301
293cat <<EOF >> debian/control 302cat <<EOF >> debian/control
294 303
295Package: $kernel_headers_packagename 304Package: $kernel_headers_packagename
296Provides: linux-headers, linux-headers-2.6 305Provides: linux-headers, linux-headers-2.6
297Architecture: $arch 306Architecture: any
298Description: Linux kernel headers for $KERNELRELEASE on $arch 307Description: 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
302EOF 311EOF