[PATCH] mm: madvise: complete input validation before taking lock

2013-04-10 Thread Rasmus Villemoes
In madvise(), there doesn't seem to be any reason for taking the current-mm-mmap_sem before start and len_in have been validated. Incidentally, this removes the need for the out: label. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- diff --git a/mm/madvise.c b/mm/madvise.c index

Re: [PATCH] Add per-process flag to control thp

2013-08-04 Thread Rasmus Villemoes
Alex Thorlton athorl...@sgi.com writes: This patch implements functionality to allow processes to disable the use of transparent hugepages through the prctl syscall. A few comments: Is there a reason it shouldn't be possible for a process to un-disable/reenable thp? +static inline int

Re: [PATCH] socket.7: add description for SO_BUSY_POLL

2013-07-10 Thread Rasmus Villemoes
Eliezer Tamir eliezer.ta...@linux.intel.com writes: +While busy polling my improve latency of some application, care must be +taken when using it since this will increase both CPU utilization power usage. s/my/may/; missing 'and' before 'power usage'. [And should 'application' be plural?]

Re: [git pull] vfs.git part 2

2013-07-12 Thread Rasmus Villemoes
Al Viro v...@zeniv.linux.org.uk writes: On Thu, Jul 11, 2013 at 02:42:54PM -0700, Linus Torvalds wrote: But with an *old* kernel, O_TMPFILE will just silently be ignored as an unrecognized flag, and things won't work. If you do fd = open(dirname, O_CREAT | O_TMPFILE | O_RDWR, 0666); it

Re: [git pull] vfs.git part 2

2013-07-12 Thread Rasmus Villemoes
Al Viro v...@zeniv.linux.org.uk writes: On Fri, Jul 12, 2013 at 12:02:45PM +, Rasmus Villemoes wrote: But isn't the problem the case where dirname does not exist? I.e., the application has to make sure that /some/where exists and is a directory before open(/some/where, O_CREAT

Re: [git pull] vfs.git part 2

2013-07-15 Thread Rasmus Villemoes
Linus Torvalds torva...@linux-foundation.org writes: On Fri, Jul 12, 2013 at 12:39 PM, Al Viro v...@zeniv.linux.org.uk wrote: [suggested by Rasmus Villemoes] make O_DIRECTORY | O_RDWR part of O_TMPFILE; that will fail on old kernels in a lot more cases than what I came up with. So see

Re: [PATCH v2 1/3] mfd: Add irq domain support for max8998 interrupts

2013-06-21 Thread Rasmus Villemoes
*max8998 = d-host_data; I may be wrong, but this sure looks like a typo (or copy-pasto). -- Rasmus Villemoes http://rasmusvillemoes.dk/ -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http

Re: [RFC] [PATCH] Pre-emption control for userspace

2014-03-06 Thread Rasmus Villemoes
H. Peter Anvin h...@zytor.com writes: I have several issues with this interface: 1. First, a process needs to know if it *should* have been preempted before it calls sched_yield(). So there needs to be a second flag set by the scheduler when granting amnesty. 2. A process which fails to

Re: [RFC] [PATCH] Pre-emption control for userspace

2014-03-06 Thread Rasmus Villemoes
Peter Zijlstra pet...@infradead.org writes: On Thu, Mar 06, 2014 at 02:24:43PM +0100, Rasmus Villemoes wrote: Is it possible to implement non-sleeping versions of {get,put}_user()? __{get,put}_user() Huh? arch/x86/include/asm/uaccess.h: /** * __get_user: - Get a simple variable from user

Re: [PATCH 1/2] lib/lcm.c: Ensure correct result whenever it fits

2014-01-14 Thread Rasmus Villemoes
Rasmus Villemoes li...@rasmusvillemoes.dk writes: Ping... Ensure that lcm(a,b) returns the mathematically correct result, provided it fits in an unsigned long. The current version returns garbage if a*b overflows, even if the final result would fit. Signed-off-by: Rasmus Villemoes li

Comment added in 63662139e params: Fix potential memory leak in add_sysfs_param()

2014-03-21 Thread Rasmus Villemoes
Hi, I'm not at all convinced by the comment added in commit 63662139e519ce. If krealloc(attrs, ...) fails, nothing seems to free attrs; the krealloc() call certainly doesn't do it. If attrs was NULL to begin with, no harm done, but otherwise it is attrs = mk-mp-grp.attrs;, and mk-mp is NULL'ed on

[PATCH] fs: Properly pair fget_light/fput_light in fdget/fdput

2013-06-05 Thread Rasmus Villemoes
fdget() is implemented using fget_light(). Its companion fdput() currently open-codes the behaviour of fput_light(). This is slightly confusing. To follow the documentation in fs/file.c:688ff to the letter, use fput_light() in fdput(). Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk

[PATCH] drivers: use IS_ERR_VALUE() in memory_lseek()

2013-06-05 Thread Rasmus Villemoes
Use IS_ERR_VALUE() instead of comparing the new offset to a hard-coded value of -MAX_ERRNO (which is also off-by-one due to the use of ~ instead of -). Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/char/mem.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

Re: [PATCH] mm: mremap: validate input before taking lock

2013-06-05 Thread Rasmus Villemoes
Ping... Rasmus Villemoes li...@rasmusvillemoes.dk writes: This patch is very similar to 84d96d897671: Perform some basic validation of the input to mremap() before taking the current-mm-mmap_sem lock. This also makes the MREMAP_FIXED = MREMAP_MAYMOVE dependency slightly more explicit

[PATCH 0/2] Per-task wait_queue_t

2014-06-10 Thread Rasmus Villemoes
, but not actually tested. [1] http://thread.gmane.org/gmane.linux.kernel/1720670 Rasmus Villemoes (2): wait: Introduce per-task wait_queue_t wait: Use the per-task wait_queue_t in ___wait_event macro include/linux/sched.h | 23 +++ include/linux/wait.h | 18

[PATCH 1/2] wait: Introduce per-task wait_queue_t

2014-06-10 Thread Rasmus Villemoes
leaf waiters, make all access through two helper functions. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/linux/sched.h | 23 +++ include/linux/wait.h | 1 + kernel/fork.c | 1 + 3 files changed, 25 insertions(+) diff --git a/include/linux

[PATCH 2/2] wait: Use the per-task wait_queue_t in ___wait_event macro

2014-06-10 Thread Rasmus Villemoes
The ___wait_event macro satisfies the requirements for making use of the per-task wait_queue_t, so use it. This should make the stack footprint of all users of the wait_event_* macros smaller. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/linux/wait.h | 17

Re: [PATCH 0/2] Per-task wait_queue_t

2014-06-12 Thread Rasmus Villemoes
Peter Zijlstra pet...@infradead.org writes: On Tue, Jun 10, 2014 at 02:29:17PM +0200, Rasmus Villemoes wrote: This is an attempt to reduce the stack footprint of various functions (those using any of the wait_event_* macros), by removing the need to allocate a wait_queue_t on the stack

[PATCH/RFC] scripts: Add stack-o-meter

2014-06-17 Thread Rasmus Villemoes
-in.o scripts/stack-o-meter.pl --sort delta gcc4.6 gcc4.7 Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- scripts/stack-o-meter.pl | 482 +++ 1 file changed, 482 insertions(+) create mode 100755 scripts/stack-o-meter.pl diff --git

Re: [RFC 2/2] x86_64: expand kernel stack to 16K

2014-06-03 Thread Rasmus Villemoes
Possibly stupid question: Is it true that any given task can only be using one wait_queue_t at a time? If so, would it be an idea to put a wait_queue_t into struct task_struct [maybe union'ed with a struct wait_bit_queue] and avoid allocating this 40 byte structure repeatedly on the stack. E.g.,

[PATCH trivial] include/linux/socket.h: Fix comment

2014-06-04 Thread Rasmus Villemoes
File descriptors are always closed on exit :-) Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/linux/socket.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/socket.h b/include/linux/socket.h index 8e98297..99d2466 100644 --- a/include/linux

[PATCH 2/2] lib/lcm.c: lcm(n,0)=lcm(0,n) is 0, not n

2013-12-17 Thread Rasmus Villemoes
Return the mathematically correct answer when an argument is 0. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- I don't think there is any instance of lcm(0,n) in the kernel, but at least this reduces code size a little. lib/lcm.c | 6 ++ 1 file changed, 2 insertions(+), 4

[PATCH 1/2] lib/lcm.c: Ensure correct result whenever it fits

2013-12-17 Thread Rasmus Villemoes
Ensure that lcm(a,b) returns the mathematically correct result, provided it fits in an unsigned long. The current version returns garbage if a*b overflows, even if the final result would fit. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- There are of course still plenty of cases

[PATCH 0/4] asm-generic: fix minor include guard issues

2013-08-08 Thread Rasmus Villemoes
, the _ASM_POWERPC_RWSEM_H and #ifdef CONFIG_PPC64 seem malplaced. Rasmus Villemoes (4): asm-generic: Make sure include guards contain the substring ASM_GENERIC asm-generic: Use different include guards asm-generic: Add missing include guards asm-generic: Fix typo in comment after

[PATCH 1/4] asm-generic: Make sure include guards contain the substring ASM_GENERIC

2013-08-08 Thread Rasmus Villemoes
-hits are: arch/mn10300/include/asm/rtc.h uses _ASM_RTC_H and includes asm-generic/rtc.h which uses __ASM_RTC_H__ arch/hexagon/include/asm/cacheflush.h uses _ASM_CACHEFLUSH_H and includes asm-generic/cacheflush.h which uses __ASM_CACHEFLUSH_H Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk

[PATCH 3/4] asm-generic: Add missing include guards

2013-08-08 Thread Rasmus Villemoes
Add include guards to include/asm-generic/{ide_iops,unistd,xor}.h. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/asm-generic/ide_iops.h |4 include/asm-generic/unistd.h |5 + include/asm-generic/xor.h |4 3 files changed, 13 insertions

[PATCH 4/4] asm-generic: Fix typo in comment after #endif

2013-08-08 Thread Rasmus Villemoes
Fix the comment so that it matches the actual name of the include guard used. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/asm-generic/bitops/arch_hweight.h |2 +- include/asm-generic/bitops/atomic.h |2 +- include/asm-generic/pci_iomap.h |2

[PATCH 2/4] asm-generic: Use different include guards

2013-08-08 Thread Rasmus Villemoes
For consistency, use different include guards in include/asm-generic/dma-mapping-{broken,common}.h, even though it is unlikely (if not outright a bug) to ever include both. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/asm-generic/dma-mapping-broken.h |6

[PATCH/RFC] coccinelle: replace 0/1 with false/true in functions returning bool

2013-08-09 Thread Rasmus Villemoes
true; } Is there a way to prevent this, or is this the kind of thing which must be handled in post-processing? Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- scripts/coccinelle/misc/boolreturn.cocci | 51 ++ 1 file changed, 51 insertions(+) create mode

[PATCH v2] coccinelle: replace 0/1 with false/true in functions returning bool

2013-08-09 Thread Rasmus Villemoes
This semantic patch replaces return {0,1}; with return {false,true}; in functions returning bool. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- v2: Simplified script, and eliminate whitespace mangling at the same time. Thanks to Julia Lawall. scripts/coccinelle/misc

[PATCH v3] coccinelle: replace 0/1 with false/true in functions returning bool

2013-08-11 Thread Rasmus Villemoes
This semantic patch replaces return {0,1}; with return {false,true}; in functions returning bool. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- v2: Simplified script, and eliminate whitespace mangling at the same time. Thanks to Julia Lawall. v3: Further improvements from Julia

[PATCH] linux/thermal.h: Rename KELVIN_TO_CELSIUS to DECI_KELVIN_TO_CELSIUS

2014-03-24 Thread Rasmus Villemoes
The macros KELVIN_TO_CELSIUS and CELSIUS_TO_KELVIN actually work on decikelvins, so rename them to reflect their actual semantics. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/acpi/thermal.c | 12 ++-- drivers/platform/x86/asus-wmi.c | 2

[PATCH] scripts: modpost: Remove numeric suffix pattern matching

2014-07-09 Thread Rasmus Villemoes
For several years, the pattern foo$ has effectively been treated as equivalent to foo due to a bug in the (misnamed) helper number_prefix(). This hasn't been observed to cause any problems, so remove the broken $ functionality and change all foo$ patterns to foo. Signed-off-by: Rasmus Villemoes

[PATCH] pci: Add include guard to include/linux/pci_ids.h

2014-07-10 Thread Rasmus Villemoes
Adding an include guard frees the preprocessor from reparsing over 2600 #defines in the cases where pci_ids.h is somehow included more than once. This gives a tiny-but-measurable performance improvement when compiling such files. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk

[PATCH] drivers: tty: Remove redundant memset() in initialize_tty_struct

2014-07-10 Thread Rasmus Villemoes
All callers (all two) of initialize_tty_struct() have just obtained the passed tty_struct from alloc_tty_struct(), which uses kzalloc(). So there is no reason to clear the memory again. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/tty/tty_io.c | 1 - 1 file changed, 1

[PATCH] drivers: tty: Merge alloc_tty_struct and initialize_tty_struct

2014-07-10 Thread Rasmus Villemoes
The two functions alloc_tty_struct and initialize_tty_struct are always called together. Merge them into alloc_tty_struct, updating its prototype and the only two callers of these functions. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/tty/pty.c| 19

[PATCH v2] trivial: sound/core/seq/seq_memory.c: Fix closing brace followed by if

2014-06-23 Thread Rasmus Villemoes
Add a newline and, while at it, remove a space and redundant braces. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- sound/core/seq/seq_memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c index

Re: [PATCH 2/2] lib: list_sort_test(): Add extra corruption check

2014-06-23 Thread Rasmus Villemoes
Rasmus Villemoes li...@rasmusvillemoes.dk writes: Add a check to make sure that the prev pointer of the list head points to the last element on the list. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- lib/list_sort.c | 5 + 1 file changed, 5 insertions(+) diff --git

[PATCH v2 0/4] lib: list_sort: Various minor improvements

2014-06-24 Thread Rasmus Villemoes
Reading the source of lib/list_sort.c, I came up with a few possible improvements. I think 4/4 may be a bit controversial, but 1/4, 2/4 and 3/4 should be straightforward. v2: Fix typo in 2/4, and add 3/4,4/4. Rasmus Villemoes (4): lib: list_sort_test(): Return -ENOMEM when allocation fails

[PATCH v2 2/4] lib: list_sort_test(): Add extra corruption check

2014-06-24 Thread Rasmus Villemoes
Add a check to make sure that the prev pointer of the list head points to the last element on the list. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- lib/list_sort.c | 5 + 1 file changed, 5 insertions(+) diff --git a/lib/list_sort.c b/lib/list_sort.c index 291412a..fbdbc86

[PATCH v2 1/4] lib: list_sort_test(): Return -ENOMEM when allocation fails

2014-06-24 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- lib/list_sort.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/list_sort.c b/lib/list_sort.c index 1183fa7..291412a 100644 --- a/lib/list_sort.c +++ b/lib/list_sort.c @@ -207,7 +207,7 @@ static int __init cmp

[PATCH v2 3/4] lib: list_sort_test(): Simplify and harden cleanup

2014-06-24 Thread Rasmus Villemoes
elements. Minor details: Use sizeof(*elts) instead of sizeof(void *), and return err immediately when allocation of elts fails, to avoid introducing another label just before the final return statement. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- lib/list_sort.c | 12

[PATCH v2 4/4] lib: list_sort.c: Limit number of unused cmp callbacks

2014-06-24 Thread Rasmus Villemoes
two function calls for every two pointer assignments is a bit excessive. This patch limits the calls to once for every 256 iterations. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- lib/list_sort.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/list_sort.c b

Re: [RFC PATCH 0/3] Mark literal strings in __init / __exit code

2014-06-24 Thread Rasmus Villemoes
Joe Perches j...@perches.com writes: On Mon, 2014-06-23 at 08:23 +0200, Mathias Krause wrote: On 23 June 2014 00:56, Joe Perches j...@perches.com wrote: On Mon, 2014-06-23 at 00:46 +0200, Mathias Krause wrote: [...] patch 2 adds some syntactical sugar for the most popular use case, by

[PATCH 6/6] include/rxrpc/types.h: Remove unused header

2014-06-24 Thread Rasmus Villemoes
The header file include/rxrpc/types.h does not seem to be used anywhere. It was orphaned by 63b6be55 [AF_RXRPC]: Delete the old RxRPC code.. Remove it. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/rxrpc/types.h | 41 - 1 file

[PATCH 3/6] include/linux/mfd/ti_ssp.h: Remove unused header

2014-06-24 Thread Rasmus Villemoes
The header file include/linux/mfd/ti_ssp.h does not seem to be used anywhere. It was orphaned by 3033ee62 mfd: Remove obsolete ti-ssp driver. Remove it. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/linux/mfd/ti_ssp.h | 93 -- 1

[PATCH 5/6] include/linux/platform_data/tegra_emc.h: Remove unused header

2014-06-24 Thread Rasmus Villemoes
The header file include/linux/platform_data/tegra_emc.h does not seem to be used anywhere. It was orphaned by a7cbe92c ARM: tegra: remove tegra EMC scaling driver. Remove it. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/linux/platform_data/tegra_emc.h | 34

[PATCH 4/6] include/linux/phonedev.h: Remove unused header

2014-06-24 Thread Rasmus Villemoes
The header file include/linux/phonedev.h does not seem to be used anywhere. It was orphaned by 7326446c Staging: remove telephony drivers. Remove it. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/linux/phonedev.h | 25 - 1 file changed, 25 deletions

[PATCH 0/6] Remove various orphaned header files

2014-06-24 Thread Rasmus Villemoes
AFAICT, these headers are not used anywhere, and are just accidental leftovers from past cleanups. Rasmus Villemoes (6): include/linux/cycx_x25.h: Remove unused header include/linux/i82593.h: Remove unused header include/linux/mfd/ti_ssp.h: Remove unused header include/linux/phonedev.h

[PATCH 1/6] include/linux/cycx_x25.h: Remove unused header

2014-06-24 Thread Rasmus Villemoes
The header file include/linux/cycx_x25.h does not seem to be used anywhere. It was orphaned by 6fcdf4facb wanrouter: delete now orphaned header content, files/drivers. Remove it. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/linux/cycx_x25.h | 125

[PATCH 2/6] include/linux/i82593.h: Remove unused header

2014-06-24 Thread Rasmus Villemoes
The header file include/linux/i82593.h does not seem to be used anywhere. It was orphaned by 8a594170 drivers/net: delete intel i825xx based znet notebook driver. Remove it. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/linux/i82593.h | 229

Re: [RFC PATCH 0/3] Mark literal strings in __init / __exit code

2014-06-25 Thread Rasmus Villemoes
Mathias Krause mini...@googlemail.com writes: On 24 June 2014 16:31, Rasmus Villemoes li...@rasmusvillemoes.dk wrote: gcc already seems to contain infrastructure for this kind of thing, so maybe it doesn't even require a plugin, but simply a little coordination with the gcc folks

[PATCH] scripts/mod/modpost.c: Fix bug in number_prefix

2014-06-25 Thread Rasmus Villemoes
to be a digit. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- scripts/mod/modpost.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 9d9c5b9..336f45f 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c

Re: [PATCH v2 0/4] lib: list_sort: Various minor improvements

2014-06-25 Thread Rasmus Villemoes
Andrew Morton a...@linux-foundation.org writes: On Tue, 24 Jun 2014 12:06:27 +0200 Rasmus Villemoes li...@rasmusvillemoes.dk wrote: Reading the source of lib/list_sort.c, I came up with a few possible improvements. I think 4/4 may be a bit controversial, but 1/4, 2/4 and 3/4 should

Re: [PATCH v2 0/4] lib: list_sort: Various minor improvements

2014-06-25 Thread Rasmus Villemoes
Andrew Morton a...@linux-foundation.org writes: On Thu, 26 Jun 2014 00:28:18 +0200 Rasmus Villemoes li...@rasmusvillemoes.dk wrote: Minor comment: Won't this end up saying list_sort_test: list passed to ..., despite the list coming from a 'real' user? Maybe change the first #define

Re: [PATCH] scripts/mod/modpost.c: Fix bug in number_prefix

2014-06-25 Thread Rasmus Villemoes
Paul Gortmaker paul.gortma...@windriver.com writes: On 14-06-25 04:46 AM, Rasmus Villemoes wrote: The function number_prefix() can currently only return 1 if its argument is the empty string: If line 3 is reached and *sym (now the second character in the argument) is not '.', 0 is returned

[PATCH] mm: percpu: micro-optimize round-to-even

2014-06-19 Thread Rasmus Villemoes
This change shaves a few bytes off the generated code. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- mm/percpu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/percpu.c b/mm/percpu.c index 2ddf9a9..978097f 100644 --- a/mm/percpu.c +++ b/mm/percpu.c

[PATCH] drivers/sbus/char: Micro-optimization in display7seg.c

2014-06-19 Thread Rasmus Villemoes
Flipping a bit doesn't need four lines of code; and gcc seems to actually generate two branches. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/sbus/char/display7seg.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/sbus/char/display7seg.c b

[PATCH] x86: Micro-optimization in nhmex_rbox_get_constraint

2014-06-19 Thread Rasmus Villemoes
Flipping the LSB doesn't require four lines of code. This shaves a few bytes of the generated code, including a branch. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- arch/x86/kernel/cpu/perf_event_intel_uncore.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git

[PATCH] trivial: drivers/macintosh/smu.c: Fix closing brace followed by if

2014-06-20 Thread Rasmus Villemoes
A closing brace followed by if is almost certainly a mistake. Maybe else if was meant, but in this case it doesn't really matter. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/macintosh/smu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers

[PATCH] trivial: net/irda/irlmp.c: Fix closing brace followed by if

2014-06-20 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- net/irda/irlmp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c index 98ad6ec..a5f28d4 100644 --- a/net/irda/irlmp.c +++ b/net/irda/irlmp.c @@ -1426,7 +1426,8 @@ __u8

[PATCH] trivial: sound/core/seq/seq_memory.c: Fix closing brace followed by if

2014-06-20 Thread Rasmus Villemoes
Add a newline, and remove a space while at it. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- sound/core/seq/seq_memory.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c index 1e206de..4854c21 100644

[PATCH] trivial: fs/btrfs/tree-log.c: Fix closing brace followed by if

2014-06-20 Thread Rasmus Villemoes
Maybe else if was meant, but because of the goto out_unlock, it doesn't make a difference. Anyway, I chose the only whitespace fix. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- fs/btrfs/tree-log.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/tree

[PATCH] trivial: drivers/staging/rtl8821ae/rtl8821ae: Fix closing brace followed by if

2014-06-20 Thread Rasmus Villemoes
-- is equivalent to flipping it). Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/staging/rtl8821ae/rtl8821ae/hal_btc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8821ae/rtl8821ae/hal_btc.c b/drivers/staging/rtl8821ae/rtl8821ae

[PATCH] drivers/video/fbdev/sis: Add missing else

2014-06-20 Thread Rasmus Villemoes
The surrounding code and the fact that the previous two if's are rendered useless without this else (since SIS_340==55 and XGI_20==75 are greater than SIS_661==15) suggests that the else is indeed missing. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/video/fbdev/sis

[PATCH] checkpatch.pl: Also suggest 'else if' when if follows brace

2014-06-20 Thread Rasmus Villemoes
This might help a kernel hacker think twice before blindly adding a newline. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 010b18e..e1924eb

Re: [PATCH] trivial: drivers/staging/rtl8821ae/rtl8821ae: Fix closing brace followed by if

2014-06-20 Thread Rasmus Villemoes
Greg Kroah-Hartman gre...@linuxfoundation.org writes: On Fri, Jun 20, 2014 at 09:56:35PM +0200, Rasmus Villemoes wrote: All of the code is #if 0'd out, and the change just replaces a space with a newline, so this obviously doesn't change anything. How about just deleting all the #if 0 code

[PATCH] drivers/staging/rtl8821ae/rtl8821ae: Remove dead code

2014-06-20 Thread Rasmus Villemoes
This is all #if 0'ed out, and it contains some rather weird stuff (post-increment of a bool, for example). Nuke it. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/staging/rtl8821ae/rtl8821ae/hal_btc.c | 14 -- 1 file changed, 14 deletions(-) diff --git

[PATCH] net/wireless/brcm80211/brcmfmac: Make return type reflect actual semantics

2014-06-20 Thread Rasmus Villemoes
traversal and bit testing have no side effects, just return true immediately. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- Notes: Alternatively, if the function is supposed to return a count, the one-line fix would be - bool result = 0; + u32 result = 0

[PATCH 1/2] lib: list_sort_test(): Return -ENOMEM when allocation fails

2014-06-20 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- lib/list_sort.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/list_sort.c b/lib/list_sort.c index 1183fa7..291412a 100644 --- a/lib/list_sort.c +++ b/lib/list_sort.c @@ -207,7 +207,7 @@ static int __init cmp

[PATCH 2/2] lib: list_sort_test(): Add extra corruption check

2014-06-20 Thread Rasmus Villemoes
Add a check to make sure that the prev pointer of the list head points to the last element on the list. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- lib/list_sort.c | 5 + 1 file changed, 5 insertions(+) diff --git a/lib/list_sort.c b/lib/list_sort.c index 291412a..832f525

[PATCH v2] net/wireless/brcm80211/brcmfmac: Make return type and name reflect actual semantics

2014-06-21 Thread Rasmus Villemoes
traversal and bit testing have no side effects, just return true immediately. Its return value tells if any vif is up, so also rename it to brcmf_get_vif_state_any. Reviewed-by: Arend van Spriel ar...@broadcom.com Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- Notes: v2: Rename

[PATCH v3] net/wireless/brcm80211/brcmfmac: Make return type and name reflect actual semantics

2014-06-22 Thread Rasmus Villemoes
traversal and bit testing have no side effects, just return true immediately. Its return value tells if any vif is in the specified state, so also rename it to brcmf_get_vif_state_any. Reviewed-by: Arend van Sprielar...@broadcom.com Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- Notes

[PATCH 1/2] staging: rtl8821ae: Pass large struct by const reference

2014-07-01 Thread Rasmus Villemoes
struct rtl_stats is rather huge (152 bytes), and since rtl8812ae_rx_command_packet_handler() does not modify it, it might as well be passed by const reference. Reported by Coverity: CID 1167285 Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/staging/rtl8821ae/pci.c

[PATCH 2/2] staging: rtl8192ee: Pass large struct by const reference

2014-07-01 Thread Rasmus Villemoes
struct rtl_stats is rather huge (152 bytes), and since rtl92ee_rx_command_packet() does not modify it, it might as well be passed by const reference. Reported by Coverity: CID 1222131 Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/staging/rtl8192ee/pci.c | 2

[PATCH] drivers: message: fusion: Simplify rounding

2014-07-01 Thread Rasmus Villemoes
. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/message/fusion/mptbase.c | 7 +-- drivers/message/fusion/mptctl.c | 7 +-- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index ebc0af7

[PATCH v2] drivers: tty: Merge alloc_tty_struct and initialize_tty_struct

2014-07-12 Thread Rasmus Villemoes
The two functions alloc_tty_struct and initialize_tty_struct are always called together. Merge them into alloc_tty_struct, updating its prototype and the only two callers of these functions. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- I hope this is sufficient. Thanks, Dan

Re: [PATCH] pci: Add include guard to include/linux/pci_ids.h

2014-07-12 Thread Rasmus Villemoes
Bjorn Helgaas bhelg...@google.com writes: On Thu, Jul 10, 2014 at 02:05:11PM +0200, Rasmus Villemoes wrote: Adding an include guard frees the preprocessor from reparsing over 2600 #defines in the cases where pci_ids.h is somehow included more than once. This gives a tiny-but-measurable

[PATCH] drivers: tty: Fix use-after-free in pty_common_install

2014-07-12 Thread Rasmus Villemoes
dan.carpen...@oracle.com Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/tty/pty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index ac723e3..9bbdb1d 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -388,7

[PATCH] net: arcnet: Remove #define bool int

2014-07-02 Thread Rasmus Villemoes
/types.h must appear before #include linux/arcdevice.h (the compiler wouldn't like typedef _Bool int). Since none of the files using arcdevice.h declare variables of type bool, the patch is actually quite simple, unlike the commit message. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk

[PATCH] staging: omap4iss: Fix type of struct iss_device::crashed

2014-07-02 Thread Rasmus Villemoes
, which is unlikely to be what was intended. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/staging/media/omap4iss/iss.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/omap4iss/iss.h b/drivers/staging/media/omap4iss/iss.h index

Re: [PATCH] net: arcnet: Remove #define bool int

2014-07-02 Thread Rasmus Villemoes
Greg Kroah-Hartman gre...@linuxfoundation.org writes: On Wed, Jul 02, 2014 at 02:12:01PM +0200, Rasmus Villemoes wrote: include/linux/arcdevice.h | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) Why are you sending this patch to me? I don't own it at all, please use

DNAME_INLINE_LEN versus CONFIG_GENERIC_LOCKBREAK

2014-07-03 Thread Rasmus Villemoes
Hi, In dcache.h, DNAME_INLINE_LEN is carefully chosen so that sizeof(struct dentry) is a (specific) multiple of 64 bytes. Obviously this breaks when certain debug options are chosen (DEBUG_LOCK_ALLOC and DEBUG_SPINLOCK), but also, AFAICT, on architectures with CONFIG_GENERIC_LOCKBREAK. I'm not

[PATCH 06/18] lib: bitmap: Make nbits parameter of bitmap_{and,or,xor,andnot} unsigned

2014-07-03 Thread Rasmus Villemoes
This change is only for consistency with the changes to the other bitmap_* functions; it doesn't change the size of the generated code: inside BITS_TO_LONGS there is a sizeof(long), which causes bits to be interpreted as unsigned anyway. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk

[PATCH 15/18] lib: bitmap: Micro-optimize bitmap_allocate_region

2014-07-03 Thread Rasmus Villemoes
__reg_op(..., REG_OP_ALLOC) always returns 0, so we might as well use that and save an instruction. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- lib/bitmap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/bitmap.c b/lib/bitmap.c index c2f3807..faaf720

[PATCH 17/18] lib: bitmap: Add missing mask in bitmap_and

2014-07-03 Thread Rasmus Villemoes
Apparently, bitmap_and is supposed to return whether the new bitmap is empty. But it didn't take potential garbage bits in the last word into account. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/linux/bitmap.h | 2 +- lib/bitmap.c | 7 +-- 2 files changed

[PATCH 00/18] lib: bitmap: Various improvements

2014-07-03 Thread Rasmus Villemoes
. Rasmus Villemoes (18): lib: bitmap: Make nbits parameter of bitmap_empty unsigned lib: bitmap: Make nbits parameter of bitmap_full unsigned lib: bitmap: Make nbits parameter of bitmap_equal unsigned lib: bitmap: Make nbits parameter of bitmap_complement unsigned lib: bitmap: Remove

[PATCH 16/18] lib: bitmap: Add missing mask in bitmap_shift_right

2014-07-03 Thread Rasmus Villemoes
There is no guarantee that *src does not contain garbage bits outside the lower nbits, so we need to mask it before the shift-and-assign. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/linux/bitmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH 18/18] lib: bitmap: Add missing mask in bitmap_andnot

2014-07-03 Thread Rasmus Villemoes
Apparently, bitmap_andnot is supposed to return whether the new bitmap is empty. But it didn't take potential garbage bits in the last word into account. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/linux/bitmap.h | 2 +- lib/bitmap.c | 7 +-- 2 files

[PATCH 09/18] lib: bitmap: Make nbits parameter of bitmap_weight unsigned

2014-07-03 Thread Rasmus Villemoes
to bitmap_weight(). Certainly an int is capable of holding the result. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/linux/bitmap.h | 4 ++-- lib/bitmap.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/linux/bitmap.h b/include/linux

[PATCH 08/18] lib: bitmap: Make nbits parameter of bitmap_subset unsigned

2014-07-03 Thread Rasmus Villemoes
The compiler can generate slightly smaller and simpler code when it knows that nbits is non-negative. Since no-one passes a negative bit-count, this shouldn't affect the semantics. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/linux/bitmap.h | 4 ++-- lib/bitmap.c

[PATCH 11/18] lib: bitmap: Make the start index of bitmap_clear unsigned

2014-07-03 Thread Rasmus Villemoes
The compiler can generate slightly smaller and simpler code when it knows that start is non-negative. Also, use the names start and len for the two parameters for consistency with bitmap_set. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/linux/bitmap.h | 2 +- lib

[PATCH 13/18] lib: bitmap: Fix typo in kerneldoc for bitmap_pos_to_ord

2014-07-03 Thread Rasmus Villemoes
A few lines above, it was stated that positions for non-set bits are mapped to -1, which is obviously also what the code does. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- lib/bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bitmap.c b/lib/bitmap.c

[PATCH 14/18] lib: bitmap: Change parameter of bitmap_*_region to unsigned

2014-07-03 Thread Rasmus Villemoes
error code to be returned. An int is certainly capable of representing any realistic return value. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/linux/bitmap.h | 6 +++--- lib/bitmap.c | 12 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git

[PATCH 12/18] lib: bitmap: Simplify bitmap_parselist

2014-07-03 Thread Rasmus Villemoes
We want len to be the index of the first '\n', or the length of the string if there is no newline. This is a good example of the usefulness of strchrnul(). Use that instead, thus eliminating a branch and a call to strlen(). Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- lib

[PATCH 10/18] lib: bitmap: Make the start index of bitmap_set unsigned

2014-07-03 Thread Rasmus Villemoes
The compiler can generate slightly smaller and simpler code when it knows that start is non-negative. Also, use the names start and len for the two parameters in both header file and implementation, instead of the previous mix. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk

[PATCH 07/18] lib: bitmap: Make nbits parameter of bitmap_intersects unsigned

2014-07-03 Thread Rasmus Villemoes
The compiler can generate slightly smaller and simpler code when it knows that nbits is non-negative. Since no-one passes a negative bit-count, this shouldn't affect the semantics. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/linux/bitmap.h | 4 ++-- lib/bitmap.c

[PATCH 03/18] lib: bitmap: Make nbits parameter of bitmap_equal unsigned

2014-07-03 Thread Rasmus Villemoes
The compiler can generate slightly smaller and simpler code when it knows that nbits is non-negative. Since no-one passes a negative bit-count, this shouldn't affect the semantics. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/linux/bitmap.h | 2 +- lib/bitmap.c

[PATCH 04/18] lib: bitmap: Make nbits parameter of bitmap_complement unsigned

2014-07-03 Thread Rasmus Villemoes
The compiler can generate slightly smaller and simpler code when it knows that nbits is non-negative. Since no-one passes a negative bit-count, this shouldn't affect the semantics. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/linux/bitmap.h | 6 +++--- lib/bitmap.c

[PATCH 02/18] lib: bitmap: Make nbits parameter of bitmap_full unsigned

2014-07-03 Thread Rasmus Villemoes
The compiler can generate slightly smaller and simpler code when it knows that nbits is non-negative. Since no-one passes a negative bit-count, this shouldn't affect the semantics. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- include/linux/bitmap.h | 4 ++-- lib/bitmap.c

  1   2   3   4   5   6   7   8   9   10   >