aboutsummaryrefslogtreecommitdiff
path: root/scripts
AgeCommit message (Collapse)Author
2009-01-06checkpatch: version: 0.26Andy Whitcroft
Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06checkpatch: fix the perlcritic errorsAndy Whitcroft
Clean up checkpatch using perlcritic. Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06checkpatch: struct file_operations should normally be constAndy Whitcroft
In the general use case struct file_operations should be a const object. Check for and warn where it is not. As suggested by Steven and Ingo. Acked-by: Steven Rostedt <rostedt@goodmis.org> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06checkpatch: ensure we actually detect if assignments split across linesAndy Whitcroft
When checking for assignments within if conditionals we check the whole of the condition, but the match is performed using a line constrained regular expression. This means we can miss split conditionals or those on the second line. Allow the check to span lines. Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06checkpatch: do not report nr_static as a static declarationAndy Whitcroft
Ensure we do not report identifiers containing the word static as static declarations. For example this should not be reported as an unecessary assignement of 0: long nr_static = 0; Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06checkpatch: track #ifdef/#else/#endif when tracking blocksAndy Whitcroft
When picking up a complete statement or block for analysis we cannot simply track open/close/etc parenthesis we must take into account preprocessor section boundaries. Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06checkpatch: fix continuation detection when handling spacing on operatorsAndy Whitcroft
We are miscategorising a continuation fragment following an operator which may lead to us thinking that there is a space after it when there is not. Fix this up. Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06checkpatch: loosen spacing on typedef function checksAndy Whitcroft
Loosen spacing checks to correctly detect this valid use of a typedef: typedef struct rcu_data *(*get_data_func)(int); Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06checkpatch: try to catch missing VMLINUX_SYMBOL() in vmlinux.lds.hMike Frysinger
Seems like every other release we have someone who updates vmlinux.lds.h and adds C-visible symbols without VMLINUX_SYMBOL() around them. So start checking the file and reject assignments which have plain symbols on either side. [apw@canonical.com: soften the check, add tests] Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06checkpatch: allow parentheses on return for comparisonsAndy Whitcroft
It seems to be a common idiom to include braces on conditionals in all contexts including return. Allow this exception to the return is not a function checks. Reported by Kay Sievers. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06checkpatch: Add warning for p0-patchesWolfram Sang
Some people work internally with -p0-patches which has the danger that one forgets to convert them to -p1 before mainlining. Bitten myself and seen p0-patches in mailing lists occasionally, this patch adds a warning to checkpatch.pl in case a patch is -p0. If you really want, you can fool this check to generate false positives, this is why it just spits a warning. Making the check 100% proof is trickier than it looks, so let's start with a version which catches the cases of real use. [apw@canonical.com: update message language, handle null prefix, add tests] Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06checkpatch: update copyrightsAndy Whitcroft
Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06checkpatch: version: 0.25Andy Whitcroft
Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06checkpatch: dissallow spaces between stars in pointer typesAndy Whitcroft
Disallow spaces within multiple pointer stars (*) in both casts and definitions. Both of these would now be reported: (char * *) char * *foo; Also now consistently detects and reports the attributes within these structures making the error report itself clearer. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06checkpatch: comment ends inside strings is most likely not an open commentAndy Whitcroft
When we are detecting whether a comment is open when we start a hunk we check for the first comment edge in the hunk and assume its inverse. However if the hunk contains something like below, then we will assume that a comment was open. Update this heuristic to see if the comment edge is obviously within double quotes and ignore it if so: foo(" */); Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06checkpatch: detect multiple bitfield declarationsAndy Whitcroft
Detect the colons (:) which make up secondary bitfield declarations and apply binary colon checks. For example the following is common idiom: int foo:1, bar:1; Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06checkpatch: __weak is an official attributeAndy Whitcroft
Add __weak as an official attribute. This tends to be used in a location where the automated attribute detector misses it. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06checkpatch: structure member assignments are not complexAndy Whitcroft
Ensure we do not trigger the complex macros checks on structure member assignment, for example: #define foo .bar = 10 Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06checkpatch: widen implied comment detection to allow multiple starsAndy Whitcroft
Some people use double star '**' as a comment continuation, and start comments with complete lines of stars. Widen the implied comment detection to pick these up. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06checkpatch: comment detection may miss an implied comment on the last hunkAndy Whitcroft
When detecting implied comments from leading stars we may incorrectly think we have detected an edge one way or the other when we have not if we drop off the end of the last hunk. Fix this up. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06checkpatch: add checks for in_atomic()Andy Whitcroft
in_atomic() is not for driver use so report any such use as an ERROR. Also in_atomic() is often used to determine if we may sleep, but it is not reliable in this use model therefore strongly discourage its use. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06scripts: script from kerneloops.org to pretty print oops dumpsArjan van de Ven
We're struggling all the time to figure out where the code came from that oopsed.. The script below (a adaption from a script used by kerneloops.org) can help developers quite a bit, at least for non-module cases. It works and looks like this: [/home/arjan/linux]$ dmesg | perl scripts/markup_oops.pl vmlinux { struct agp_memory *memory; memory = agp_allocate_memory(agp_bridge, pg_count, type); c055c10f: 89 c2 mov %eax,%edx if (memory == NULL) c055c111: 74 19 je c055c12c <agp_allocate_memory_wrap+0x30> /* This function must only be called when current_controller != NULL */ static void agp_insert_into_pool(struct agp_memory * temp) { struct agp_memory *prev; prev = agp_fe.current_controller->pool; c055c113: a1 ec dc 8f c0 mov 0xc08fdcec,%eax *c055c118: 8b 40 10 mov 0x10(%eax),%eax <----- faulting instruction if (prev != NULL) { c055c11b: 85 c0 test %eax,%eax c055c11d: 74 05 je c055c124 <agp_allocate_memory_wrap+0x28> prev->prev = temp; c055c11f: 89 50 04 mov %edx,0x4(%eax) temp->next = prev; c055c122: 89 02 mov %eax,(%edx) } agp_fe.current_controller->pool = temp; c055c124: a1 ec dc 8f c0 mov 0xc08fdcec,%eax c055c129: 89 50 10 mov %edx,0x10(%eax) if (memory == NULL) return NULL; agp_insert_into_pool(memory); so in this case, we faulted while dereferencing agp_fe.current_controller pointer, and we get to see exactly which function and line it affects... Personally I find this very useful, and I can see value for having this script in the kernel for more-than-just-me to use. Caveats: * It only works for oopses not-in-modules * It only works nicely for kernels compiled with CONFIG_DEBUG_INFO * It's not very fast. * It only works on x86 Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-02kbuild: ignore a few files in headers_checkSam Ravnborg
The new check for asm/types.h and linux/types.h had a few false positives. o We cannot let linux/types.h include linux/types.h o The int-ll64.h and int-ll64.h define the types and are included by linux/types.h Handle this by hardcoding the filenames in the headers_check script. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-01-02kbuild: add checks for include of linux/types in userspace headersSam Ravnborg
If we see __[us](8|16|32|64) then we must include <linux/types.h> If wee see include of <asm/types.h> then we recommend <linux/types.h> Original script from Mike but modified by me. Cc: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-01-02kbuild: drop debugging leftover in tags.shSam Ravnborg
Noticed by Jike. Reported-by: "Jike Song" <albcamus@gmail.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-01-02kbuild: in headers_install autoconvert asm/inline/volatile to __xxx__Mike Frysinger
Headers in userspace should be using the __xxx__ form of the asm, inline, and volatile keywords. Since people like to revert these things without realizing what's going on, have the headers install step autoconvert these keywords. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-01-02kbuild: check for leaked CONFIG_ symbols to userspaceSam Ravnborg
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-01-02headers_check.pl: disallow extern'sMike Frysinger
Since prototypes with "extern" refer to kernel functions, they make no sense in userspace, so reject them automatically. Signed-off-by: Mike Frysinger <vapier@gentoo.org> [sam: made it into a warning] Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-01-02kconfig: improve error messages for bad source statementsSam Ravnborg
We now say where we detect the second source of a file, and where we detect a recursively source of the same file. This makes it easier to fix such errors. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Roman Zippel <zippel@linux-m68k.org>
2009-01-02kconfig: struct property commentedSam Ravnborg
No functional changes Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-01-02kconfig: add comments to symbol flagsSam Ravnborg
No functional changes - only comments. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-01-02kconfig: explain symbol value defaultsSam Ravnborg
Added a few comments - no functional change. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-12-28Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-nextLinus Torvalds
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next: (25 commits) allow stripping of generated symbols under CONFIG_KALLSYMS_ALL kbuild: strip generated symbols from *.ko kbuild: simplify use of genksyms kernel-doc: check for extra kernel-doc notations kbuild: add headerdep used to detect inclusion cycles in header files kbuild: fix string equality testing in tags.sh kbuild: fix make tags/cscope kbuild: fix make incompatibility kbuild: remove TAR_IGNORE setlocalversion: add git-svn support setlocalversion: print correct subversion revision scripts: improve the decodecode script scripts/package: allow custom options to rpm genksyms: allow to ignore symbol checksum changes genksyms: track symbol checksum changes tags and cscope support really belongs in a shell script kconfig: fix options to check-lxdialog.sh kbuild: gen_init_cpio expands shell variables in file names remove bashisms from scripts/extract-ikconfig kbuild: teach mkmakfile to be silent ...
2008-12-19allow stripping of generated symbols under CONFIG_KALLSYMS_ALLJan Beulich
Building upon parts of the module stripping patch, this patch introduces similar stripping for vmlinux when CONFIG_KALLSYMS_ALL=y. Using CONFIG_KALLSYMS_STRIP_GENERATED reduces the overhead of CONFIG_KALLSYMS_ALL from 245k/310k to 65k/80k for the (i386/x86-64) kernels I tested with. The patch also does away with the need to special case the kallsyms- internal symbols by making them available even in the first linking stage. While it is a generated file, the patch includes the changes to scripts/genksyms/keywords.c_shipped, as I'm unsure what the procedure here is. Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-12-19kbuild: strip generated symbols from *.koJan Beulich
This patch changes the way __crc_ symbols are being resolved from using ld to do so to using the assembler, thus allowing these symbols to be marked local (the linker creates then as global ones) and hence allow stripping (for modules) or ignoring (for vmlinux) them. While at this, also strip other generated symbols during module installation. One potentially debatable point is the handling of the flags passeed to gcc when translating the intermediate assembly file into an object: passing $(c_flags) unchanged doesn't work as gcc passes --gdwarf2 to gas whenever is sees any -g* option, even for -g0, and despite the fact that the compiler would have already produced all necessary debug info in the C->assembly translation phase. I took the approach of just filtering out all -g* options, but an alternative to such negative filtering might be to have a positive filter which might, in the ideal case allow just all the -Wa,* options to pass through. Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-12-19kbuild: simplify use of genksymsSam Ravnborg
Avoid duplicating long list of options in two places Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-12-19kernel-doc: check for extra kernel-doc notationsRandy Dunlap
Add functionality to check for function parameters or structure (or union/typedef/enum) field members that are described in kernel-doc but are not part of the expected (declared) parameters or structure. These generate warnings that are called "Excess" descriptions. Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-12-18kbuild: add headerdep used to detect inclusion cycles in header filesVegard Nossum
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-12-14kbuild: fix string equality testing in tags.shJiri Slaby
Test of string equality in shells is =, not C-like ==. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-12-14kbuild: fix make tags/cscopeJiri Slaby
- fix combining O=... and tags - don't allow * expansion during sh function calls Signed-off-by: Jiri Slaby <jirislaby@gmail.com> [sam: use KBUILD_SRC to check if we use O=...] Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-12-12tracing/function-graph-tracer: add a new .irqentry.text sectionFrederic Weisbecker
Impact: let the function-graph-tracer be aware of the irq entrypoints Add a new .irqentry.text section to store the irq entrypoints functions inside the same section. This way, the tracer will be able to signal an interrupts triggering on output by recognizing these entrypoints. Also, make this section recordable for dynamic tracing. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-12-05kbuild: remove TAR_IGNORERobert P. J. Day
Given that there is no usage of a TAR_IGNORE variable remove it Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-12-04Merge commit 'v2.6.28-rc7' into tracing/coreIngo Molnar
2008-12-03setlocalversion: add git-svn supportPeter Korsgaard
Print svn revision in addition to git info on git-svn repos. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-12-03setlocalversion: print correct subversion revisionPeter Korsgaard
Output svn revision of latest change, instead of repo revision as thats what we're interested in (especially when working on a branch/tag). Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-12-03scripts: improve the decodecode scriptArjan van de Ven
kerneloops.org has been using an improved "decodecode" script, specifically it has a special marker that shows which line in the assembly the oops happened at, like this: 20: 83 e0 03 and $0x3,%eax 23: 09 d8 or %ebx,%eax 25: 85 db test %ebx,%ebx 27: 89 02 mov %eax,(%edx) 29: 74 0f je 0x3a 2b:* 3b 73 04 cmp 0x4(%ebx),%esi <-- trapping instruction 2e: 75 05 jne 0x35 30: 89 53 04 mov %edx,0x4(%ebx) 33: eb 07 jmp 0x3c 35: 89 53 08 mov %edx,0x8(%ebx) this patch updates the kernel copy to also have this functionality. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Reviewed-by: WANG Cong <wangcong@zeuux.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-12-03scripts/package: allow custom options to rpmJeremy Kerr
Add a RPMOPTS make variable to allow arbitrary options to be passed to rpm during 'make rpm-pkg'. For example: make RPMOPTS="--define '_topdir /home/jk/rpm'" rpm-pkg Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-12-03genksyms: allow to ignore symbol checksum changesAndreas Gruenbacher
This adds an "override" keyword for use in *.symvers / *.symref files. When a symbol is overridden, the symbol's old definition will be used for computing checksums instead of the new one, preserving the previous checksum. (Genksyms will still warn about the change.) This is meant to allow distributions to hide minor actual as well as fake ABI changes. (For example, when extra type information becomes available because additional headers are included, this may change checksums even though none of the types used have actully changed.) This approach also allows to get rid of "#ifdef __GENKSYMS__" hacks in the code, which are currently used in some vendor kernels to work around checksum changes. Signed-off-by: Andreas Gruenbacher <agruen@suse.de> Cc: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-12-03genksyms: track symbol checksum changesAndreas Gruenbacher
Sometimes it is preferable to avoid changes of exported symbol checksums (to avoid breaking externally provided modules). When a checksum change occurs, it can be hard to figure out what caused this change: underlying types may have changed, or additional type information may simply have become available at the point where a symbol is exported. Add a new --reference option to genksyms which allows it to report why checksums change, based on the type information dumps it creates with the --dump-types flag. Genksyms will read in such a dump from a previous run, and report which symbols have changed (and why). The behavior can be controlled for an entire build as follows: If KBUILD_SYMTYPES is set, genksyms uses --dump-types to produce *.symtypes dump files. If any *.symref files exist, those will be used as the reference to check against. If KBUILD_PRESERVE is set, checksum changes will fail the build. Signed-off-by: Andreas Gruenbacher <agruen@suse.de> Cc: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-12-03tags and cscope support really belongs in a shell scriptSam Ravnborg
as they do not benefit from the make functionality. Moving the support to a shell script has several benefits: - The readability of the code has increased a lot - More people is able to extend the tags support - We see less changes to the top-level Makefile The shell script version includes improvements from: Alexey Dobriyan <adobriyan@gmail.com> (jump to kconfig symbols) Alexey Dobriyan <adobriyan@gmail.com> (drop ./ in paths) Ian Campbell <ijc@hellion.org.uk> (simplified find algorithms) This version has a few caveats: => It does not support ALLSOURCE_ARCHS - it is easy to add if it is really used => It assumes all archs have moved to arch/$ARCH/include - until that happens we have a few additional hits in the archs Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Alexey Dobriyan <adobriyan@gmail.com> Tested-by: Ian Campbell <ijc@hellion.org.uk>