Skip to content

introduce skip_spaces(), reducing code size plus some clean-ups

André Goddard Rosa lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest12 patches 2 repliesIn review
  2. v4 posting 2/20 of 12 patches 0 repliesSuperseded
  3. v4 posting 1/212 patches 24 repliesSuperseded

Changelog from the cover letter

v5: addressed comments and feedback from many people: Jan Engelhardt,
James Bottomley, Rusty Russell, Alan Cox, Henrique de Moraes Holschuh, Theodore Tso and Julia Lawall (thanks!)
v4: converted drivers over newly defined skip_spaces() function
v3: improved comments on patch 5/7 and factorize a switch statement on 6/7
as per suggestions from Ingo and Frederic (thanks!)
v2: addressed feedback from Frederic Weisbecker review (thanks!)
and split into separate patches
v1: original submission

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12vsprintf: factorize "(null)" stringlib/vsprintf.c+3 -30 replies
2/12vsprintf: pre-calculate final string length for later uselib/vsprintf.c+5 -40 replies
3/12vsprintf: give it some care to please checkpatch.pllib/vsprintf.c+99 -870 replies
4/12vsprintf: use TOLOWER whenever possiblelib/vsprintf.c+7 -80 replies
5/12vsprintf: reduce code size by avoiding extra checklib/vsprintf.c+2 -10 replies
6/12vsprintf: move local vars to block local vars and remove unneeded oneslib/vsprintf.c+28 -360 replies
7/12vsprintf: factor out skip_space code in a separate functionlib/vsprintf.c+11 -80 replies
8/12vsprintf: reuse almost identical simple_strtoulX() functionslib/vsprintf.c+14 -340 replies
9/12ctype: constify read-only _ctype stringinclude/linux/ctype.h lib/ctype.c+26 -260 replies
10/12string: factorize skip_spaces and export it to be generally availableinclude/linux/ctype.h include/linux/string.h lib/string.c+17 -41 reply
11/12string: on strstrip(), first remove leading spaces before running over strlib/string.c+2 -20 replies
12/12tree-wide: convert open calls to remove spaces to skip_spaces() lib functionarch/s390/kernel/debug.c arch/um/drivers/mconsole_kern.c arch/x86/kernel/cpu/mtrr/if.c +21 more+66 -1151 reply

Reviews trailers per patch

8 of 12 patches have a Reviewed-by or Acked-by.

PatchFrederic WeisbeckerHenrique de Moraes Holschuh
1/12A-b
2/12A-b
3/12A-b
4/12A-b
5/12A-b
6/12A-b
7/12A-b
8/12
9/12
10/12
11/12
12/12A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH v5 00/12] introduce skip_spaces(), reducing code size plus some clean-ups

This patch reduces lib/lib.a code size by 482 bytes on my Core 2 with gcc 4.4.1 even considering that it exports a newly defined function skip_spaces() to drivers:

   text    data     bss     dec     hex filename
  64867     840     592   66299   102fb (TOTALS-lib.a-BEFORE)
  64641     584     592   65817   10119 (TOTALS-lib.a-AFTER)

and implements some code tidy up.

Besides reducing lib.a size, it converts many in-tree drivers to use the newly defined function, which makes another small reduction on kernel size overall when those drivers are used.

Changelog:
v5: addressed comments and feedback from many people: Jan Engelhardt,
James Bottomley, Rusty Russell, Alan Cox, Henrique de Moraes Holschuh, Theodore Tso and Julia Lawall (thanks!)
v4: converted drivers over newly defined skip_spaces() function
v3: improved comments on patch 5/7 and factorize a switch statement on 6/7
as per suggestions from Ingo and Frederic (thanks!)
v2: addressed feedback from Frederic Weisbecker review (thanks!)
and split into separate patches
v1: original submission

André Goddard Rosa (12):
vsprintf: factorize "(null)" string
vsprintf: pre-calculate final string length for later use
vsprintf: give it some care to please checkpatch.pl
vsprintf: use TOLOWER whenever possible
vsprintf: reduce code size by avoiding extra check
vsprintf: move local vars to block local vars and remove unneeded
ones
vsprintf: factor out skip_space code in a separate function
vsprintf: reuse almost identical simple_strtoulX() functions
ctype: constify read-only _ctype string
string: factorize skip_spaces and export it to be generally available
string: on strstrip(), first remove leading spaces before running
over str
tree-wide: convert open calls to remove spaces to skip_spaces() lib
function

 arch/s390/kernel/debug.c              |    3 +-
 arch/um/drivers/mconsole_kern.c       |   16 +-
 arch/x86/kernel/cpu/mtrr/if.c         |   11 +-
 drivers/leds/led-class.c              |    2 +-
 drivers/leds/ledtrig-timer.c          |    4 +-
 drivers/md/dm-table.c                 |    6 +-
 drivers/md/md.c                       |    4 +-
 drivers/parisc/pdc_stable.c           |    9 +-
 drivers/platform/x86/thinkpad_acpi.c  |    7 +-
 drivers/pnp/interface.c               |   36 +---
 drivers/s390/block/dasd_proc.c        |    5 +-
 drivers/video/backlight/lcd.c         |    4 +-
 drivers/video/display/display-sysfs.c |    2 +-
 drivers/video/output.c                |    2 +-
 fs/cachefiles/daemon.c                |    4 +-
 fs/ext4/super.c                       |    7 +-
 include/linux/ctype.h                 |    3 +-
 include/linux/string.h                |    1 +
 kernel/params.c                       |    8 +-
 lib/argv_split.c                      |   13 +-
 lib/ctype.c                           |   50 +++---
 lib/dynamic_debug.c                   |    4 +-
 lib/string.c                          |   19 ++-
 lib/vsprintf.c                        |  337 ++++++++++++++++-----------------
 net/irda/irnet/irnet.h                |    1 +
 net/irda/irnet/irnet_ppp.c            |    8 +-
 net/netfilter/xt_recent.c             |    3 +-
 sound/pci/hda/hda_hwdep.c             |    7 +-
 28 files changed, 264 insertions(+), 312 deletions(-)