Skip to content

Convert seq_<foo> output calls to return void

Joe Perches cgroups drbd-dev linux-arm-kernel linux-parisc linux-pm linux-s390 linux-tegra linux-watchdog lkml 1 version Applied

Status from this message: Applied, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest27 patches 22 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/27staging: lustre: Convert "return seq_printf(...)" usesdrivers/staging/lustre/lustre/libcfs/hash.c drivers/staging/lustre/lustre/llite/lproc_llite.c drivers/staging/lustre/lustre/lmv/lproc_lmv.c +6 more+163 -1150 replies
2/27staging: lustre: Convert seq_ hash functions to return voiddrivers/staging/lustre/include/linux/libcfs/libcfs_hash.h drivers/staging/lustre/lustre/libcfs/hash.c+6 -120 replies
3/27staging: lustre: Convert uses of "int rc = seq_printf(...)"drivers/staging/lustre/lustre/fid/lproc_fid.c drivers/staging/lustre/lustre/llite/lproc_llite.c drivers/staging/lustre/lustre/mdc/lproc_mdc.c +3 more+79 -872 replies
4/27staging: lustre: Convert remaining uses of "= seq_printf(...)"drivers/staging/lustre/lustre/llite/lproc_llite.c drivers/staging/lustre/lustre/obdclass/lprocfs_status.c+54 -520 replies
5/27x86: mtrr: if: Remove use of seq_printf return valuearch/x86/kernel/cpu/mtrr/if.c+5 -70 replies
6/27power: wakeup: Remove use of seq_printf return valuedrivers/base/power/wakeup.c+7 -93 replies
7/27ipmi: Remove use of seq_printf return valuedrivers/char/ipmi/ipmi_msghandler.c drivers/char/ipmi/ipmi_si_intf.c drivers/char/ipmi/ipmi_ssif.c+26 -162 replies
8/27rtc: Remove use of seq_printf return valuedrivers/rtc/rtc-cmos.c drivers/rtc/rtc-ds1305.c drivers/rtc/rtc-mrst.c +1 more+34 -280 replies
9/27ipc: Remove use of seq_printf return valueipc/msg.c ipc/sem.c ipc/shm.c +1 more+58 -500 replies
10/27pxa27x_udc: Remove use of seq_printf return valuedrivers/usb/gadget/udc/pxa27x_udc.c+60 -721 reply
11/27microblaze: mb: Remove use of seq_printf return valuearch/microblaze/kernel/cpu/mb.c+73 -761 reply
12/27nios2: cpuinfo: Remove use of seq_printf return valuearch/nios2/kernel/cpuinfo.c+38 -390 replies
13/27ARM: plat-pxa: Remove use of seq_printf return valuearch/arm/plat-pxa/dma.c+53 -580 replies
14/27openrisc: Remove use of seq_printf return valuearch/openrisc/kernel/setup.c+26 -240 replies
15/27cris: Remove use of seq_printf return valuearch/cris/arch-v10/kernel/setup.c arch/cris/arch-v32/kernel/setup.c+62 -580 replies
16/27mfd: ab8500-debugfs: Remove use of seq_printf return valuedrivers/mfd/ab8500-debugfs.c+121 -751 reply
17/27staging: i2o: Remove use of seq_printf return valuedrivers/staging/i2o/i2o_proc.c+12 -60 replies
18/27staging: rtl8192x: Remove use of seq_printf return valuedrivers/staging/rtl8192e/rtllib_module.c drivers/staging/rtl8192u/ieee80211/ieee80211_module.c+6 -20 replies
19/27s390: Remove use of seq_printf return valuearch/s390/pci/pci_debug.c drivers/s390/cio/blacklist.c+11 -71 reply
20/27i8k: Remove use of seq_printf return valuedrivers/char/i8k.c+9 -71 reply
21/27watchdog: bcm281xx: Remove use of seq_printf return valuedrivers/watchdog/bcm_kona_wdt.c+16 -112 replies
22/27proc: Remove use of seq_printf return valuefs/proc/array.c fs/proc/base.c+50 -360 replies
23/27cgroup: Remove use of seq_printf return valuekernel/cgroup.c+3 -11 reply
24/27tracing: Remove use of seq_printf return valuekernel/trace/trace_stack.c+2 -25 replies
25/27lru_cache: Remove use of seq_printf return valuelib/lru_cache.c+5 -40 replies
26/27parisc: Remove use of seq_printf return valuedrivers/parisc/ccio-dma.c drivers/parisc/sba_iommu.c+68 -720 replies
27/27regulator: dbx500: Remove use of seq_puts/seq_printf return valuedrivers/regulator/dbx500-prcmu.c+9 -233 replies

Reviews trailers per patch

5 of 27 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchSteven RostedtGuenter RoeckRobert JarzmikSebastian OttTejun HeoJesper NilssonMichal Simek
SeriesA-b
1/27
2/27
3/27
4/27
5/27
6/27
7/27
8/27
9/27
10/27T-b
11/27A-b
12/27
13/27
14/27
15/27
16/27
17/27
18/27
19/27A-b
20/27A-b
21/27
22/27
23/27A-b
24/27A-b
25/27
26/27
27/27

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 7 reviewers.

Read the v1 thread

Cover letter [PATCH 00/27] Convert seq_<foo> output calls to return void

As Al Viro said:

we are getting well-meaning folks who try to check that return value,
again and again, getting it wrong every time. Typical idiocies:
* return some kind of error out of ->show() on overflows. Pointless
*and* wrong - only hard errors (== fail read(2) with that) should be reported that way; the caller does detect overflow and retires with bigger buffer just fine.
* keep checking it after every sodding call of seq_...(), screwing
the cleanups up more often than not. Pointless, unless you are doing some seriously expensive calculations to produce something you are going to print. seq_...() are no-ops in case when overflow has already happened.

seq_has_overflowed() is only for situations when you really want to skip a serious amount of work generating the data that would end up being discarded and recalculated again when the caller grabs a bigger buffer and calls you again. And more often than not it's an indication of ->show() trying to do the work of iterator - e.g. when you have single_open() with ->show() printing the entire hash table of some sort all in one record.

Most of the time checking return value of seq_...() is better replaced with not doing that. And "must check return value and Do Something(tm)" is too strong habit for enough people to cause recurring trouble.

Joe Perches (27):
staging: lustre: Convert "return seq_printf(...)" uses
staging: lustre: Convert seq_ hash functions to return void
staging: lustre: Convert uses of "int rc = seq_printf(...)"
staging: lustre: Convert remaining uses of "= seq_printf(...)"
x86: mtrr: if: Remove use of seq_printf return value
power: wakeup: Remove use of seq_printf return value
ipmi: Remove use of seq_printf return value
rtc: Remove use of seq_printf return value
ipc: Remove use of seq_printf return value
pxa27x_udc: Remove use of seq_printf return value
microblaze: mb: Remove use of seq_printf return value
nios2: cpuinfo: Remove use of seq_printf return value
ARM: plat-pxa: Remove use of seq_printf return value
openrisc: Remove use of seq_printf return value
cris: Remove use of seq_printf return value
mfd: ab8500-debugfs: Remove use of seq_printf return value
staging: i2o: Remove use of seq_printf return value
staging: rtl8192x: Remove use of seq_printf return value
s390: Remove use of seq_printf return value
i8k: Remove use of seq_printf return value
watchdog: bcm281xx: Remove use of seq_printf return value
proc: Remove use of seq_printf return value
cgroup: Remove use of seq_printf return value
tracing: Remove use of seq_printf return value
lru_cache: Remove use of seq_printf return value
parisc: Remove use of seq_printf return value
regulator: dbx500: Remove use of seq_puts/seq_printf return value

 arch/arm/plat-pxa/dma.c                            | 111 ++++++------
 arch/cris/arch-v10/kernel/setup.c                  |  58 +++---
 arch/cris/arch-v32/kernel/setup.c                  |  62 +++----
 arch/microblaze/kernel/cpu/mb.c                    | 149 ++++++++--------
 arch/nios2/kernel/cpuinfo.c                        |  77 ++++----
 arch/openrisc/kernel/setup.c                       |  50 +++---
 arch/s390/pci/pci_debug.c                          |   6 +-
 arch/x86/kernel/cpu/mtrr/if.c                      |  12 +-
 drivers/base/power/wakeup.c                        |  16 +-
 drivers/char/i8k.c                                 |  16 +-
 drivers/char/ipmi/ipmi_msghandler.c                |  12 +-
 drivers/char/ipmi/ipmi_si_intf.c                   |  26 +--
 drivers/char/ipmi/ipmi_ssif.c                      |   4 +-
 drivers/mfd/ab8500-debugfs.c                       | 196 +++++++++++++--------
 drivers/parisc/ccio-dma.c                          |  54 +++---
 drivers/parisc/sba_iommu.c                         |  86 +++++----
 drivers/regulator/dbx500-prcmu.c                   |  32 +---
 drivers/rtc/rtc-cmos.c                             |  36 ++--
 drivers/rtc/rtc-ds1305.c                           |   6 +-
 drivers/rtc/rtc-mrst.c                             |  16 +-
 drivers/rtc/rtc-tegra.c                            |   4 +-
 drivers/s390/cio/blacklist.c                       |  12 +-
 drivers/staging/i2o/i2o_proc.c                     |  18 +-
 .../lustre/include/linux/libcfs/libcfs_hash.h      |   4 +-
 drivers/staging/lustre/lustre/fid/lproc_fid.c      |  23 ++-
 drivers/staging/lustre/lustre/libcfs/hash.c        |  13 +-
 drivers/staging/lustre/lustre/llite/lproc_llite.c  | 117 ++++++------
 drivers/staging/lustre/lustre/lmv/lproc_lmv.c      |  18 +-
 drivers/staging/lustre/lustre/lov/lproc_lov.c      |  30 ++--
 drivers/staging/lustre/lustre/mdc/lproc_mdc.c      |   6 +-
 .../lustre/lustre/obdclass/linux/linux-module.c    |  38 ++--
 .../lustre/lustre/obdclass/lprocfs_status.c        | 108 ++++++------
 drivers/staging/lustre/lustre/obdclass/lu_object.c |  25 +--
 drivers/staging/lustre/lustre/osc/lproc_osc.c      |  67 +++----
 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c    |  25 +--
 drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c    |  82 +++++----
 drivers/staging/rtl8192e/rtllib_module.c           |   4 +-
 .../staging/rtl8192u/ieee80211/ieee80211_module.c  |   4 +-
 drivers/usb/gadget/udc/pxa27x_udc.c                | 132 +++++++-------
 drivers/watchdog/bcm_kona_wdt.c                    |  27 +--
 fs/proc/array.c                                    |   4 +-
 fs/proc/base.c                                     |  82 +++++----
 ipc/msg.c                                          |  34 ++--
 ipc/sem.c                                          |  26 +--
 ipc/shm.c                                          |  42 ++---
 ipc/util.c                                         |   6 +-
 kernel/cgroup.c                                    |   4 +-
 kernel/trace/trace_stack.c                         |   4 +-
 lib/lru_cache.c                                    |   9 +-
 49 files changed, 1050 insertions(+), 943 deletions(-)
Signature · 1 line
2.1.2