Re: [PATCH v3 1/6] ilog2: create truly constant version for sparse

2018-04-19 Thread Rasmus Villemoes
On 2018-04-18 23:21, Linus Torvalds wrote: > On Wed, Apr 18, 2018 at 1:12 AM, Martin Wilck wrote: >> >> No, it doesn't (gcc 7.3.0). -> https://paste.opensuse.org/27471594 >> It doesn't even warn on an expression like this: >> >> #define SIZE (1<<10) >> static int

[PATCH] scsi: fnic: use kzalloc in fnic_fcoe_process_vlan_resp

2018-01-08 Thread Rasmus Villemoes
This saves a little .text and gets rid of the unmotivated line break and the sizeof(...) style inconsistency. Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> --- drivers/scsi/fnic/fnic_fcs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/scs

[PATCH] target-core: don't use "const char*" for a buffer that is written to

2017-11-20 Thread Rasmus Villemoes
From: Rasmus Villemoes <rasmus.villem...@prevas.dk> iscsi_parse_pr_out_transport_id launders the const away via a call to strstr(), and then modifies the buffer (writing a nul byte) through the return value. It's cleaner to be honest and simply declare the parameter as "char*", fi

[PATCH] scsi: hpsa: use %phN for short hex dumps

2016-11-30 Thread Rasmus Villemoes
it alone for now. Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> --- drivers/scsi/hpsa.c | 40 +--- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index a1d6ab76a514..d74268ffb71e

Re: [PATCH v2 1/7] lib: string: add functions to case-convert strings

2016-07-07 Thread Rasmus Villemoes
On Tue, Jul 05 2016, Markus Mayer wrote: > Add a collection of generic functions to convert strings to lowercase > or uppercase. > > Changing the case of a string (with or without copying it first) seems > to be a recurring requirement in the kernel that is currently being >

Re: [PATCH 1/6] lib: string: add function strtolower()

2016-07-01 Thread Rasmus Villemoes
On Fri, Jul 01 2016, Markus Mayer wrote: > Add a function called strtolower() to convert strings to lower case > in-place, overwriting the original string. > > This seems to be a recurring requirement in the kernel that is > currently being solved by several duplicated

[PATCH v3 1/3] scsi: make some Additional Sense strings more grep'able

2016-03-22 Thread Rasmus Villemoes
There's little point in breaking these strings over multiple lines. Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> Reviewed-by: Hannes Reinecke <h...@suse.com> --- drivers/scsi/constants.c | 27 +-- 1 file changed, 9 insertions(+), 18 deletions(-)

[PATCH v3 3/3] scsi: reduce CONFIG_SCSI_CONSTANTS=y impact by 8k

2016-03-22 Thread Rasmus Villemoes
costs around 75 KB, but that was a little exaggerated. The actual number was closer to 44K, and 36K with this patch. Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> Reviewed-by: Hannes Reinecke <h...@suse.com> Tested-by: Douglas Gilbert <dgilb...@interlog.com> --- dr

[PATCH v3 2/3] scsi: move Additional Sense Codes to separate file

2016-03-22 Thread Rasmus Villemoes
This is a purely mechanical move of the list of additional sense codes to a separate file, in preparation for reducing the impact of choosing CONFIG_SCSI_CONSTANTS=y by about 8k. Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> Reviewed-by: Hannes Reinecke <h...@suse.com>

[PATCH v3 0/3] scsi: reduce CONFIG_SCSI_CONSTANTS=y impact by 8k

2016-03-22 Thread Rasmus Villemoes
36 KB, while it was about 44 KB before. I took the liberty of including Hannes' Reviewed-by and Douglas' Tested-by despite that addition. Rasmus Villemoes (3): scsi: make some Additional Sense strings more grep'able scsi: move Additional Sense Codes to separate file scsi: reduce

Re: [PATCH v2 0/3] scsi: reduce CONFIG_SCSI_CONSTANTS=y impact by 8k

2016-03-08 Thread Rasmus Villemoes
On Tue, Nov 24 2015, Rasmus Villemoes <li...@rasmusvillemoes.dk> wrote: > This reduces the impact of choosing CONFIG_SCSI_CONSTANTS by about 8KB. > ping? does anyone feel like picking these up? Rasmus -- To unsubscribe from this list: send the line "unsubscribe linux-

[PATCH] [SCSI] osd: fix signed char versus %02x issue

2015-12-08 Thread Rasmus Villemoes
ch simpler (and generates smaller code) to use the %ph extension which was created for such short hexdumps. Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> --- drivers/scsi/osd/osd_initiator.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/scsi/osd

[PATCH v2 2/3] scsi: move Additional Sense Codes to separate file

2015-11-24 Thread Rasmus Villemoes
This is a purely mechanical move of the list of additional sense codes to a separate file, in preparation for reducing the impact of choosing CONFIG_SCSI_CONSTANTS=y by about 8k. Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> --- drivers/scsi/constants.c

[PATCH v2 0/3] scsi: reduce CONFIG_SCSI_CONSTANTS=y impact by 8k

2015-11-24 Thread Rasmus Villemoes
). Tested with a trivial module calling scsi_extd_sense_format with a few random known codes and comparing the result to the expected value. v2: prepend patch to unsplit a few string literals for greppability, leave the NULL sentinel in the .c file in 2/3 (it's removed in 3/3 either way). Rasmus Villemoes (

[PATCH v2 1/3] scsi: make some Additional Sense strings more grep'able

2015-11-24 Thread Rasmus Villemoes
There's little point in breaking these strings over multiple lines. Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> --- drivers/scsi/constants.c | 27 +-- 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/constants.c b/driver

[PATCH v2 3/3] scsi: reduce CONFIG_SCSI_CONSTANTS=y impact by 8k

2015-11-24 Thread Rasmus Villemoes
/shrink: 1/1 up/down: 24/-8488 (-8464) function old new delta scsi_extd_sense_format 136 160 +24 additional 113122824 -8488 Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes

Re: [PATCH] scsi: hpsa: fix multiple issues in path_info_show

2015-11-14 Thread Rasmus Villemoes
On Wed, Oct 28 2015, Don Brace <brace77...@gmail.com> wrote: > On 10/27/2015 05:16 PM, Rasmus Villemoes wrote: >> I'm not familiar with this code, but path_info_show() (added in >> 8270b86243658 "hpsa: add sysfs entry path_info to show box and >> bay information&

Re: [PATCH v2] string_helpers: fix precision loss for some inputs

2015-11-04 Thread Rasmus Villemoes
On Wed, Nov 04 2015, James Bottomley <james.bottom...@hansenpartnership.com> wrote: > On Wed, 2015-11-04 at 00:26 +0100, Rasmus Villemoes wrote: >> On Tue, Nov 03 2015, James Bottomley <james.bottom...@hansenpartnership.com> >> wrote: >> >> Please s

Re: [PATCH v2] string_helpers: fix precision loss for some inputs

2015-11-03 Thread Rasmus Villemoes
inputs correctly, including zero for block size. > > Reported-by: Vitaly Kuznetsov <vkuzn...@redhat.com> > Cc: sta...@vger.kernel.org# delay backport by two months for testing > Fixes: b9f28d863594c429e1df35a0474d2663ca28b307 > Signed-off-by: James Bottomley <jbottom...@odin

Re: [PATCH v2] string_helpers: fix precision loss for some inputs

2015-11-03 Thread Rasmus Villemoes
On Tue, Nov 03 2015, James Bottomley <james.bottom...@hansenpartnership.com> wrote: > On Tue, 2015-11-03 at 23:13 +0100, Rasmus Villemoes wrote: >> On Tue, Nov 03 2015, James Bottomley <james.bottom...@hansenpartnership.com> >> wrote: >> >> >

[PATCH] scsi: hpsa: fix multiple issues in path_info_show

2015-10-27 Thread Rasmus Villemoes
at least PAGE_SIZE. s[c]nprintf doesn't care where it is writing to, so this doesn't make the spin lock hold time any longer. Using scnprintf ensures that output_len always represents the number of bytes actually written to the buffer, so we'll report the proper amount to the upper layer. Signed-off-by: Ra

Re: [PATCH 1/2] scsi: move Additional Sense Codes to separate file

2015-10-17 Thread Rasmus Villemoes
On Tue, Oct 06 2015, Rasmus Villemoes <li...@rasmusvillemoes.dk> wrote: > On Mon, Oct 05 2015, Bart Van Assche <bart.vanass...@sandisk.com> wrote: > >> On 10/05/15 02:26, Rasmus Villemoes wrote: >>> - {0x041A, "Logical unit not ready, start sto

Re: [PATCH 1/2] scsi: move Additional Sense Codes to separate file

2015-10-06 Thread Rasmus Villemoes
On Mon, Oct 05 2015, Bart Van Assche <bart.vanass...@sandisk.com> wrote: > On 10/05/15 02:26, Rasmus Villemoes wrote: >> -{0x041A, "Logical unit not ready, start stop unit command in " >> - "progress"}, >> -{0x041B, "Logical uni

Re: [PATCH 2/2] scsi: reduce CONFIG_SCSI_CONSTANTS=y impact by 8k

2015-10-06 Thread Rasmus Villemoes
On Mon, Oct 05 2015, Bart Van Assche <bart.vanass...@sandisk.com> wrote: > On 10/05/15 02:26, Rasmus Villemoes wrote: >> struct error_info { >> unsigned short code12; /* 0x0302 looks better than 0x03,0x02 */ >> -const char * text; >> +unsigne

Re: RFC: reduce CONFIG_SCSI_CONSTANTS impact by 4k

2015-10-06 Thread Rasmus Villemoes
On Tue, Oct 06 2015, Julian Calaby wrote: > Hi Rasmus, > >> >> diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c >> index 47aaccd5e68e..ccd34b0481cd 100644 >> --- a/drivers/scsi/constants.c >> +++ b/drivers/scsi/constants.c >> @@ -292,17 +292,31 @@ bool

[PATCH 0/2] scsi: reduce CONFIG_SCSI_CONSTANTS=y impact by 8k

2015-10-05 Thread Rasmus Villemoes
). Tested with a trivial module calling scsi_extd_sense_format with a few random known codes and comparing the result to the expected value. Rasmus Villemoes (2): scsi: move Additional Sense Codes to separate file scsi: reduce CONFIG_SCSI_CONSTANTS=y impact by 8k drivers/scsi/constants

[PATCH 2/2] scsi: reduce CONFIG_SCSI_CONSTANTS=y impact by 8k

2015-10-05 Thread Rasmus Villemoes
/shrink: 1/1 up/down: 24/-8488 (-8464) function old new delta scsi_extd_sense_format 136 160 +24 additional 113122824 -8488 Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes

[PATCH 1/2] scsi: move Additional Sense Codes to separate file

2015-10-05 Thread Rasmus Villemoes
This is a purely mechanical move of the list of additional sense codes to a separate file, in preparation for reducing the impact of choosing CONFIG_SCSI_CONSTANTS=y by about 8k.. Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> --- drivers/scsi/constants.c

Re: RFC: reduce CONFIG_SCSI_CONSTANTS impact by 4k

2015-10-03 Thread Rasmus Villemoes
136 160 +24 additional 113122824 -8488 Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> --- drivers/scsi/constants.c | 25 + drivers/scsi/sense_codes.h | 2 -- 2 files changed, 21 insertions(+), 6 deletions

[PATCH] [SCSI] fnic: use kzalloc in fnic_fcoe_process_vlan_resp

2015-10-01 Thread Rasmus Villemoes
This saves a little .text and avoids the sizeof(...) style inconsistency. Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> --- drivers/scsi/fnic/fnic_fcs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/scsi/fnic/fnic_fcs.c b/drivers/scsi/fnic/fnic

RFC: reduce CONFIG_SCSI_CONSTANTS impact by 4k

2015-09-30 Thread Rasmus Villemoes
arrays in sync. $ scripts/bloat-o-meter /tmp/vmlinux vmlinux add/remove: 2/1 grow/shrink: 1/0 up/down: 7073/-11312 (-4239) Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> --- drivers/scsi/constants.c | 21 +++-- 1 file changed, 11 insertions(+), 10 deletions(-)

Re: [RFC PATCH 0/3] fix *pbl format support

2015-09-21 Thread Rasmus Villemoes
On Mon, Sep 21 2015, Maurizio Lombardi <mlomb...@redhat.com> wrote: > Hi Rasmus, > > On 09/16/2015 10:35 PM, Rasmus Villemoes wrote: >> >> I just remembered: I noticed a while ago that the qualifier member is >> only used inside format_decode (in t

[PATCH] scsi: megaraid_sas: Prevent future %p disaster

2015-02-06 Thread Rasmus Villemoes
spectacularly. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/scsi/megaraid/megaraid_sas_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index ff283d23788a..e7c6b9c946d6

[PATCH] scsi: 3w-xxxx: Drop duplicated function name

2015-02-06 Thread Rasmus Villemoes
Mentioning the enclosing function twice doesn't add value. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/scsi/3w-.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/3w-.c b/drivers/scsi/3w-.c index c75f2048319f..67539e73fdad

Re: [PATCH v2 0/6] scsi: Some seq_file cleanups/optimizations

2015-01-29 Thread Rasmus Villemoes
On Thu, Jan 29 2015, Finn Thain fth...@telegraphics.com.au wrote: I have one reservation about this patch series. For example, the changes, - seq_printf(m, %s, p); + seq_puts(m, p); These calls are not equivalent because the bounds check is not the same. seq_puts will fail when

Re: [PATCH v2 0/6] scsi: Some seq_file cleanups/optimizations

2015-01-21 Thread Rasmus Villemoes
On Wed, Dec 03 2014, Rasmus Villemoes li...@rasmusvillemoes.dk wrote: These patches mostly replace seq_printf with simpler and faster equivalents, e.g. seq_printf(m, something) = seq_puts(m, something) and seq_printf(m, \n) = seq_putc(m, '\n). But before my Coccinelle scripts could

[PATCH v2 6/6] scsi: misc: Print single-character strings with seq_putc

2014-12-02 Thread Rasmus Villemoes
Using seq_putc to print a single character saves at least a strlen() call and a memory access, and may also give a small .text reduction. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/scsi/NCR5380.c | 2 +- drivers/scsi/advansys.c | 34

[PATCH v2 4/6] scsi: misc: Replace seq_printf with seq_puts

2014-12-02 Thread Rasmus Villemoes
Using seq_printf to print a simple string is a lot more expensive than it needs to be, since seq_puts exists. Replace seq_printf with seq_puts when possible. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/scsi/BusLogic.c | 10 +- drivers/scsi/NCR5380.c

[PATCH v2 1/6] scsi: Remove SPRINTF macro

2014-12-02 Thread Rasmus Villemoes
The macro SPRINTF doesn't save a lot of typing or make the code more readable, and depending on a specific identifier (m) in the surrounding scope is generally frowned upon. Nuke it. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/scsi/NCR5380.c | 20 ++- drivers/scsi

[PATCH v2 5/6] scsi: misc: Merge consecutive seq_puts calls

2014-12-02 Thread Rasmus Villemoes
Consecutive seq_puts calls with literal strings may be replaced by a single call, saving a little .text. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/scsi/advansys.c | 43 +++ drivers/scsi/atp870u.c | 5 ++--- drivers

[PATCH v2 2/6] scsi/advansys: Replace seq_printf with seq_puts

2014-12-02 Thread Rasmus Villemoes
Using seq_printf to print a simple string is a lot more expensive than it needs to be, since seq_puts exists. Replace seq_printf with seq_puts when possible. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/scsi/advansys.c | 155

[PATCH 0/7] scsi: Some seq_file cleanups/optimizations

2014-11-28 Thread Rasmus Villemoes
obfuscating, macros. The patches don't change the semantics of the code (well, that's the idea anyway), but should make it slightly smaller and faster. Rasmus Villemoes (7): scsi: Remove SPRINTF macro scsi/g_NCR5380: Remove obfuscating macros scsi/advansys: Replace seq_printf with seq_puts scsi

[PATCH 1/7] scsi: Remove SPRINTF macro

2014-11-28 Thread Rasmus Villemoes
The macro SPRINTF doesn't save a lot of typing or make the code more readable, and depending on a specific identifier (m) in the surrounding scope is generally frowned upon. Nuke it. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/scsi/NCR5380.c | 42 +++--- drivers

[PATCH 7/7] scsi: misc: Print single-character strings with seq_putc

2014-11-28 Thread Rasmus Villemoes
Using seq_putc to print a single character saves at least a strlen() call and a memory access, and may also give a small .text reduction. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/scsi/NCR5380.c | 2 +- drivers/scsi/advansys.c | 34

[PATCH 6/7] scsi: misc: Merge consecutive seq_puts calls

2014-11-28 Thread Rasmus Villemoes
Consecutive seq_puts calls with literal strings may be replaced by a single call, saving a little .text. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/scsi/advansys.c | 40 ++-- drivers/scsi/atp870u.c | 5 ++--- drivers/scsi

[PATCH 5/7] scsi: misc: Replace seq_printf with seq_puts

2014-11-28 Thread Rasmus Villemoes
Using seq_printf to print a simple string is a lot more expensive than it needs to be, since seq_puts exists. Replace seq_printf with seq_puts when possible. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/scsi/BusLogic.c | 10 +- drivers/scsi/NCR5380.c

[PATCH 4/7] scsi/aha152x: Replace seq_printf with seq_puts

2014-11-28 Thread Rasmus Villemoes
Using seq_printf to print a simple string is a lot more expensive than it needs to be, since seq_puts exists. Replace seq_printf with seq_puts when possible. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/scsi/aha152x.c | 252

[PATCH 3/7] scsi/advansys: Replace seq_printf with seq_puts

2014-11-28 Thread Rasmus Villemoes
Using seq_printf to print a simple string is a lot more expensive than it needs to be, since seq_puts exists. Replace seq_printf with seq_puts when possible. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/scsi/advansys.c | 157

[PATCH 2/7] scsi/g_NCR5380: Remove obfuscating macros

2014-11-28 Thread Rasmus Villemoes
The macros PRINTP/ANDP make the code harder to read and depend on a specific identifier name in the surrounding scope. Nuke them. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/scsi/g_NCR5380.c | 66 ++-- 1 file changed, 30

[PATCH 13/22] scsi: Replace strnicmp with strncasecmp

2014-09-16 Thread Rasmus Villemoes
@vger.kernel.org Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/scsi/ips.c| 2 +- drivers/scsi/scsi_debug.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index 52a216f..e5afc38 100644 --- a/drivers/scsi/ips.c

[PATCH v2] drivers: scsi: #define missing include guards

2014-08-25 Thread Rasmus Villemoes
The four files aha1542.h, aha1740.h, gvp11.h and mvme147.h under drivers/scsi/ contain two-thirds of an include guard, but do not #define the macro. Add those #defines. git grep says the macro names are not defined elsewhere. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- For good

[PATCH] drivers: scsi: #define missing include guards

2014-08-22 Thread Rasmus Villemoes
The four files aha1542.h, aha1740.h, gvp11.h and mvme147.h under drivers/scsi/ contain two-thirds of an include guard, but do not elsewhere. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/scsi/aha1542.h | 1 + drivers/scsi/aha1740.h | 1 + drivers/scsi/gvp11.h | 1

[PATCH] drivers: target: target_core_ua_h: Add #define of include guard

2014-08-22 Thread Rasmus Villemoes
Clearly the file was meant to contain an include guard, but it was missing the #define part. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/target/target_core_ua.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/target/target_core_ua.h b/drivers/target

Re: [PATCH] drivers: scsi: #define missing include guards

2014-08-22 Thread Rasmus Villemoes
Rasmus Villemoes li...@rasmusvillemoes.dk writes: The four files aha1542.h, aha1740.h, gvp11.h and mvme147.h under drivers/scsi/ contain two-thirds of an include guard, but do not elsewhere. Argh, git commit ate a line because it happened to start with #. This was supposed to be something

Re: [PATCH] drivers: message: fusion: Simplify rounding

2014-08-06 Thread Rasmus Villemoes
Joe Lawrence joe.lawre...@stratus.com writes: On Tue, 1 Jul 2014, Rasmus Villemoes wrote: Rounding up to a multiple of 4 should be done using the ALIGN macro. As a bonus, this also makes the generated code smaller. In GetIocFacts(), sz is assigned to a few lines below without being read