2015-02-22 02:54:34

by Joe Perches

[permalink] [raw]
Subject: [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(-)

--
2.1.2


2015-02-22 02:54:41

by Joe Perches

[permalink] [raw]
Subject: [PATCH 01/27] staging: lustre: Convert "return seq_printf(...)" uses

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Convert these "return seq_printf(...)" uses to:

seq_printf(seq, ...);
return 0;

Done via cocci script:

@@
struct seq_file *seq;
@@

- return
\(seq_printf\|seq_puts\|seq_putc\)(seq,
...);

+ return 0;

With some additional reformatting and typing post conversion.

Miscellanea:

o convert an rc++ use to a bool
o use seq_puts with fixed strings where appropriate

Signed-off-by: Joe Perches <[email protected]>
---
drivers/staging/lustre/lustre/libcfs/hash.c | 11 +--
drivers/staging/lustre/lustre/llite/lproc_llite.c | 88 ++++++++++++----------
drivers/staging/lustre/lustre/lmv/lproc_lmv.c | 18 +++--
drivers/staging/lustre/lustre/lov/lproc_lov.c | 30 +++++---
.../lustre/lustre/obdclass/linux/linux-module.c | 38 ++++++----
.../lustre/lustre/obdclass/lprocfs_status.c | 26 ++++---
drivers/staging/lustre/lustre/obdclass/lu_object.c | 25 +++---
drivers/staging/lustre/lustre/osc/lproc_osc.c | 22 +++---
.../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 20 +++--
9 files changed, 163 insertions(+), 115 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c
index ec3a2a8..7c74073 100644
--- a/drivers/staging/lustre/lustre/libcfs/hash.c
+++ b/drivers/staging/lustre/lustre/libcfs/hash.c
@@ -2010,11 +2010,12 @@ EXPORT_SYMBOL(cfs_hash_rehash_key);

int cfs_hash_debug_header(struct seq_file *m)
{
- return seq_printf(m, "%-*s%6s%6s%6s%6s%6s%6s%6s%7s%8s%8s%8s%s\n",
- CFS_HASH_BIGNAME_LEN,
- "name", "cur", "min", "max", "theta", "t-min", "t-max",
- "flags", "rehash", "count", "maxdep", "maxdepb",
- " distribution");
+ seq_printf(m, "%-*s%6s%6s%6s%6s%6s%6s%6s%7s%8s%8s%8s%s\n",
+ CFS_HASH_BIGNAME_LEN,
+ "name", "cur", "min", "max", "theta", "t-min", "t-max",
+ "flags", "rehash", "count", "maxdep", "maxdepb",
+ " distribution");
+ return 0;
}
EXPORT_SYMBOL(cfs_hash_debug_header);

diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c
index aaa13bd..4ec0ef9 100644
--- a/drivers/staging/lustre/lustre/llite/lproc_llite.c
+++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c
@@ -187,7 +187,8 @@ static int ll_fstype_seq_show(struct seq_file *m, void *v)
struct super_block *sb = (struct super_block *)m->private;

LASSERT(sb != NULL);
- return seq_printf(m, "%s\n", sb->s_type->name);
+ seq_printf(m, "%s\n", sb->s_type->name);
+ return 0;
}
LPROC_SEQ_FOPS_RO(ll_fstype);

@@ -196,7 +197,8 @@ static int ll_sb_uuid_seq_show(struct seq_file *m, void *v)
struct super_block *sb = (struct super_block *)m->private;

LASSERT(sb != NULL);
- return seq_printf(m, "%s\n", ll_s2sbi(sb)->ll_sb_uuid.uuid);
+ seq_printf(m, "%s\n", ll_s2sbi(sb)->ll_sb_uuid.uuid);
+ return 0;
}
LPROC_SEQ_FOPS_RO(ll_sb_uuid);

@@ -353,17 +355,18 @@ static int ll_max_cached_mb_seq_show(struct seq_file *m, void *v)

max_cached_mb = cache->ccc_lru_max >> shift;
unused_mb = atomic_read(&cache->ccc_lru_left) >> shift;
- return seq_printf(m,
- "users: %d\n"
- "max_cached_mb: %d\n"
- "used_mb: %d\n"
- "unused_mb: %d\n"
- "reclaim_count: %u\n",
- atomic_read(&cache->ccc_users),
- max_cached_mb,
- max_cached_mb - unused_mb,
- unused_mb,
- cache->ccc_lru_shrinkers);
+ seq_printf(m,
+ "users: %d\n"
+ "max_cached_mb: %d\n"
+ "used_mb: %d\n"
+ "unused_mb: %d\n"
+ "reclaim_count: %u\n",
+ atomic_read(&cache->ccc_users),
+ max_cached_mb,
+ max_cached_mb - unused_mb,
+ unused_mb,
+ cache->ccc_lru_shrinkers);
+ return 0;
}

static ssize_t ll_max_cached_mb_seq_write(struct file *file,
@@ -467,7 +470,8 @@ static int ll_checksum_seq_show(struct seq_file *m, void *v)
struct super_block *sb = m->private;
struct ll_sb_info *sbi = ll_s2sbi(sb);

- return seq_printf(m, "%u\n", (sbi->ll_flags & LL_SBI_CHECKSUM) ? 1 : 0);
+ seq_printf(m, "%u\n", (sbi->ll_flags & LL_SBI_CHECKSUM) ? 1 : 0);
+ return 0;
}

static ssize_t ll_checksum_seq_write(struct file *file,
@@ -503,7 +507,8 @@ static int ll_max_rw_chunk_seq_show(struct seq_file *m, void *v)
{
struct super_block *sb = m->private;

- return seq_printf(m, "%lu\n", ll_s2sbi(sb)->ll_max_rw_chunk);
+ seq_printf(m, "%lu\n", ll_s2sbi(sb)->ll_max_rw_chunk);
+ return 0;
}

static ssize_t ll_max_rw_chunk_seq_write(struct file *file,
@@ -525,15 +530,14 @@ static int ll_rd_track_id(struct seq_file *m, enum stats_track_type type)
{
struct super_block *sb = m->private;

- if (ll_s2sbi(sb)->ll_stats_track_type == type) {
- return seq_printf(m, "%d\n",
- ll_s2sbi(sb)->ll_stats_track_id);
+ if (ll_s2sbi(sb)->ll_stats_track_type == type)
+ seq_printf(m, "%d\n", ll_s2sbi(sb)->ll_stats_track_id);
+ else if (ll_s2sbi(sb)->ll_stats_track_type == STATS_TRACK_ALL)
+ seq_puts(m, "0 (all)\n");
+ else
+ seq_puts(m, "untracked\n");

- } else if (ll_s2sbi(sb)->ll_stats_track_type == STATS_TRACK_ALL) {
- return seq_printf(m, "0 (all)\n");
- } else {
- return seq_printf(m, "untracked\n");
- }
+ return 0;
}

static int ll_wr_track_id(const char __user *buffer, unsigned long count,
@@ -601,7 +605,8 @@ static int ll_statahead_max_seq_show(struct seq_file *m, void *v)
struct super_block *sb = m->private;
struct ll_sb_info *sbi = ll_s2sbi(sb);

- return seq_printf(m, "%u\n", sbi->ll_sa_max);
+ seq_printf(m, "%u\n", sbi->ll_sa_max);
+ return 0;
}

static ssize_t ll_statahead_max_seq_write(struct file *file,
@@ -631,8 +636,8 @@ static int ll_statahead_agl_seq_show(struct seq_file *m, void *v)
struct super_block *sb = m->private;
struct ll_sb_info *sbi = ll_s2sbi(sb);

- return seq_printf(m, "%u\n",
- sbi->ll_flags & LL_SBI_AGL_ENABLED ? 1 : 0);
+ seq_printf(m, "%u\n", sbi->ll_flags & LL_SBI_AGL_ENABLED ? 1 : 0);
+ return 0;
}

static ssize_t ll_statahead_agl_seq_write(struct file *file,
@@ -661,13 +666,14 @@ static int ll_statahead_stats_seq_show(struct seq_file *m, void *v)
struct super_block *sb = m->private;
struct ll_sb_info *sbi = ll_s2sbi(sb);

- return seq_printf(m,
- "statahead total: %u\n"
- "statahead wrong: %u\n"
- "agl total: %u\n",
- atomic_read(&sbi->ll_sa_total),
- atomic_read(&sbi->ll_sa_wrong),
- atomic_read(&sbi->ll_agl_total));
+ seq_printf(m,
+ "statahead total: %u\n"
+ "statahead wrong: %u\n"
+ "agl total: %u\n",
+ atomic_read(&sbi->ll_sa_total),
+ atomic_read(&sbi->ll_sa_wrong),
+ atomic_read(&sbi->ll_agl_total));
+ return 0;
}
LPROC_SEQ_FOPS_RO(ll_statahead_stats);

@@ -676,8 +682,8 @@ static int ll_lazystatfs_seq_show(struct seq_file *m, void *v)
struct super_block *sb = m->private;
struct ll_sb_info *sbi = ll_s2sbi(sb);

- return seq_printf(m, "%u\n",
- (sbi->ll_flags & LL_SBI_LAZYSTATFS) ? 1 : 0);
+ seq_printf(m, "%u\n", sbi->ll_flags & LL_SBI_LAZYSTATFS ? 1 : 0);
+ return 0;
}

static ssize_t ll_lazystatfs_seq_write(struct file *file,
@@ -712,7 +718,8 @@ static int ll_max_easize_seq_show(struct seq_file *m, void *v)
if (rc)
return rc;

- return seq_printf(m, "%u\n", ealen);
+ seq_printf(m, "%u\n", ealen);
+ return 0;
}
LPROC_SEQ_FOPS_RO(ll_max_easize);

@@ -727,7 +734,8 @@ static int ll_defult_easize_seq_show(struct seq_file *m, void *v)
if (rc)
return rc;

- return seq_printf(m, "%u\n", ealen);
+ seq_printf(m, "%u\n", ealen);
+ return 0;
}
LPROC_SEQ_FOPS_RO(ll_defult_easize);

@@ -742,7 +750,8 @@ static int ll_max_cookiesize_seq_show(struct seq_file *m, void *v)
if (rc)
return rc;

- return seq_printf(m, "%u\n", cookielen);
+ seq_printf(m, "%u\n", cookielen);
+ return 0;
}
LPROC_SEQ_FOPS_RO(ll_max_cookiesize);

@@ -757,7 +766,8 @@ static int ll_defult_cookiesize_seq_show(struct seq_file *m, void *v)
if (rc)
return rc;

- return seq_printf(m, "%u\n", cookielen);
+ seq_printf(m, "%u\n", cookielen);
+ return 0;
}
LPROC_SEQ_FOPS_RO(ll_defult_cookiesize);

diff --git a/drivers/staging/lustre/lustre/lmv/lproc_lmv.c b/drivers/staging/lustre/lustre/lmv/lproc_lmv.c
index 5be4176..d5bc0fb 100644
--- a/drivers/staging/lustre/lustre/lmv/lproc_lmv.c
+++ b/drivers/staging/lustre/lustre/lmv/lproc_lmv.c
@@ -48,7 +48,8 @@ static int lmv_numobd_seq_show(struct seq_file *m, void *v)

LASSERT(dev != NULL);
desc = &dev->u.lmv.desc;
- return seq_printf(m, "%u\n", desc->ld_tgt_count);
+ seq_printf(m, "%u\n", desc->ld_tgt_count);
+ return 0;
}
LPROC_SEQ_FOPS_RO(lmv_numobd);

@@ -82,7 +83,8 @@ static int lmv_placement_seq_show(struct seq_file *m, void *v)

LASSERT(dev != NULL);
lmv = &dev->u.lmv;
- return seq_printf(m, "%s\n", placement_policy2name(lmv->lmv_placement));
+ seq_printf(m, "%s\n", placement_policy2name(lmv->lmv_placement));
+ return 0;
}

#define MAX_POLICY_STRING_SIZE 64
@@ -130,7 +132,8 @@ static int lmv_activeobd_seq_show(struct seq_file *m, void *v)

LASSERT(dev != NULL);
desc = &dev->u.lmv.desc;
- return seq_printf(m, "%u\n", desc->ld_active_tgt_count);
+ seq_printf(m, "%u\n", desc->ld_active_tgt_count);
+ return 0;
}
LPROC_SEQ_FOPS_RO(lmv_activeobd);

@@ -141,7 +144,8 @@ static int lmv_desc_uuid_seq_show(struct seq_file *m, void *v)

LASSERT(dev != NULL);
lmv = &dev->u.lmv;
- return seq_printf(m, "%s\n", lmv->desc.ld_uuid.uuid);
+ seq_printf(m, "%s\n", lmv->desc.ld_uuid.uuid);
+ return 0;
}
LPROC_SEQ_FOPS_RO(lmv_desc_uuid);

@@ -171,8 +175,10 @@ static int lmv_tgt_seq_show(struct seq_file *p, void *v)

if (tgt == NULL)
return 0;
- return seq_printf(p, "%d: %s %sACTIVE\n", tgt->ltd_idx,
- tgt->ltd_uuid.uuid, tgt->ltd_active ? "" : "IN");
+ seq_printf(p, "%d: %s %sACTIVE\n",
+ tgt->ltd_idx, tgt->ltd_uuid.uuid,
+ tgt->ltd_active ? "" : "IN");
+ return 0;
}

static struct seq_operations lmv_tgt_sops = {
diff --git a/drivers/staging/lustre/lustre/lov/lproc_lov.c b/drivers/staging/lustre/lustre/lov/lproc_lov.c
index c99f2f4..8842031 100644
--- a/drivers/staging/lustre/lustre/lov/lproc_lov.c
+++ b/drivers/staging/lustre/lustre/lov/lproc_lov.c
@@ -48,7 +48,8 @@ static int lov_stripesize_seq_show(struct seq_file *m, void *v)

LASSERT(dev != NULL);
desc = &dev->u.lov.desc;
- return seq_printf(m, "%llu\n", desc->ld_default_stripe_size);
+ seq_printf(m, "%llu\n", desc->ld_default_stripe_size);
+ return 0;
}

static ssize_t lov_stripesize_seq_write(struct file *file,
@@ -79,7 +80,8 @@ static int lov_stripeoffset_seq_show(struct seq_file *m, void *v)

LASSERT(dev != NULL);
desc = &dev->u.lov.desc;
- return seq_printf(m, "%llu\n", desc->ld_default_stripe_offset);
+ seq_printf(m, "%llu\n", desc->ld_default_stripe_offset);
+ return 0;
}

static ssize_t lov_stripeoffset_seq_write(struct file *file,
@@ -109,7 +111,8 @@ static int lov_stripetype_seq_show(struct seq_file *m, void *v)

LASSERT(dev != NULL);
desc = &dev->u.lov.desc;
- return seq_printf(m, "%u\n", desc->ld_pattern);
+ seq_printf(m, "%u\n", desc->ld_pattern);
+ return 0;
}

static ssize_t lov_stripetype_seq_write(struct file *file,
@@ -139,8 +142,8 @@ static int lov_stripecount_seq_show(struct seq_file *m, void *v)

LASSERT(dev != NULL);
desc = &dev->u.lov.desc;
- return seq_printf(m, "%d\n",
- (__s16)(desc->ld_default_stripe_count + 1) - 1);
+ seq_printf(m, "%d\n", (__s16)(desc->ld_default_stripe_count + 1) - 1);
+ return 0;
}

static ssize_t lov_stripecount_seq_write(struct file *file,
@@ -170,7 +173,8 @@ static int lov_numobd_seq_show(struct seq_file *m, void *v)

LASSERT(dev != NULL);
desc = &dev->u.lov.desc;
- return seq_printf(m, "%u\n", desc->ld_tgt_count);
+ seq_printf(m, "%u\n", desc->ld_tgt_count);
+ return 0;
}
LPROC_SEQ_FOPS_RO(lov_numobd);

@@ -181,7 +185,8 @@ static int lov_activeobd_seq_show(struct seq_file *m, void *v)

LASSERT(dev != NULL);
desc = &dev->u.lov.desc;
- return seq_printf(m, "%u\n", desc->ld_active_tgt_count);
+ seq_printf(m, "%u\n", desc->ld_active_tgt_count);
+ return 0;
}
LPROC_SEQ_FOPS_RO(lov_activeobd);

@@ -192,7 +197,8 @@ static int lov_desc_uuid_seq_show(struct seq_file *m, void *v)

LASSERT(dev != NULL);
lov = &dev->u.lov;
- return seq_printf(m, "%s\n", lov->desc.ld_uuid.uuid);
+ seq_printf(m, "%s\n", lov->desc.ld_uuid.uuid);
+ return 0;
}
LPROC_SEQ_FOPS_RO(lov_desc_uuid);

@@ -228,9 +234,11 @@ static void *lov_tgt_seq_next(struct seq_file *p, void *v, loff_t *pos)
static int lov_tgt_seq_show(struct seq_file *p, void *v)
{
struct lov_tgt_desc *tgt = v;
- return seq_printf(p, "%d: %s %sACTIVE\n", tgt->ltd_index,
- obd_uuid2str(&tgt->ltd_uuid),
- tgt->ltd_active ? "" : "IN");
+
+ seq_printf(p, "%d: %s %sACTIVE\n",
+ tgt->ltd_index, obd_uuid2str(&tgt->ltd_uuid),
+ tgt->ltd_active ? "" : "IN");
+ return 0;
}

struct seq_operations lov_tgt_sops = {
diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
index b94aeac..75e704d 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
@@ -219,21 +219,23 @@ struct miscdevice obd_psdev = {
#if defined (CONFIG_PROC_FS)
int obd_proc_version_seq_show(struct seq_file *m, void *v)
{
- return seq_printf(m, "lustre: %s\nkernel: %s\nbuild: %s\n",
- LUSTRE_VERSION_STRING, "patchless_client",
- BUILD_VERSION);
+ seq_printf(m, "lustre: %s\nkernel: %s\nbuild: %s\n",
+ LUSTRE_VERSION_STRING, "patchless_client", BUILD_VERSION);
+ return 0;
}
LPROC_SEQ_FOPS_RO(obd_proc_version);

int obd_proc_pinger_seq_show(struct seq_file *m, void *v)
{
- return seq_printf(m, "%s\n", "on");
+ seq_printf(m, "%s\n", "on");
+ return 0;
}
LPROC_SEQ_FOPS_RO(obd_proc_pinger);

static int obd_proc_health_seq_show(struct seq_file *m, void *v)
{
- int rc = 0, i;
+ bool healthy = true;
+ int i;

if (libcfs_catastrophe)
seq_printf(m, "LBUG\n");
@@ -255,25 +257,27 @@ static int obd_proc_health_seq_show(struct seq_file *m, void *v)

if (obd_health_check(NULL, obd)) {
seq_printf(m, "device %s reported unhealthy\n",
- obd->obd_name);
- rc++;
+ obd->obd_name);
+ healthy = false;
}
class_decref(obd, __func__, current);
read_lock(&obd_dev_lock);
}
read_unlock(&obd_dev_lock);

- if (rc == 0)
- return seq_printf(m, "healthy\n");
+ if (healthy)
+ seq_puts(m, "healthy\n");
+ else
+ seq_puts(m, "NOT HEALTHY\n");

- seq_printf(m, "NOT HEALTHY\n");
return 0;
}
LPROC_SEQ_FOPS_RO(obd_proc_health);

static int obd_proc_jobid_var_seq_show(struct seq_file *m, void *v)
{
- return seq_printf(m, "%s\n", obd_jobid_var);
+ seq_printf(m, "%s\n", obd_jobid_var);
+ return 0;
}

static ssize_t obd_proc_jobid_var_seq_write(struct file *file,
@@ -299,7 +303,8 @@ LPROC_SEQ_FOPS(obd_proc_jobid_var);

static int obd_proc_jobid_name_seq_show(struct seq_file *m, void *v)
{
- return seq_printf(m, "%s\n", obd_jobid_var);
+ seq_printf(m, "%s\n", obd_jobid_var);
+ return 0;
}

static ssize_t obd_proc_jobid_name_seq_write(struct file *file,
@@ -378,10 +383,11 @@ static int obd_device_list_seq_show(struct seq_file *p, void *v)
else
status = "--";

- return seq_printf(p, "%3d %s %s %s %s %d\n",
- (int)index, status, obd->obd_type->typ_name,
- obd->obd_name, obd->obd_uuid.uuid,
- atomic_read(&obd->obd_refcount));
+ seq_printf(p, "%3d %s %s %s %s %d\n",
+ (int)index, status, obd->obd_type->typ_name,
+ obd->obd_name, obd->obd_uuid.uuid,
+ atomic_read(&obd->obd_refcount));
+ return 0;
}

struct seq_operations obd_device_list_sops = {
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index ddab94d..25f01cb 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -377,7 +377,8 @@ EXPORT_SYMBOL(lprocfs_register);
/* Generic callbacks */
int lprocfs_rd_uint(struct seq_file *m, void *data)
{
- return seq_printf(m, "%u\n", *(unsigned int *)data);
+ seq_printf(m, "%u\n", *(unsigned int *)data);
+ return 0;
}
EXPORT_SYMBOL(lprocfs_rd_uint);

@@ -403,7 +404,8 @@ EXPORT_SYMBOL(lprocfs_wr_uint);

int lprocfs_rd_u64(struct seq_file *m, void *data)
{
- return seq_printf(m, "%llu\n", *(__u64 *)data);
+ seq_printf(m, "%llu\n", *(__u64 *)data);
+ return 0;
}
EXPORT_SYMBOL(lprocfs_rd_u64);

@@ -411,7 +413,8 @@ int lprocfs_rd_atomic(struct seq_file *m, void *data)
{
atomic_t *atom = data;
LASSERT(atom != NULL);
- return seq_printf(m, "%d\n", atomic_read(atom));
+ seq_printf(m, "%d\n", atomic_read(atom));
+ return 0;
}
EXPORT_SYMBOL(lprocfs_rd_atomic);

@@ -439,7 +442,8 @@ int lprocfs_rd_uuid(struct seq_file *m, void *data)
struct obd_device *obd = data;

LASSERT(obd != NULL);
- return seq_printf(m, "%s\n", obd->obd_uuid.uuid);
+ seq_printf(m, "%s\n", obd->obd_uuid.uuid);
+ return 0;
}
EXPORT_SYMBOL(lprocfs_rd_uuid);

@@ -448,7 +452,8 @@ int lprocfs_rd_name(struct seq_file *m, void *data)
struct obd_device *dev = data;

LASSERT(dev != NULL);
- return seq_printf(m, "%s\n", dev->obd_name);
+ seq_printf(m, "%s\n", dev->obd_name);
+ return 0;
}
EXPORT_SYMBOL(lprocfs_rd_name);

@@ -924,7 +929,8 @@ int lprocfs_rd_num_exports(struct seq_file *m, void *data)
struct obd_device *obd = data;

LASSERT(obd != NULL);
- return seq_printf(m, "%u\n", obd->obd_num_exports);
+ seq_printf(m, "%u\n", obd->obd_num_exports);
+ return 0;
}
EXPORT_SYMBOL(lprocfs_rd_num_exports);

@@ -933,7 +939,8 @@ int lprocfs_rd_numrefs(struct seq_file *m, void *data)
struct obd_type *class = (struct obd_type *) data;

LASSERT(class != NULL);
- return seq_printf(m, "%d\n", class->typ_refcnt);
+ seq_printf(m, "%d\n", class->typ_refcnt);
+ return 0;
}
EXPORT_SYMBOL(lprocfs_rd_numrefs);

@@ -1606,8 +1613,9 @@ LPROC_SEQ_FOPS_RO(lproc_exp_hash);

int lprocfs_nid_stats_clear_read(struct seq_file *m, void *data)
{
- return seq_printf(m, "%s\n",
- "Write into this file to clear all nid stats and stale nid entries");
+ seq_printf(m, "%s\n",
+ "Write into this file to clear all nid stats and stale nid entries");
+ return 0;
}
EXPORT_SYMBOL(lprocfs_nid_stats_clear_read);

diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c
index 83bf168..4022b8d 100644
--- a/drivers/staging/lustre/lustre/obdclass/lu_object.c
+++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c
@@ -2014,18 +2014,19 @@ int lu_site_stats_print(const struct lu_site *s, struct seq_file *m)
memset(&stats, 0, sizeof(stats));
lu_site_stats_get(s->ls_obj_hash, &stats, 1);

- return seq_printf(m, "%d/%d %d/%d %d %d %d %d %d %d %d\n",
- stats.lss_busy,
- stats.lss_total,
- stats.lss_populated,
- CFS_HASH_NHLIST(s->ls_obj_hash),
- stats.lss_max_search,
- ls_stats_read(s->ls_stats, LU_SS_CREATED),
- ls_stats_read(s->ls_stats, LU_SS_CACHE_HIT),
- ls_stats_read(s->ls_stats, LU_SS_CACHE_MISS),
- ls_stats_read(s->ls_stats, LU_SS_CACHE_RACE),
- ls_stats_read(s->ls_stats, LU_SS_CACHE_DEATH_RACE),
- ls_stats_read(s->ls_stats, LU_SS_LRU_PURGED));
+ seq_printf(m, "%d/%d %d/%d %d %d %d %d %d %d %d\n",
+ stats.lss_busy,
+ stats.lss_total,
+ stats.lss_populated,
+ CFS_HASH_NHLIST(s->ls_obj_hash),
+ stats.lss_max_search,
+ ls_stats_read(s->ls_stats, LU_SS_CREATED),
+ ls_stats_read(s->ls_stats, LU_SS_CACHE_HIT),
+ ls_stats_read(s->ls_stats, LU_SS_CACHE_MISS),
+ ls_stats_read(s->ls_stats, LU_SS_CACHE_RACE),
+ ls_stats_read(s->ls_stats, LU_SS_CACHE_DEATH_RACE),
+ ls_stats_read(s->ls_stats, LU_SS_LRU_PURGED));
+ return 0;
}
EXPORT_SYMBOL(lu_site_stats_print);

diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c
index 1795d3a..015b9bb 100644
--- a/drivers/staging/lustre/lustre/osc/lproc_osc.c
+++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c
@@ -289,8 +289,8 @@ static int osc_grant_shrink_interval_seq_show(struct seq_file *m, void *v)

if (obd == NULL)
return 0;
- return seq_printf(m, "%d\n",
- obd->u.cli.cl_grant_shrink_interval);
+ seq_printf(m, "%d\n", obd->u.cli.cl_grant_shrink_interval);
+ return 0;
}

static ssize_t osc_grant_shrink_interval_seq_write(struct file *file,
@@ -323,8 +323,8 @@ static int osc_checksum_seq_show(struct seq_file *m, void *v)
if (obd == NULL)
return 0;

- return seq_printf(m, "%d\n",
- obd->u.cli.cl_checksum ? 1 : 0);
+ seq_printf(m, "%d\n", obd->u.cli.cl_checksum ? 1 : 0);
+ return 0;
}

static ssize_t osc_checksum_seq_write(struct file *file,
@@ -405,7 +405,8 @@ static int osc_resend_count_seq_show(struct seq_file *m, void *v)
{
struct obd_device *obd = m->private;

- return seq_printf(m, "%u\n", atomic_read(&obd->u.cli.cl_resends));
+ seq_printf(m, "%u\n", atomic_read(&obd->u.cli.cl_resends));
+ return 0;
}

static ssize_t osc_resend_count_seq_write(struct file *file,
@@ -433,7 +434,8 @@ static int osc_contention_seconds_seq_show(struct seq_file *m, void *v)
struct obd_device *obd = m->private;
struct osc_device *od = obd2osc_dev(obd);

- return seq_printf(m, "%u\n", od->od_contention_time);
+ seq_printf(m, "%u\n", od->od_contention_time);
+ return 0;
}

static ssize_t osc_contention_seconds_seq_write(struct file *file,
@@ -453,7 +455,8 @@ static int osc_lockless_truncate_seq_show(struct seq_file *m, void *v)
struct obd_device *obd = m->private;
struct osc_device *od = obd2osc_dev(obd);

- return seq_printf(m, "%u\n", od->od_lockless_truncate);
+ seq_printf(m, "%u\n", od->od_lockless_truncate);
+ return 0;
}

static ssize_t osc_lockless_truncate_seq_write(struct file *file,
@@ -471,8 +474,9 @@ LPROC_SEQ_FOPS(osc_lockless_truncate);
static int osc_destroys_in_flight_seq_show(struct seq_file *m, void *v)
{
struct obd_device *obd = m->private;
- return seq_printf(m, "%u\n",
- atomic_read(&obd->u.cli.cl_destroy_in_flight));
+
+ seq_printf(m, "%u\n", atomic_read(&obd->u.cli.cl_destroy_in_flight));
+ return 0;
}
LPROC_SEQ_FOPS_RO(osc_destroys_in_flight);

diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
index 0e2071b..29498d3 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
@@ -267,7 +267,8 @@ ptlrpc_lprocfs_req_history_len_seq_show(struct seq_file *m, void *v)
ptlrpc_service_for_each_part(svcpt, i, svc)
total += svcpt->scp_hist_nrqbds;

- return seq_printf(m, "%d\n", total);
+ seq_printf(m, "%d\n", total);
+ return 0;
}
LPROC_SEQ_FOPS_RO(ptlrpc_lprocfs_req_history_len);

@@ -282,7 +283,8 @@ ptlrpc_lprocfs_req_history_max_seq_show(struct seq_file *m, void *n)
ptlrpc_service_for_each_part(svcpt, i, svc)
total += svc->srv_hist_nrqbds_cpt_max;

- return seq_printf(m, "%d\n", total);
+ seq_printf(m, "%d\n", total);
+ return 0;
}

static ssize_t
@@ -327,8 +329,8 @@ ptlrpc_lprocfs_threads_min_seq_show(struct seq_file *m, void *n)
{
struct ptlrpc_service *svc = m->private;

- return seq_printf(m, "%d\n",
- svc->srv_nthrs_cpt_init * svc->srv_ncpts);
+ seq_printf(m, "%d\n", svc->srv_nthrs_cpt_init * svc->srv_ncpts);
+ return 0;
}

static ssize_t
@@ -371,7 +373,8 @@ ptlrpc_lprocfs_threads_started_seq_show(struct seq_file *m, void *n)
ptlrpc_service_for_each_part(svcpt, i, svc)
total += svcpt->scp_nthrs_running;

- return seq_printf(m, "%d\n", total);
+ seq_printf(m, "%d\n", total);
+ return 0;
}
LPROC_SEQ_FOPS_RO(ptlrpc_lprocfs_threads_started);

@@ -380,8 +383,8 @@ ptlrpc_lprocfs_threads_max_seq_show(struct seq_file *m, void *n)
{
struct ptlrpc_service *svc = m->private;

- return seq_printf(m, "%d\n",
- svc->srv_nthrs_cpt_limit * svc->srv_ncpts);
+ seq_printf(m, "%d\n", svc->srv_nthrs_cpt_limit * svc->srv_ncpts);
+ return 0;
}

static ssize_t
@@ -1026,7 +1029,8 @@ LPROC_SEQ_FOPS_RO(ptlrpc_lprocfs_timeouts);
static int ptlrpc_lprocfs_hp_ratio_seq_show(struct seq_file *m, void *v)
{
struct ptlrpc_service *svc = m->private;
- return seq_printf(m, "%d", svc->srv_hpreq_ratio);
+ seq_printf(m, "%d", svc->srv_hpreq_ratio);
+ return 0;
}

static ssize_t ptlrpc_lprocfs_hp_ratio_seq_write(struct file *file,
--
2.1.2

2015-02-22 03:01:40

by Joe Perches

[permalink] [raw]
Subject: [PATCH 02/27] staging: lustre: Convert seq_ hash functions to return void

These functions don't need to return anything.
No caller uses the return value.

Miscellanea:

Integrate the individual strings to reduce object size ~100 bytes.

Signed-off-by: Joe Perches <[email protected]>
---
drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h | 4 ++--
drivers/staging/lustre/lustre/libcfs/hash.c | 14 ++++----------
2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h
index 808e494..79a6299 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h
@@ -785,8 +785,8 @@ static inline void __cfs_hash_set_theta(struct cfs_hash *hs, int min, int max)

/* Generic debug formatting routines mainly for proc handler */
struct seq_file;
-int cfs_hash_debug_header(struct seq_file *m);
-int cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m);
+void cfs_hash_debug_header(struct seq_file *m);
+void cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m);

/*
* Generic djb2 hash algorithm for character arrays.
diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c
index 7c74073..a55567e 100644
--- a/drivers/staging/lustre/lustre/libcfs/hash.c
+++ b/drivers/staging/lustre/lustre/libcfs/hash.c
@@ -2008,14 +2008,10 @@ void cfs_hash_rehash_key(struct cfs_hash *hs, const void *old_key,
}
EXPORT_SYMBOL(cfs_hash_rehash_key);

-int cfs_hash_debug_header(struct seq_file *m)
+void cfs_hash_debug_header(struct seq_file *m)
{
- seq_printf(m, "%-*s%6s%6s%6s%6s%6s%6s%6s%7s%8s%8s%8s%s\n",
- CFS_HASH_BIGNAME_LEN,
- "name", "cur", "min", "max", "theta", "t-min", "t-max",
- "flags", "rehash", "count", "maxdep", "maxdepb",
- " distribution");
- return 0;
+ seq_printf(m, "%-*s cur min max theta t-min t-max flags rehash count maxdep maxdepb distribution\n",
+ CFS_HASH_BIGNAME_LEN, "name");
}
EXPORT_SYMBOL(cfs_hash_debug_header);

@@ -2043,7 +2039,7 @@ cfs_hash_full_nbkt(struct cfs_hash *hs)
CFS_HASH_RH_NBKT(hs) : CFS_HASH_NBKT(hs);
}

-int cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m)
+void cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m)
{
int dist[8] = { 0, };
int maxdep = -1;
@@ -2098,7 +2094,5 @@ int cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m)
seq_printf(m, "%d%c", dist[i], (i == 7) ? '\n' : '/');

cfs_hash_unlock(hs, 0);
-
- return 0;
}
EXPORT_SYMBOL(cfs_hash_debug_str);
--
2.1.2

2015-02-22 02:54:49

by Joe Perches

[permalink] [raw]
Subject: [PATCH 03/27] staging: lustre: Convert uses of "int rc = seq_printf(...)"

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Convert these uses to:

seq_printf(seq, ...);

return 0;

Done via cocci script:

@@
struct seq_file *seq;
int i;
@@
- i = seq_printf(seq,
+ seq_printf(seq,
...);
...
- return i;
+ return 0;

@@
struct seq_file *seq;
int i;
@@
- i = 0;
- i += seq_printf(seq,
+ seq_printf(seq,
...);
...
- return i;
+ return 0;

With some additional reformatting and typing post conversion
to remove the now unnecessary "int i;" declaration.

Signed-off-by: Joe Perches <[email protected]>
---
drivers/staging/lustre/lustre/fid/lproc_fid.c | 23 +++---
drivers/staging/lustre/lustre/llite/lproc_llite.c | 5 +-
drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 6 +-
drivers/staging/lustre/lustre/osc/lproc_osc.c | 45 ++++++------
.../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 5 +-
drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 82 +++++++++++-----------
6 files changed, 79 insertions(+), 87 deletions(-)

diff --git a/drivers/staging/lustre/lustre/fid/lproc_fid.c b/drivers/staging/lustre/lustre/fid/lproc_fid.c
index 6a21f07..88b5fac 100644
--- a/drivers/staging/lustre/lustre/fid/lproc_fid.c
+++ b/drivers/staging/lustre/lustre/fid/lproc_fid.c
@@ -120,15 +120,14 @@ static int
lprocfs_fid_space_seq_show(struct seq_file *m, void *unused)
{
struct lu_client_seq *seq = (struct lu_client_seq *)m->private;
- int rc;

LASSERT(seq != NULL);

mutex_lock(&seq->lcs_mutex);
- rc = seq_printf(m, "[%#llx - %#llx]:%x:%s\n", PRANGE(&seq->lcs_space));
+ seq_printf(m, "[%#llx - %#llx]:%x:%s\n", PRANGE(&seq->lcs_space));
mutex_unlock(&seq->lcs_mutex);

- return rc;
+ return 0;
}

static ssize_t lprocfs_fid_width_seq_write(struct file *file,
@@ -170,30 +169,28 @@ static int
lprocfs_fid_width_seq_show(struct seq_file *m, void *unused)
{
struct lu_client_seq *seq = (struct lu_client_seq *)m->private;
- int rc;

LASSERT(seq != NULL);

mutex_lock(&seq->lcs_mutex);
- rc = seq_printf(m, "%llu\n", seq->lcs_width);
+ seq_printf(m, "%llu\n", seq->lcs_width);
mutex_unlock(&seq->lcs_mutex);

- return rc;
+ return 0;
}

static int
lprocfs_fid_fid_seq_show(struct seq_file *m, void *unused)
{
struct lu_client_seq *seq = (struct lu_client_seq *)m->private;
- int rc;

LASSERT(seq != NULL);

mutex_lock(&seq->lcs_mutex);
- rc = seq_printf(m, DFID"\n", PFID(&seq->lcs_fid));
+ seq_printf(m, DFID"\n", PFID(&seq->lcs_fid));
mutex_unlock(&seq->lcs_mutex);

- return rc;
+ return 0;
}

static int
@@ -201,17 +198,17 @@ lprocfs_fid_server_seq_show(struct seq_file *m, void *unused)
{
struct lu_client_seq *seq = (struct lu_client_seq *)m->private;
struct client_obd *cli;
- int rc;

LASSERT(seq != NULL);

if (seq->lcs_exp != NULL) {
cli = &seq->lcs_exp->exp_obd->u.cli;
- rc = seq_printf(m, "%s\n", cli->cl_target_uuid.uuid);
+ seq_printf(m, "%s\n", cli->cl_target_uuid.uuid);
} else {
- rc = seq_printf(m, "%s\n", seq->lcs_srv->lss_name);
+ seq_printf(m, "%s\n", seq->lcs_srv->lss_name);
}
- return rc;
+
+ return 0;
}

LPROC_SEQ_FOPS(lprocfs_fid_space);
diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c
index 4ec0ef9..09b386d 100644
--- a/drivers/staging/lustre/lustre/llite/lproc_llite.c
+++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c
@@ -799,11 +799,10 @@ static int ll_xattr_cache_seq_show(struct seq_file *m, void *v)
{
struct super_block *sb = m->private;
struct ll_sb_info *sbi = ll_s2sbi(sb);
- int rc;

- rc = seq_printf(m, "%u\n", sbi->ll_xattr_cache_enabled);
+ seq_printf(m, "%u\n", sbi->ll_xattr_cache_enabled);

- return rc;
+ return 0;
}

static ssize_t ll_xattr_cache_seq_write(struct file *file,
diff --git a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c
index c791941..a4fb294 100644
--- a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c
+++ b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c
@@ -43,12 +43,12 @@ static int mdc_max_rpcs_in_flight_seq_show(struct seq_file *m, void *v)
{
struct obd_device *dev = m->private;
struct client_obd *cli = &dev->u.cli;
- int rc;

client_obd_list_lock(&cli->cl_loi_list_lock);
- rc = seq_printf(m, "%u\n", cli->cl_max_rpcs_in_flight);
+ seq_printf(m, "%u\n", cli->cl_max_rpcs_in_flight);
client_obd_list_unlock(&cli->cl_loi_list_lock);
- return rc;
+
+ return 0;
}

static ssize_t mdc_max_rpcs_in_flight_seq_write(struct file *file,
diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c
index 015b9bb..4afed87 100644
--- a/drivers/staging/lustre/lustre/osc/lproc_osc.c
+++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c
@@ -45,12 +45,12 @@
static int osc_active_seq_show(struct seq_file *m, void *v)
{
struct obd_device *dev = m->private;
- int rc;

LPROCFS_CLIMP_CHECK(dev);
- rc = seq_printf(m, "%d\n", !dev->u.cli.cl_import->imp_deactive);
+ seq_printf(m, "%d\n", !dev->u.cli.cl_import->imp_deactive);
LPROCFS_CLIMP_EXIT(dev);
- return rc;
+
+ return 0;
}

static ssize_t osc_active_seq_write(struct file *file,
@@ -80,12 +80,12 @@ static int osc_max_rpcs_in_flight_seq_show(struct seq_file *m, void *v)
{
struct obd_device *dev = m->private;
struct client_obd *cli = &dev->u.cli;
- int rc;

client_obd_list_lock(&cli->cl_loi_list_lock);
- rc = seq_printf(m, "%u\n", cli->cl_max_rpcs_in_flight);
+ seq_printf(m, "%u\n", cli->cl_max_rpcs_in_flight);
client_obd_list_unlock(&cli->cl_loi_list_lock);
- return rc;
+
+ return 0;
}

static ssize_t osc_max_rpcs_in_flight_seq_write(struct file *file,
@@ -164,16 +164,15 @@ static int osc_cached_mb_seq_show(struct seq_file *m, void *v)
struct obd_device *dev = m->private;
struct client_obd *cli = &dev->u.cli;
int shift = 20 - PAGE_CACHE_SHIFT;
- int rc;

- rc = seq_printf(m,
- "used_mb: %d\n"
- "busy_cnt: %d\n",
- (atomic_read(&cli->cl_lru_in_list) +
- atomic_read(&cli->cl_lru_busy)) >> shift,
- atomic_read(&cli->cl_lru_busy));
+ seq_printf(m,
+ "used_mb: %d\n"
+ "busy_cnt: %d\n",
+ (atomic_read(&cli->cl_lru_in_list) +
+ atomic_read(&cli->cl_lru_busy)) >> shift,
+ atomic_read(&cli->cl_lru_busy));

- return rc;
+ return 0;
}

/* shrink the number of caching pages to a specific number */
@@ -215,12 +214,12 @@ static int osc_cur_dirty_bytes_seq_show(struct seq_file *m, void *v)
{
struct obd_device *dev = m->private;
struct client_obd *cli = &dev->u.cli;
- int rc;

client_obd_list_lock(&cli->cl_loi_list_lock);
- rc = seq_printf(m, "%lu\n", cli->cl_dirty);
+ seq_printf(m, "%lu\n", cli->cl_dirty);
client_obd_list_unlock(&cli->cl_loi_list_lock);
- return rc;
+
+ return 0;
}
LPROC_SEQ_FOPS_RO(osc_cur_dirty_bytes);

@@ -228,12 +227,12 @@ static int osc_cur_grant_bytes_seq_show(struct seq_file *m, void *v)
{
struct obd_device *dev = m->private;
struct client_obd *cli = &dev->u.cli;
- int rc;

client_obd_list_lock(&cli->cl_loi_list_lock);
- rc = seq_printf(m, "%lu\n", cli->cl_avail_grant);
+ seq_printf(m, "%lu\n", cli->cl_avail_grant);
client_obd_list_unlock(&cli->cl_loi_list_lock);
- return rc;
+
+ return 0;
}

static ssize_t osc_cur_grant_bytes_seq_write(struct file *file,
@@ -274,12 +273,12 @@ static int osc_cur_lost_grant_bytes_seq_show(struct seq_file *m, void *v)
{
struct obd_device *dev = m->private;
struct client_obd *cli = &dev->u.cli;
- int rc;

client_obd_list_lock(&cli->cl_loi_list_lock);
- rc = seq_printf(m, "%lu\n", cli->cl_lost_grant);
+ seq_printf(m, "%lu\n", cli->cl_lost_grant);
client_obd_list_unlock(&cli->cl_loi_list_lock);
- return rc;
+
+ return 0;
}
LPROC_SEQ_FOPS_RO(osc_cur_lost_grant_bytes);

diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
index 29498d3..640f461 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
@@ -1328,13 +1328,12 @@ int lprocfs_rd_pinger_recov(struct seq_file *m, void *n)
{
struct obd_device *obd = m->private;
struct obd_import *imp = obd->u.cli.cl_import;
- int rc;

LPROCFS_CLIMP_CHECK(obd);
- rc = seq_printf(m, "%d\n", !imp->imp_no_pinger_recover);
+ seq_printf(m, "%d\n", !imp->imp_no_pinger_recover);
LPROCFS_CLIMP_EXIT(obd);

- return rc;
+ return 0;
}
EXPORT_SYMBOL(lprocfs_rd_pinger_recov);

diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
index 0dabd83..6f0256f 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
@@ -125,52 +125,50 @@ static struct ptlrpc_enc_page_pool {
*/
int sptlrpc_proc_enc_pool_seq_show(struct seq_file *m, void *v)
{
- int rc;
-
spin_lock(&page_pools.epp_lock);

- rc = seq_printf(m,
- "physical pages: %lu\n"
- "pages per pool: %lu\n"
- "max pages: %lu\n"
- "max pools: %u\n"
- "total pages: %lu\n"
- "total free: %lu\n"
- "idle index: %lu/100\n"
- "last shrink: %lds\n"
- "last access: %lds\n"
- "max pages reached: %lu\n"
- "grows: %u\n"
- "grows failure: %u\n"
- "shrinks: %u\n"
- "cache access: %lu\n"
- "cache missing: %lu\n"
- "low free mark: %lu\n"
- "max waitqueue depth: %u\n"
- "max wait time: "CFS_TIME_T"/%u\n"
- ,
- totalram_pages,
- PAGES_PER_POOL,
- page_pools.epp_max_pages,
- page_pools.epp_max_pools,
- page_pools.epp_total_pages,
- page_pools.epp_free_pages,
- page_pools.epp_idle_idx,
- get_seconds() - page_pools.epp_last_shrink,
- get_seconds() - page_pools.epp_last_access,
- page_pools.epp_st_max_pages,
- page_pools.epp_st_grows,
- page_pools.epp_st_grow_fails,
- page_pools.epp_st_shrinks,
- page_pools.epp_st_access,
- page_pools.epp_st_missings,
- page_pools.epp_st_lowfree,
- page_pools.epp_st_max_wqlen,
- page_pools.epp_st_max_wait, HZ
- );
+ seq_printf(m,
+ "physical pages: %lu\n"
+ "pages per pool: %lu\n"
+ "max pages: %lu\n"
+ "max pools: %u\n"
+ "total pages: %lu\n"
+ "total free: %lu\n"
+ "idle index: %lu/100\n"
+ "last shrink: %lds\n"
+ "last access: %lds\n"
+ "max pages reached: %lu\n"
+ "grows: %u\n"
+ "grows failure: %u\n"
+ "shrinks: %u\n"
+ "cache access: %lu\n"
+ "cache missing: %lu\n"
+ "low free mark: %lu\n"
+ "max waitqueue depth: %u\n"
+ "max wait time: " CFS_TIME_T "/%u\n",
+ totalram_pages,
+ PAGES_PER_POOL,
+ page_pools.epp_max_pages,
+ page_pools.epp_max_pools,
+ page_pools.epp_total_pages,
+ page_pools.epp_free_pages,
+ page_pools.epp_idle_idx,
+ get_seconds() - page_pools.epp_last_shrink,
+ get_seconds() - page_pools.epp_last_access,
+ page_pools.epp_st_max_pages,
+ page_pools.epp_st_grows,
+ page_pools.epp_st_grow_fails,
+ page_pools.epp_st_shrinks,
+ page_pools.epp_st_access,
+ page_pools.epp_st_missings,
+ page_pools.epp_st_lowfree,
+ page_pools.epp_st_max_wqlen,
+ page_pools.epp_st_max_wait,
+ HZ);

spin_unlock(&page_pools.epp_lock);
- return rc;
+
+ return 0;
}

static void enc_pools_release_free_pages(long npages)
--
2.1.2

2015-02-22 03:01:14

by Joe Perches

[permalink] [raw]
Subject: [PATCH 04/27] staging: lustre: Convert remaining uses of "= seq_printf(...)"

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Convert the remaining uses by hand.

Miscellanea:

o Convert fixed string output to seq_puts

Signed-off-by: Joe Perches <[email protected]>
---
drivers/staging/lustre/lustre/llite/lproc_llite.c | 24 ++++---
.../lustre/lustre/obdclass/lprocfs_status.c | 82 +++++++++++-----------
2 files changed, 54 insertions(+), 52 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c
index 09b386d..2b8f147 100644
--- a/drivers/staging/lustre/lustre/llite/lproc_llite.c
+++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c
@@ -59,7 +59,7 @@ static int ll_blksize_seq_show(struct seq_file *m, void *v)
cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc)
- rc = seq_printf(m, "%u\n", osfs.os_bsize);
+ seq_printf(m, "%u\n", osfs.os_bsize);

return rc;
}
@@ -82,8 +82,9 @@ static int ll_kbytestotal_seq_show(struct seq_file *m, void *v)
while (blk_size >>= 1)
result <<= 1;

- rc = seq_printf(m, "%llu\n", result);
+ seq_printf(m, "%llu\n", result);
}
+
return rc;
}
LPROC_SEQ_FOPS_RO(ll_kbytestotal);
@@ -105,8 +106,9 @@ static int ll_kbytesfree_seq_show(struct seq_file *m, void *v)
while (blk_size >>= 1)
result <<= 1;

- rc = seq_printf(m, "%llu\n", result);
+ seq_printf(m, "%llu\n", result);
}
+
return rc;
}
LPROC_SEQ_FOPS_RO(ll_kbytesfree);
@@ -128,8 +130,9 @@ static int ll_kbytesavail_seq_show(struct seq_file *m, void *v)
while (blk_size >>= 1)
result <<= 1;

- rc = seq_printf(m, "%llu\n", result);
+ seq_printf(m, "%llu\n", result);
}
+
return rc;
}
LPROC_SEQ_FOPS_RO(ll_kbytesavail);
@@ -145,7 +148,8 @@ static int ll_filestotal_seq_show(struct seq_file *m, void *v)
cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc)
- rc = seq_printf(m, "%llu\n", osfs.os_files);
+ seq_printf(m, "%llu\n", osfs.os_files);
+
return rc;
}
LPROC_SEQ_FOPS_RO(ll_filestotal);
@@ -161,7 +165,8 @@ static int ll_filesfree_seq_show(struct seq_file *m, void *v)
cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc)
- rc = seq_printf(m, "%llu\n", osfs.os_ffree);
+ seq_printf(m, "%llu\n", osfs.os_ffree);
+
return rc;
}
LPROC_SEQ_FOPS_RO(ll_filesfree);
@@ -169,16 +174,15 @@ LPROC_SEQ_FOPS_RO(ll_filesfree);
static int ll_client_type_seq_show(struct seq_file *m, void *v)
{
struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
- int rc;

LASSERT(sbi != NULL);

if (sbi->ll_flags & LL_SBI_RMT_CLIENT)
- rc = seq_printf(m, "remote client\n");
+ seq_puts(m, "remote client\n");
else
- rc = seq_printf(m, "local client\n");
+ seq_puts(m, "local client\n");

- return rc;
+ return 0;
}
LPROC_SEQ_FOPS_RO(ll_client_type);

diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 25f01cb..55e8081 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -465,7 +465,8 @@ int lprocfs_rd_blksize(struct seq_file *m, void *data)
cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc)
- rc = seq_printf(m, "%u\n", osfs.os_bsize);
+ seq_printf(m, "%u\n", osfs.os_bsize);
+
return rc;
}
EXPORT_SYMBOL(lprocfs_rd_blksize);
@@ -484,8 +485,9 @@ int lprocfs_rd_kbytestotal(struct seq_file *m, void *data)
while (blk_size >>= 1)
result <<= 1;

- rc = seq_printf(m, "%llu\n", result);
+ seq_printf(m, "%llu\n", result);
}
+
return rc;
}
EXPORT_SYMBOL(lprocfs_rd_kbytestotal);
@@ -504,8 +506,9 @@ int lprocfs_rd_kbytesfree(struct seq_file *m, void *data)
while (blk_size >>= 1)
result <<= 1;

- rc = seq_printf(m, "%llu\n", result);
+ seq_printf(m, "%llu\n", result);
}
+
return rc;
}
EXPORT_SYMBOL(lprocfs_rd_kbytesfree);
@@ -524,8 +527,9 @@ int lprocfs_rd_kbytesavail(struct seq_file *m, void *data)
while (blk_size >>= 1)
result <<= 1;

- rc = seq_printf(m, "%llu\n", result);
+ seq_printf(m, "%llu\n", result);
}
+
return rc;
}
EXPORT_SYMBOL(lprocfs_rd_kbytesavail);
@@ -538,7 +542,7 @@ int lprocfs_rd_filestotal(struct seq_file *m, void *data)
cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc)
- rc = seq_printf(m, "%llu\n", osfs.os_files);
+ seq_printf(m, "%llu\n", osfs.os_files);

return rc;
}
@@ -552,7 +556,8 @@ int lprocfs_rd_filesfree(struct seq_file *m, void *data)
cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc)
- rc = seq_printf(m, "%llu\n", osfs.os_ffree);
+ seq_printf(m, "%llu\n", osfs.os_ffree);
+
return rc;
}
EXPORT_SYMBOL(lprocfs_rd_filesfree);
@@ -562,17 +567,18 @@ int lprocfs_rd_server_uuid(struct seq_file *m, void *data)
struct obd_device *obd = data;
struct obd_import *imp;
char *imp_state_name = NULL;
- int rc = 0;

LASSERT(obd != NULL);
LPROCFS_CLIMP_CHECK(obd);
imp = obd->u.cli.cl_import;
imp_state_name = ptlrpc_import_state_name(imp->imp_state);
- rc = seq_printf(m, "%s\t%s%s\n", obd2cli_tgt(obd), imp_state_name,
- imp->imp_deactive ? "\tDEACTIVATED" : "");
+ seq_printf(m, "%s\t%s%s\n",
+ obd2cli_tgt(obd), imp_state_name,
+ imp->imp_deactive ? "\tDEACTIVATED" : "");

LPROCFS_CLIMP_EXIT(obd);
- return rc;
+
+ return 0;
}
EXPORT_SYMBOL(lprocfs_rd_server_uuid);

@@ -580,19 +586,19 @@ int lprocfs_rd_conn_uuid(struct seq_file *m, void *data)
{
struct obd_device *obd = data;
struct ptlrpc_connection *conn;
- int rc = 0;

LASSERT(obd != NULL);

LPROCFS_CLIMP_CHECK(obd);
conn = obd->u.cli.cl_import->imp_connection;
if (conn && obd->u.cli.cl_import)
- rc = seq_printf(m, "%s\n", conn->c_remote_uuid.uuid);
+ seq_printf(m, "%s\n", conn->c_remote_uuid.uuid);
else
- rc = seq_printf(m, "%s\n", "<none>");
+ seq_puts(m, "<none>\n");

LPROCFS_CLIMP_EXIT(obd);
- return rc;
+
+ return 0;
}
EXPORT_SYMBOL(lprocfs_rd_conn_uuid);

@@ -1207,41 +1213,33 @@ static int lprocfs_stats_seq_show(struct seq_file *p, void *v)
struct lprocfs_counter_header *hdr;
struct lprocfs_counter ctr;
int idx = *(loff_t *)v;
- int rc = 0;

if (idx == 0) {
struct timeval now;
do_gettimeofday(&now);
- rc = seq_printf(p, "%-25s %lu.%lu secs.usecs\n",
- "snapshot_time", now.tv_sec, (unsigned long)now.tv_usec);
- if (rc < 0)
- return rc;
+ seq_printf(p, "%-25s %lu.%lu secs.usecs\n",
+ "snapshot_time",
+ now.tv_sec, (unsigned long)now.tv_usec);
}
+
hdr = &stats->ls_cnt_header[idx];
lprocfs_stats_collect(stats, idx, &ctr);

- if (ctr.lc_count == 0)
- goto out;
-
- rc = seq_printf(p, "%-25s %lld samples [%s]", hdr->lc_name,
- ctr.lc_count, hdr->lc_units);
+ if (ctr.lc_count != 0) {
+ seq_printf(p, "%-25s %lld samples [%s]",
+ hdr->lc_name, ctr.lc_count, hdr->lc_units);

- if (rc < 0)
- goto out;
-
- if ((hdr->lc_config & LPROCFS_CNTR_AVGMINMAX) && (ctr.lc_count > 0)) {
- rc = seq_printf(p, " %lld %lld %lld",
- ctr.lc_min, ctr.lc_max, ctr.lc_sum);
- if (rc < 0)
- goto out;
- if (hdr->lc_config & LPROCFS_CNTR_STDDEV)
- rc = seq_printf(p, " %lld", ctr.lc_sumsquare);
- if (rc < 0)
- goto out;
+ if ((hdr->lc_config & LPROCFS_CNTR_AVGMINMAX) &&
+ (ctr.lc_count > 0)) {
+ seq_printf(p, " %lld %lld %lld",
+ ctr.lc_min, ctr.lc_max, ctr.lc_sum);
+ if (hdr->lc_config & LPROCFS_CNTR_STDDEV)
+ seq_printf(p, " %lld", ctr.lc_sumsquare);
+ }
+ seq_putc(p, '\n');
}
- rc = seq_printf(p, "\n");
-out:
- return (rc < 0) ? rc : 0;
+
+ return 0;
}

static const struct seq_operations lprocfs_stats_seq_sops = {
@@ -2049,12 +2047,12 @@ int lprocfs_obd_rd_max_pages_per_rpc(struct seq_file *m, void *data)
{
struct obd_device *dev = data;
struct client_obd *cli = &dev->u.cli;
- int rc;

client_obd_list_lock(&cli->cl_loi_list_lock);
- rc = seq_printf(m, "%d\n", cli->cl_max_pages_per_rpc);
+ seq_printf(m, "%d\n", cli->cl_max_pages_per_rpc);
client_obd_list_unlock(&cli->cl_loi_list_lock);
- return rc;
+
+ return 0;
}
EXPORT_SYMBOL(lprocfs_obd_rd_max_pages_per_rpc);

--
2.1.2

2015-02-22 02:54:53

by Joe Perches

[permalink] [raw]
Subject: [PATCH 05/27] x86: mtrr: if: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
arch/x86/kernel/cpu/mtrr/if.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/cpu/mtrr/if.c b/arch/x86/kernel/cpu/mtrr/if.c
index a041e09..d76f13d 100644
--- a/arch/x86/kernel/cpu/mtrr/if.c
+++ b/arch/x86/kernel/cpu/mtrr/if.c
@@ -404,11 +404,10 @@ static const struct file_operations mtrr_fops = {
static int mtrr_seq_show(struct seq_file *seq, void *offset)
{
char factor;
- int i, max, len;
+ int i, max;
mtrr_type type;
unsigned long base, size;

- len = 0;
max = num_var_ranges;
for (i = 0; i < max; i++) {
mtrr_if->get(i, &base, &size, &type);
@@ -425,11 +424,10 @@ static int mtrr_seq_show(struct seq_file *seq, void *offset)
size >>= 20 - PAGE_SHIFT;
}
/* Base can be > 32bit */
- len += seq_printf(seq, "reg%02i: base=0x%06lx000 "
- "(%5luMB), size=%5lu%cB, count=%d: %s\n",
- i, base, base >> (20 - PAGE_SHIFT), size,
- factor, mtrr_usage_table[i],
- mtrr_attrib_to_str(type));
+ seq_printf(seq, "reg%02i: base=0x%06lx000 (%5luMB), size=%5lu%cB, count=%d: %s\n",
+ i, base, base >> (20 - PAGE_SHIFT),
+ size, factor,
+ mtrr_usage_table[i], mtrr_attrib_to_str(type));
}
return 0;
}
--
2.1.2

2015-02-22 03:00:46

by Joe Perches

[permalink] [raw]
Subject: [PATCH 06/27] power: wakeup: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
drivers/base/power/wakeup.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index c2744b3..23fe220 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -842,7 +842,6 @@ static int print_wakeup_source_stats(struct seq_file *m,
unsigned long active_count;
ktime_t active_time;
ktime_t prevent_sleep_time;
- int ret;

spin_lock_irqsave(&ws->lock, flags);

@@ -865,17 +864,16 @@ static int print_wakeup_source_stats(struct seq_file *m,
active_time = ktime_set(0, 0);
}

- ret = seq_printf(m, "%-12s\t%lu\t\t%lu\t\t%lu\t\t%lu\t\t"
- "%lld\t\t%lld\t\t%lld\t\t%lld\t\t%lld\n",
- ws->name, active_count, ws->event_count,
- ws->wakeup_count, ws->expire_count,
- ktime_to_ms(active_time), ktime_to_ms(total_time),
- ktime_to_ms(max_time), ktime_to_ms(ws->last_time),
- ktime_to_ms(prevent_sleep_time));
+ seq_printf(m, "%-12s\t%lu\t\t%lu\t\t%lu\t\t%lu\t\t%lld\t\t%lld\t\t%lld\t\t%lld\t\t%lld\n",
+ ws->name, active_count, ws->event_count,
+ ws->wakeup_count, ws->expire_count,
+ ktime_to_ms(active_time), ktime_to_ms(total_time),
+ ktime_to_ms(max_time), ktime_to_ms(ws->last_time),
+ ktime_to_ms(prevent_sleep_time));

spin_unlock_irqrestore(&ws->lock, flags);

- return ret;
+ return 0;
}

/**
--
2.1.2

2015-02-22 02:55:03

by Joe Perches

[permalink] [raw]
Subject: [PATCH 07/27] ipmi: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
drivers/char/ipmi/ipmi_msghandler.c | 12 ++++++++----
drivers/char/ipmi/ipmi_si_intf.c | 26 +++++++++++++++-----------
drivers/char/ipmi/ipmi_ssif.c | 4 +++-
3 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index bf95efc..950b5b0 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -1997,7 +1997,9 @@ static int smi_ipmb_proc_show(struct seq_file *m, void *v)
seq_printf(m, "%x", intf->channels[0].address);
for (i = 1; i < IPMI_MAX_CHANNELS; i++)
seq_printf(m, " %x", intf->channels[i].address);
- return seq_putc(m, '\n');
+ seq_putc(m, '\n');
+
+ return 0;
}

static int smi_ipmb_proc_open(struct inode *inode, struct file *file)
@@ -2016,9 +2018,11 @@ static int smi_version_proc_show(struct seq_file *m, void *v)
{
ipmi_smi_t intf = m->private;

- return seq_printf(m, "%u.%u\n",
- ipmi_version_major(&intf->bmc->id),
- ipmi_version_minor(&intf->bmc->id));
+ seq_printf(m, "%u.%u\n",
+ ipmi_version_major(&intf->bmc->id),
+ ipmi_version_minor(&intf->bmc->id));
+
+ return 0;
}

static int smi_version_proc_open(struct inode *inode, struct file *file)
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index fd6110f..25f6903 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2979,7 +2979,9 @@ static int smi_type_proc_show(struct seq_file *m, void *v)
{
struct smi_info *smi = m->private;

- return seq_printf(m, "%s\n", si_to_str[smi->si_type]);
+ seq_printf(m, "%s\n", si_to_str[smi->si_type]);
+
+ return 0;
}

static int smi_type_proc_open(struct inode *inode, struct file *file)
@@ -3041,16 +3043,18 @@ static int smi_params_proc_show(struct seq_file *m, void *v)
{
struct smi_info *smi = m->private;

- return seq_printf(m,
- "%s,%s,0x%lx,rsp=%d,rsi=%d,rsh=%d,irq=%d,ipmb=%d\n",
- si_to_str[smi->si_type],
- addr_space_to_str[smi->io.addr_type],
- smi->io.addr_data,
- smi->io.regspacing,
- smi->io.regsize,
- smi->io.regshift,
- smi->irq,
- smi->slave_addr);
+ seq_printf(m,
+ "%s,%s,0x%lx,rsp=%d,rsi=%d,rsh=%d,irq=%d,ipmb=%d\n",
+ si_to_str[smi->si_type],
+ addr_space_to_str[smi->io.addr_type],
+ smi->io.addr_data,
+ smi->io.regspacing,
+ smi->io.regsize,
+ smi->io.regshift,
+ smi->irq,
+ smi->slave_addr);
+
+ return 0;
}

static int smi_params_proc_open(struct inode *inode, struct file *file)
diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
index 74128e6..40ae7f2 100644
--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -1196,7 +1196,9 @@ static int ssif_detect(struct i2c_client *client, struct i2c_board_info *info)

static int smi_type_proc_show(struct seq_file *m, void *v)
{
- return seq_puts(m, "ssif\n");
+ seq_puts(m, "ssif\n");
+
+ return 0;
}

static int smi_type_proc_open(struct inode *inode, struct file *file)
--
2.1.2

2015-02-22 03:00:24

by Joe Perches

[permalink] [raw]
Subject: [PATCH 08/27] rtc: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
drivers/rtc/rtc-cmos.c | 36 +++++++++++++++++++-----------------
drivers/rtc/rtc-ds1305.c | 6 +++---
drivers/rtc/rtc-mrst.c | 16 +++++++++-------
drivers/rtc/rtc-tegra.c | 4 +++-
4 files changed, 34 insertions(+), 28 deletions(-)

diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 5b2e761..87647f4 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -459,23 +459,25 @@ static int cmos_procfs(struct device *dev, struct seq_file *seq)
/* NOTE: at least ICH6 reports battery status using a different
* (non-RTC) bit; and SQWE is ignored on many current systems.
*/
- return seq_printf(seq,
- "periodic_IRQ\t: %s\n"
- "update_IRQ\t: %s\n"
- "HPET_emulated\t: %s\n"
- // "square_wave\t: %s\n"
- "BCD\t\t: %s\n"
- "DST_enable\t: %s\n"
- "periodic_freq\t: %d\n"
- "batt_status\t: %s\n",
- (rtc_control & RTC_PIE) ? "yes" : "no",
- (rtc_control & RTC_UIE) ? "yes" : "no",
- is_hpet_enabled() ? "yes" : "no",
- // (rtc_control & RTC_SQWE) ? "yes" : "no",
- (rtc_control & RTC_DM_BINARY) ? "no" : "yes",
- (rtc_control & RTC_DST_EN) ? "yes" : "no",
- cmos->rtc->irq_freq,
- (valid & RTC_VRT) ? "okay" : "dead");
+ seq_printf(seq,
+ "periodic_IRQ\t: %s\n"
+ "update_IRQ\t: %s\n"
+ "HPET_emulated\t: %s\n"
+ // "square_wave\t: %s\n"
+ "BCD\t\t: %s\n"
+ "DST_enable\t: %s\n"
+ "periodic_freq\t: %d\n"
+ "batt_status\t: %s\n",
+ (rtc_control & RTC_PIE) ? "yes" : "no",
+ (rtc_control & RTC_UIE) ? "yes" : "no",
+ is_hpet_enabled() ? "yes" : "no",
+ // (rtc_control & RTC_SQWE) ? "yes" : "no",
+ (rtc_control & RTC_DM_BINARY) ? "no" : "yes",
+ (rtc_control & RTC_DST_EN) ? "yes" : "no",
+ cmos->rtc->irq_freq,
+ (valid & RTC_VRT) ? "okay" : "dead");
+
+ return 0;
}

#else
diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c
index 129add77..12b0715 100644
--- a/drivers/rtc/rtc-ds1305.c
+++ b/drivers/rtc/rtc-ds1305.c
@@ -434,9 +434,9 @@ static int ds1305_proc(struct device *dev, struct seq_file *seq)
}

done:
- return seq_printf(seq,
- "trickle_charge\t: %s%s\n",
- diodes, resistors);
+ seq_printf(seq, "trickle_charge\t: %s%s\n", diodes, resistors);
+
+ return 0;
}

#else
diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c
index e2436d1..ab02bda 100644
--- a/drivers/rtc/rtc-mrst.c
+++ b/drivers/rtc/rtc-mrst.c
@@ -277,13 +277,15 @@ static int mrst_procfs(struct device *dev, struct seq_file *seq)
valid = vrtc_cmos_read(RTC_VALID);
spin_unlock_irq(&rtc_lock);

- return seq_printf(seq,
- "periodic_IRQ\t: %s\n"
- "alarm\t\t: %s\n"
- "BCD\t\t: no\n"
- "periodic_freq\t: daily (not adjustable)\n",
- (rtc_control & RTC_PIE) ? "on" : "off",
- (rtc_control & RTC_AIE) ? "on" : "off");
+ seq_printf(seq,
+ "periodic_IRQ\t: %s\n"
+ "alarm\t\t: %s\n"
+ "BCD\t\t: no\n"
+ "periodic_freq\t: daily (not adjustable)\n",
+ (rtc_control & RTC_PIE) ? "on" : "off",
+ (rtc_control & RTC_AIE) ? "on" : "off");
+
+ return 0;
}

#else
diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c
index d948277..b318017 100644
--- a/drivers/rtc/rtc-tegra.c
+++ b/drivers/rtc/rtc-tegra.c
@@ -261,7 +261,9 @@ static int tegra_rtc_proc(struct device *dev, struct seq_file *seq)
if (!dev || !dev->driver)
return 0;

- return seq_printf(seq, "name\t\t: %s\n", dev_name(dev));
+ seq_printf(seq, "name\t\t: %s\n", dev_name(dev));
+
+ return 0:
}

static irqreturn_t tegra_rtc_irq_handler(int irq, void *data)
--
2.1.2

2015-02-22 02:55:08

by Joe Perches

[permalink] [raw]
Subject: [PATCH 09/27] ipc: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
ipc/msg.c | 34 ++++++++++++++++++----------------
ipc/sem.c | 26 ++++++++++++++------------
ipc/shm.c | 42 ++++++++++++++++++++++--------------------
ipc/util.c | 6 ++++--
4 files changed, 58 insertions(+), 50 deletions(-)

diff --git a/ipc/msg.c b/ipc/msg.c
index a7261d5..2b6fdbb 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -1015,22 +1015,24 @@ static int sysvipc_msg_proc_show(struct seq_file *s, void *it)
struct user_namespace *user_ns = seq_user_ns(s);
struct msg_queue *msq = it;

- return seq_printf(s,
- "%10d %10d %4o %10lu %10lu %5u %5u %5u %5u %5u %5u %10lu %10lu %10lu\n",
- msq->q_perm.key,
- msq->q_perm.id,
- msq->q_perm.mode,
- msq->q_cbytes,
- msq->q_qnum,
- msq->q_lspid,
- msq->q_lrpid,
- from_kuid_munged(user_ns, msq->q_perm.uid),
- from_kgid_munged(user_ns, msq->q_perm.gid),
- from_kuid_munged(user_ns, msq->q_perm.cuid),
- from_kgid_munged(user_ns, msq->q_perm.cgid),
- msq->q_stime,
- msq->q_rtime,
- msq->q_ctime);
+ seq_printf(s,
+ "%10d %10d %4o %10lu %10lu %5u %5u %5u %5u %5u %5u %10lu %10lu %10lu\n",
+ msq->q_perm.key,
+ msq->q_perm.id,
+ msq->q_perm.mode,
+ msq->q_cbytes,
+ msq->q_qnum,
+ msq->q_lspid,
+ msq->q_lrpid,
+ from_kuid_munged(user_ns, msq->q_perm.uid),
+ from_kgid_munged(user_ns, msq->q_perm.gid),
+ from_kuid_munged(user_ns, msq->q_perm.cuid),
+ from_kgid_munged(user_ns, msq->q_perm.cgid),
+ msq->q_stime,
+ msq->q_rtime,
+ msq->q_ctime);
+
+ return 0;
}
#endif

diff --git a/ipc/sem.c b/ipc/sem.c
index 9284211..d1a6edd 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -2170,17 +2170,19 @@ static int sysvipc_sem_proc_show(struct seq_file *s, void *it)

sem_otime = get_semotime(sma);

- return seq_printf(s,
- "%10d %10d %4o %10u %5u %5u %5u %5u %10lu %10lu\n",
- sma->sem_perm.key,
- sma->sem_perm.id,
- sma->sem_perm.mode,
- sma->sem_nsems,
- from_kuid_munged(user_ns, sma->sem_perm.uid),
- from_kgid_munged(user_ns, sma->sem_perm.gid),
- from_kuid_munged(user_ns, sma->sem_perm.cuid),
- from_kgid_munged(user_ns, sma->sem_perm.cgid),
- sem_otime,
- sma->sem_ctime);
+ seq_printf(s,
+ "%10d %10d %4o %10u %5u %5u %5u %5u %10lu %10lu\n",
+ sma->sem_perm.key,
+ sma->sem_perm.id,
+ sma->sem_perm.mode,
+ sma->sem_nsems,
+ from_kuid_munged(user_ns, sma->sem_perm.uid),
+ from_kgid_munged(user_ns, sma->sem_perm.gid),
+ from_kuid_munged(user_ns, sma->sem_perm.cuid),
+ from_kgid_munged(user_ns, sma->sem_perm.cgid),
+ sem_otime,
+ sma->sem_ctime);
+
+ return 0;
}
#endif
diff --git a/ipc/shm.c b/ipc/shm.c
index 19633b4..d280a74 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -1342,25 +1342,27 @@ static int sysvipc_shm_proc_show(struct seq_file *s, void *it)
#define SIZE_SPEC "%21lu"
#endif

- return seq_printf(s,
- "%10d %10d %4o " SIZE_SPEC " %5u %5u "
- "%5lu %5u %5u %5u %5u %10lu %10lu %10lu "
- SIZE_SPEC " " SIZE_SPEC "\n",
- shp->shm_perm.key,
- shp->shm_perm.id,
- shp->shm_perm.mode,
- shp->shm_segsz,
- shp->shm_cprid,
- shp->shm_lprid,
- shp->shm_nattch,
- from_kuid_munged(user_ns, shp->shm_perm.uid),
- from_kgid_munged(user_ns, shp->shm_perm.gid),
- from_kuid_munged(user_ns, shp->shm_perm.cuid),
- from_kgid_munged(user_ns, shp->shm_perm.cgid),
- shp->shm_atim,
- shp->shm_dtim,
- shp->shm_ctim,
- rss * PAGE_SIZE,
- swp * PAGE_SIZE);
+ seq_printf(s,
+ "%10d %10d %4o " SIZE_SPEC " %5u %5u "
+ "%5lu %5u %5u %5u %5u %10lu %10lu %10lu "
+ SIZE_SPEC " " SIZE_SPEC "\n",
+ shp->shm_perm.key,
+ shp->shm_perm.id,
+ shp->shm_perm.mode,
+ shp->shm_segsz,
+ shp->shm_cprid,
+ shp->shm_lprid,
+ shp->shm_nattch,
+ from_kuid_munged(user_ns, shp->shm_perm.uid),
+ from_kgid_munged(user_ns, shp->shm_perm.gid),
+ from_kuid_munged(user_ns, shp->shm_perm.cuid),
+ from_kgid_munged(user_ns, shp->shm_perm.cgid),
+ shp->shm_atim,
+ shp->shm_dtim,
+ shp->shm_ctim,
+ rss * PAGE_SIZE,
+ swp * PAGE_SIZE);
+
+ return 0;
}
#endif
diff --git a/ipc/util.c b/ipc/util.c
index 106bed0..ff3323e 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -837,8 +837,10 @@ static int sysvipc_proc_show(struct seq_file *s, void *it)
struct ipc_proc_iter *iter = s->private;
struct ipc_proc_iface *iface = iter->iface;

- if (it == SEQ_START_TOKEN)
- return seq_puts(s, iface->header);
+ if (it == SEQ_START_TOKEN) {
+ seq_puts(s, iface->header);
+ return 0;
+ }

return iface->show(s, it);
}
--
2.1.2

2015-02-22 02:59:58

by Joe Perches

[permalink] [raw]
Subject: [PATCH 10/27] pxa27x_udc: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

While there, simplify the error handler logic by returning
immediately and remove the unnecessary labels.

Signed-off-by: Joe Perches <[email protected]>
---
drivers/usb/gadget/udc/pxa27x_udc.c | 132 ++++++++++++++++--------------------
1 file changed, 60 insertions(+), 72 deletions(-)

diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c
index 6a855fc..486f754 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.c
+++ b/drivers/usb/gadget/udc/pxa27x_udc.c
@@ -93,50 +93,46 @@ static void handle_ep(struct pxa_ep *ep);
static int state_dbg_show(struct seq_file *s, void *p)
{
struct pxa_udc *udc = s->private;
- int pos = 0, ret;
u32 tmp;

- ret = -ENODEV;
if (!udc->driver)
- goto out;
+ return -ENODEV;

/* basic device status */
- pos += seq_printf(s, DRIVER_DESC "\n"
- "%s version: %s\nGadget driver: %s\n",
- driver_name, DRIVER_VERSION,
- udc->driver ? udc->driver->driver.name : "(none)");
+ seq_printf(s, DRIVER_DESC "\n"
+ "%s version: %s\n"
+ "Gadget driver: %s\n",
+ driver_name, DRIVER_VERSION,
+ udc->driver ? udc->driver->driver.name : "(none)");

tmp = udc_readl(udc, UDCCR);
- pos += seq_printf(s,
- "udccr=0x%0x(%s%s%s%s%s%s%s%s%s%s), "
- "con=%d,inter=%d,altinter=%d\n", tmp,
- (tmp & UDCCR_OEN) ? " oen":"",
- (tmp & UDCCR_AALTHNP) ? " aalthnp":"",
- (tmp & UDCCR_AHNP) ? " rem" : "",
- (tmp & UDCCR_BHNP) ? " rstir" : "",
- (tmp & UDCCR_DWRE) ? " dwre" : "",
- (tmp & UDCCR_SMAC) ? " smac" : "",
- (tmp & UDCCR_EMCE) ? " emce" : "",
- (tmp & UDCCR_UDR) ? " udr" : "",
- (tmp & UDCCR_UDA) ? " uda" : "",
- (tmp & UDCCR_UDE) ? " ude" : "",
- (tmp & UDCCR_ACN) >> UDCCR_ACN_S,
- (tmp & UDCCR_AIN) >> UDCCR_AIN_S,
- (tmp & UDCCR_AAISN) >> UDCCR_AAISN_S);
+ seq_printf(s,
+ "udccr=0x%0x(%s%s%s%s%s%s%s%s%s%s), con=%d,inter=%d,altinter=%d\n",
+ tmp,
+ (tmp & UDCCR_OEN) ? " oen":"",
+ (tmp & UDCCR_AALTHNP) ? " aalthnp":"",
+ (tmp & UDCCR_AHNP) ? " rem" : "",
+ (tmp & UDCCR_BHNP) ? " rstir" : "",
+ (tmp & UDCCR_DWRE) ? " dwre" : "",
+ (tmp & UDCCR_SMAC) ? " smac" : "",
+ (tmp & UDCCR_EMCE) ? " emce" : "",
+ (tmp & UDCCR_UDR) ? " udr" : "",
+ (tmp & UDCCR_UDA) ? " uda" : "",
+ (tmp & UDCCR_UDE) ? " ude" : "",
+ (tmp & UDCCR_ACN) >> UDCCR_ACN_S,
+ (tmp & UDCCR_AIN) >> UDCCR_AIN_S,
+ (tmp & UDCCR_AAISN) >> UDCCR_AAISN_S);
/* registers for device and ep0 */
- pos += seq_printf(s, "udcicr0=0x%08x udcicr1=0x%08x\n",
- udc_readl(udc, UDCICR0), udc_readl(udc, UDCICR1));
- pos += seq_printf(s, "udcisr0=0x%08x udcisr1=0x%08x\n",
- udc_readl(udc, UDCISR0), udc_readl(udc, UDCISR1));
- pos += seq_printf(s, "udcfnr=%d\n", udc_readl(udc, UDCFNR));
- pos += seq_printf(s, "irqs: reset=%lu, suspend=%lu, resume=%lu, "
- "reconfig=%lu\n",
- udc->stats.irqs_reset, udc->stats.irqs_suspend,
- udc->stats.irqs_resume, udc->stats.irqs_reconfig);
-
- ret = 0;
-out:
- return ret;
+ seq_printf(s, "udcicr0=0x%08x udcicr1=0x%08x\n",
+ udc_readl(udc, UDCICR0), udc_readl(udc, UDCICR1));
+ seq_printf(s, "udcisr0=0x%08x udcisr1=0x%08x\n",
+ udc_readl(udc, UDCISR0), udc_readl(udc, UDCISR1));
+ seq_printf(s, "udcfnr=%d\n", udc_readl(udc, UDCFNR));
+ seq_printf(s, "irqs: reset=%lu, suspend=%lu, resume=%lu, reconfig=%lu\n",
+ udc->stats.irqs_reset, udc->stats.irqs_suspend,
+ udc->stats.irqs_resume, udc->stats.irqs_reconfig);
+
+ return 0;
}

static int queues_dbg_show(struct seq_file *s, void *p)
@@ -144,75 +140,67 @@ static int queues_dbg_show(struct seq_file *s, void *p)
struct pxa_udc *udc = s->private;
struct pxa_ep *ep;
struct pxa27x_request *req;
- int pos = 0, i, maxpkt, ret;
+ int i, maxpkt;

- ret = -ENODEV;
if (!udc->driver)
- goto out;
+ return -ENODEV;

/* dump endpoint queues */
for (i = 0; i < NR_PXA_ENDPOINTS; i++) {
ep = &udc->pxa_ep[i];
maxpkt = ep->fifo_size;
- pos += seq_printf(s, "%-12s max_pkt=%d %s\n",
- EPNAME(ep), maxpkt, "pio");
+ seq_printf(s, "%-12s max_pkt=%d %s\n",
+ EPNAME(ep), maxpkt, "pio");

if (list_empty(&ep->queue)) {
- pos += seq_printf(s, "\t(nothing queued)\n");
+ seq_puts(s, "\t(nothing queued)\n");
continue;
}

list_for_each_entry(req, &ep->queue, queue) {
- pos += seq_printf(s, "\treq %p len %d/%d buf %p\n",
- &req->req, req->req.actual,
- req->req.length, req->req.buf);
+ seq_printf(s, "\treq %p len %d/%d buf %p\n",
+ &req->req, req->req.actual,
+ req->req.length, req->req.buf);
}
}

- ret = 0;
-out:
- return ret;
+ return 0;
}

static int eps_dbg_show(struct seq_file *s, void *p)
{
struct pxa_udc *udc = s->private;
struct pxa_ep *ep;
- int pos = 0, i, ret;
+ int i;
u32 tmp;

- ret = -ENODEV;
if (!udc->driver)
- goto out;
+ return -ENODEV;

ep = &udc->pxa_ep[0];
tmp = udc_ep_readl(ep, UDCCSR);
- pos += seq_printf(s, "udccsr0=0x%03x(%s%s%s%s%s%s%s)\n", tmp,
- (tmp & UDCCSR0_SA) ? " sa" : "",
- (tmp & UDCCSR0_RNE) ? " rne" : "",
- (tmp & UDCCSR0_FST) ? " fst" : "",
- (tmp & UDCCSR0_SST) ? " sst" : "",
- (tmp & UDCCSR0_DME) ? " dme" : "",
- (tmp & UDCCSR0_IPR) ? " ipr" : "",
- (tmp & UDCCSR0_OPC) ? " opc" : "");
+ seq_printf(s, "udccsr0=0x%03x(%s%s%s%s%s%s%s)\n",
+ tmp,
+ (tmp & UDCCSR0_SA) ? " sa" : "",
+ (tmp & UDCCSR0_RNE) ? " rne" : "",
+ (tmp & UDCCSR0_FST) ? " fst" : "",
+ (tmp & UDCCSR0_SST) ? " sst" : "",
+ (tmp & UDCCSR0_DME) ? " dme" : "",
+ (tmp & UDCCSR0_IPR) ? " ipr" : "",
+ (tmp & UDCCSR0_OPC) ? " opc" : "");
for (i = 0; i < NR_PXA_ENDPOINTS; i++) {
ep = &udc->pxa_ep[i];
tmp = i? udc_ep_readl(ep, UDCCR) : udc_readl(udc, UDCCR);
- pos += seq_printf(s, "%-12s: "
- "IN %lu(%lu reqs), OUT %lu(%lu reqs), "
- "irqs=%lu, udccr=0x%08x, udccsr=0x%03x, "
- "udcbcr=%d\n",
- EPNAME(ep),
- ep->stats.in_bytes, ep->stats.in_ops,
- ep->stats.out_bytes, ep->stats.out_ops,
- ep->stats.irqs,
- tmp, udc_ep_readl(ep, UDCCSR),
- udc_ep_readl(ep, UDCBCR));
+ seq_printf(s, "%-12s: IN %lu(%lu reqs), OUT %lu(%lu reqs), irqs=%lu, udccr=0x%08x, udccsr=0x%03x, udcbcr=%d\n",
+ EPNAME(ep),
+ ep->stats.in_bytes, ep->stats.in_ops,
+ ep->stats.out_bytes, ep->stats.out_ops,
+ ep->stats.irqs,
+ tmp, udc_ep_readl(ep, UDCCSR),
+ udc_ep_readl(ep, UDCBCR));
}

- ret = 0;
-out:
- return ret;
+ return 0;
}

static int eps_dbg_open(struct inode *inode, struct file *file)
--
2.1.2

2015-02-22 02:55:15

by Joe Perches

[permalink] [raw]
Subject: [PATCH 11/27] microblaze: mb: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
arch/microblaze/kernel/cpu/mb.c | 149 ++++++++++++++++++++--------------------
1 file changed, 73 insertions(+), 76 deletions(-)

diff --git a/arch/microblaze/kernel/cpu/mb.c b/arch/microblaze/kernel/cpu/mb.c
index 7b5dca7..01ae077 100644
--- a/arch/microblaze/kernel/cpu/mb.c
+++ b/arch/microblaze/kernel/cpu/mb.c
@@ -27,7 +27,6 @@

static int show_cpuinfo(struct seq_file *m, void *v)
{
- int count = 0;
char *fpga_family = "Unknown";
char *cpu_ver = "Unknown";
int i;
@@ -48,91 +47,89 @@ static int show_cpuinfo(struct seq_file *m, void *v)
}
}

- count = seq_printf(m,
- "CPU-Family: MicroBlaze\n"
- "FPGA-Arch: %s\n"
- "CPU-Ver: %s, %s endian\n"
- "CPU-MHz: %d.%02d\n"
- "BogoMips: %lu.%02lu\n",
- fpga_family,
- cpu_ver,
- cpuinfo.endian ? "little" : "big",
- cpuinfo.cpu_clock_freq /
- 1000000,
- cpuinfo.cpu_clock_freq %
- 1000000,
- loops_per_jiffy / (500000 / HZ),
- (loops_per_jiffy / (5000 / HZ)) % 100);
-
- count += seq_printf(m,
- "HW:\n Shift:\t\t%s\n"
- " MSR:\t\t%s\n"
- " PCMP:\t\t%s\n"
- " DIV:\t\t%s\n",
- (cpuinfo.use_instr & PVR0_USE_BARREL_MASK) ? "yes" : "no",
- (cpuinfo.use_instr & PVR2_USE_MSR_INSTR) ? "yes" : "no",
- (cpuinfo.use_instr & PVR2_USE_PCMP_INSTR) ? "yes" : "no",
- (cpuinfo.use_instr & PVR0_USE_DIV_MASK) ? "yes" : "no");
-
- count += seq_printf(m,
- " MMU:\t\t%x\n",
- cpuinfo.mmu);
-
- count += seq_printf(m,
- " MUL:\t\t%s\n"
- " FPU:\t\t%s\n",
- (cpuinfo.use_mult & PVR2_USE_MUL64_MASK) ? "v2" :
- (cpuinfo.use_mult & PVR0_USE_HW_MUL_MASK) ? "v1" : "no",
- (cpuinfo.use_fpu & PVR2_USE_FPU2_MASK) ? "v2" :
- (cpuinfo.use_fpu & PVR0_USE_FPU_MASK) ? "v1" : "no");
-
- count += seq_printf(m,
- " Exc:\t\t%s%s%s%s%s%s%s%s\n",
- (cpuinfo.use_exc & PVR2_OPCODE_0x0_ILL_MASK) ? "op0x0 " : "",
- (cpuinfo.use_exc & PVR2_UNALIGNED_EXC_MASK) ? "unal " : "",
- (cpuinfo.use_exc & PVR2_ILL_OPCODE_EXC_MASK) ? "ill " : "",
- (cpuinfo.use_exc & PVR2_IOPB_BUS_EXC_MASK) ? "iopb " : "",
- (cpuinfo.use_exc & PVR2_DOPB_BUS_EXC_MASK) ? "dopb " : "",
- (cpuinfo.use_exc & PVR2_DIV_ZERO_EXC_MASK) ? "zero " : "",
- (cpuinfo.use_exc & PVR2_FPU_EXC_MASK) ? "fpu " : "",
- (cpuinfo.use_exc & PVR2_USE_FSL_EXC) ? "fsl " : "");
-
- count += seq_printf(m,
- "Stream-insns:\t%sprivileged\n",
- cpuinfo.mmu_privins ? "un" : "");
+ seq_printf(m,
+ "CPU-Family: MicroBlaze\n"
+ "FPGA-Arch: %s\n"
+ "CPU-Ver: %s, %s endian\n"
+ "CPU-MHz: %d.%02d\n"
+ "BogoMips: %lu.%02lu\n",
+ fpga_family,
+ cpu_ver,
+ cpuinfo.endian ? "little" : "big",
+ cpuinfo.cpu_clock_freq / 1000000,
+ cpuinfo.cpu_clock_freq % 1000000,
+ loops_per_jiffy / (500000 / HZ),
+ (loops_per_jiffy / (5000 / HZ)) % 100);
+
+ seq_printf(m,
+ "HW:\n Shift:\t\t%s\n"
+ " MSR:\t\t%s\n"
+ " PCMP:\t\t%s\n"
+ " DIV:\t\t%s\n",
+ (cpuinfo.use_instr & PVR0_USE_BARREL_MASK) ? "yes" : "no",
+ (cpuinfo.use_instr & PVR2_USE_MSR_INSTR) ? "yes" : "no",
+ (cpuinfo.use_instr & PVR2_USE_PCMP_INSTR) ? "yes" : "no",
+ (cpuinfo.use_instr & PVR0_USE_DIV_MASK) ? "yes" : "no");
+
+ seq_printf(m, " MMU:\t\t%x\n", cpuinfo.mmu);
+
+ seq_printf(m,
+ " MUL:\t\t%s\n"
+ " FPU:\t\t%s\n",
+ (cpuinfo.use_mult & PVR2_USE_MUL64_MASK) ? "v2" :
+ (cpuinfo.use_mult & PVR0_USE_HW_MUL_MASK) ? "v1" : "no",
+ (cpuinfo.use_fpu & PVR2_USE_FPU2_MASK) ? "v2" :
+ (cpuinfo.use_fpu & PVR0_USE_FPU_MASK) ? "v1" : "no");
+
+ seq_printf(m,
+ " Exc:\t\t%s%s%s%s%s%s%s%s\n",
+ (cpuinfo.use_exc & PVR2_OPCODE_0x0_ILL_MASK) ? "op0x0 " : "",
+ (cpuinfo.use_exc & PVR2_UNALIGNED_EXC_MASK) ? "unal " : "",
+ (cpuinfo.use_exc & PVR2_ILL_OPCODE_EXC_MASK) ? "ill " : "",
+ (cpuinfo.use_exc & PVR2_IOPB_BUS_EXC_MASK) ? "iopb " : "",
+ (cpuinfo.use_exc & PVR2_DOPB_BUS_EXC_MASK) ? "dopb " : "",
+ (cpuinfo.use_exc & PVR2_DIV_ZERO_EXC_MASK) ? "zero " : "",
+ (cpuinfo.use_exc & PVR2_FPU_EXC_MASK) ? "fpu " : "",
+ (cpuinfo.use_exc & PVR2_USE_FSL_EXC) ? "fsl " : "");
+
+ seq_printf(m,
+ "Stream-insns:\t%sprivileged\n",
+ cpuinfo.mmu_privins ? "un" : "");

if (cpuinfo.use_icache)
- count += seq_printf(m,
- "Icache:\t\t%ukB\tline length:\t%dB\n",
- cpuinfo.icache_size >> 10,
- cpuinfo.icache_line_length);
+ seq_printf(m,
+ "Icache:\t\t%ukB\tline length:\t%dB\n",
+ cpuinfo.icache_size >> 10,
+ cpuinfo.icache_line_length);
else
- count += seq_printf(m, "Icache:\t\tno\n");
+ x seq_puts(m, "Icache:\t\tno\n");

if (cpuinfo.use_dcache) {
- count += seq_printf(m,
- "Dcache:\t\t%ukB\tline length:\t%dB\n",
- cpuinfo.dcache_size >> 10,
- cpuinfo.dcache_line_length);
- seq_printf(m, "Dcache-Policy:\t");
+ seq_printf(m,
+ "Dcache:\t\t%ukB\tline length:\t%dB\n",
+ cpuinfo.dcache_size >> 10,
+ cpuinfo.dcache_line_length);
+ seq_puts(m, "Dcache-Policy:\t");
if (cpuinfo.dcache_wb)
- count += seq_printf(m, "write-back\n");
+ seq_puts(m, "write-back\n");
else
- count += seq_printf(m, "write-through\n");
- } else
- count += seq_printf(m, "Dcache:\t\tno\n");
+ seq_puts(m, "write-through\n");
+ } else {
+ seq_puts(m, "Dcache:\t\tno\n");
+ }
+
+ seq_printf(m,
+ "HW-Debug:\t%s\n",
+ cpuinfo.hw_debug ? "yes" : "no");

- count += seq_printf(m,
- "HW-Debug:\t%s\n",
- cpuinfo.hw_debug ? "yes" : "no");
+ seq_printf(m,
+ "PVR-USR1:\t%02x\n"
+ "PVR-USR2:\t%08x\n",
+ cpuinfo.pvr_user1,
+ cpuinfo.pvr_user2);

- count += seq_printf(m,
- "PVR-USR1:\t%02x\n"
- "PVR-USR2:\t%08x\n",
- cpuinfo.pvr_user1,
- cpuinfo.pvr_user2);
+ seq_printf(m, "Page size:\t%lu\n", PAGE_SIZE);

- count += seq_printf(m, "Page size:\t%lu\n", PAGE_SIZE);
return 0;
}

--
2.1.2

2015-02-22 02:55:13

by Joe Perches

[permalink] [raw]
Subject: [PATCH 12/27] nios2: cpuinfo: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
arch/nios2/kernel/cpuinfo.c | 77 ++++++++++++++++++++++-----------------------
1 file changed, 38 insertions(+), 39 deletions(-)

diff --git a/arch/nios2/kernel/cpuinfo.c b/arch/nios2/kernel/cpuinfo.c
index a223691d..1d96de0 100644
--- a/arch/nios2/kernel/cpuinfo.c
+++ b/arch/nios2/kernel/cpuinfo.c
@@ -126,47 +126,46 @@ void __init setup_cpuinfo(void)
*/
static int show_cpuinfo(struct seq_file *m, void *v)
{
- int count = 0;
const u32 clockfreq = cpuinfo.cpu_clock_freq;

- count = seq_printf(m,
- "CPU:\t\tNios II/%s\n"
- "MMU:\t\t%s\n"
- "FPU:\t\tnone\n"
- "Clocking:\t%u.%02u MHz\n"
- "BogoMips:\t%lu.%02lu\n"
- "Calibration:\t%lu loops\n",
- cpuinfo.cpu_impl,
- cpuinfo.mmu ? "present" : "none",
- clockfreq / 1000000, (clockfreq / 100000) % 10,
- (loops_per_jiffy * HZ) / 500000,
- ((loops_per_jiffy * HZ) / 5000) % 100,
- (loops_per_jiffy * HZ));
-
- count += seq_printf(m,
- "HW:\n"
- " MUL:\t\t%s\n"
- " MULX:\t\t%s\n"
- " DIV:\t\t%s\n",
- cpuinfo.has_mul ? "yes" : "no",
- cpuinfo.has_mulx ? "yes" : "no",
- cpuinfo.has_div ? "yes" : "no");
-
- count += seq_printf(m,
- "Icache:\t\t%ukB, line length: %u\n",
- cpuinfo.icache_size >> 10,
- cpuinfo.icache_line_size);
-
- count += seq_printf(m,
- "Dcache:\t\t%ukB, line length: %u\n",
- cpuinfo.dcache_size >> 10,
- cpuinfo.dcache_line_size);
-
- count += seq_printf(m,
- "TLB:\t\t%u ways, %u entries, %u PID bits\n",
- cpuinfo.tlb_num_ways,
- cpuinfo.tlb_num_entries,
- cpuinfo.tlb_pid_num_bits);
+ seq_printf(m,
+ "CPU:\t\tNios II/%s\n"
+ "MMU:\t\t%s\n"
+ "FPU:\t\tnone\n"
+ "Clocking:\t%u.%02u MHz\n"
+ "BogoMips:\t%lu.%02lu\n"
+ "Calibration:\t%lu loops\n",
+ cpuinfo.cpu_impl,
+ cpuinfo.mmu ? "present" : "none",
+ clockfreq / 1000000, (clockfreq / 100000) % 10,
+ (loops_per_jiffy * HZ) / 500000,
+ ((loops_per_jiffy * HZ) / 5000) % 100,
+ (loops_per_jiffy * HZ));
+
+ seq_printf(m,
+ "HW:\n"
+ " MUL:\t\t%s\n"
+ " MULX:\t\t%s\n"
+ " DIV:\t\t%s\n",
+ cpuinfo.has_mul ? "yes" : "no",
+ cpuinfo.has_mulx ? "yes" : "no",
+ cpuinfo.has_div ? "yes" : "no");
+
+ seq_printf(m,
+ "Icache:\t\t%ukB, line length: %u\n",
+ cpuinfo.icache_size >> 10,
+ cpuinfo.icache_line_size);
+
+ seq_printf(m,
+ "Dcache:\t\t%ukB, line length: %u\n",
+ cpuinfo.dcache_size >> 10,
+ cpuinfo.dcache_line_size);
+
+ seq_printf(m,
+ "TLB:\t\t%u ways, %u entries, %u PID bits\n",
+ cpuinfo.tlb_num_ways,
+ cpuinfo.tlb_num_entries,
+ cpuinfo.tlb_pid_num_bits);

return 0;
}
--
2.1.2

2015-02-22 02:59:24

by Joe Perches

[permalink] [raw]
Subject: [PATCH 13/27] ARM: plat-pxa: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
(as it is here, it doesn't return # of chars emitted) will
eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
arch/arm/plat-pxa/dma.c | 111 +++++++++++++++++++++++-------------------------
1 file changed, 53 insertions(+), 58 deletions(-)

diff --git a/arch/arm/plat-pxa/dma.c b/arch/arm/plat-pxa/dma.c
index 054fc5a..d92f07f 100644
--- a/arch/arm/plat-pxa/dma.c
+++ b/arch/arm/plat-pxa/dma.c
@@ -51,19 +51,19 @@ static struct dentry *dbgfs_root, *dbgfs_state, **dbgfs_chan;

static int dbg_show_requester_chan(struct seq_file *s, void *p)
{
- int pos = 0;
int chan = (int)s->private;
int i;
u32 drcmr;

- pos += seq_printf(s, "DMA channel %d requesters list :\n", chan);
+ seq_printf(s, "DMA channel %d requesters list :\n", chan);
for (i = 0; i < DMA_MAX_REQUESTERS; i++) {
drcmr = DRCMR(i);
if ((drcmr & DRCMR_CHLNUM) == chan)
- pos += seq_printf(s, "\tRequester %d (MAPVLD=%d)\n", i,
- !!(drcmr & DRCMR_MAPVLD));
+ seq_printf(s, "\tRequester %d (MAPVLD=%d)\n",
+ i, !!(drcmr & DRCMR_MAPVLD));
}
- return pos;
+
+ return 0;
}

static inline int dbg_burst_from_dcmd(u32 dcmd)
@@ -83,7 +83,6 @@ static int is_phys_valid(unsigned long addr)

static int dbg_show_descriptors(struct seq_file *s, void *p)
{
- int pos = 0;
int chan = (int)s->private;
int i, max_show = 20, burst, width;
u32 dcmd;
@@ -94,44 +93,43 @@ static int dbg_show_descriptors(struct seq_file *s, void *p)
spin_lock_irqsave(&dma_channels[chan].lock, flags);
phys_desc = DDADR(chan);

- pos += seq_printf(s, "DMA channel %d descriptors :\n", chan);
- pos += seq_printf(s, "[%03d] First descriptor unknown\n", 0);
+ seq_printf(s, "DMA channel %d descriptors :\n", chan);
+ seq_printf(s, "[%03d] First descriptor unknown\n", 0);
for (i = 1; i < max_show && is_phys_valid(phys_desc); i++) {
desc = phys_to_virt(phys_desc);
dcmd = desc->dcmd;
burst = dbg_burst_from_dcmd(dcmd);
width = (1 << ((dcmd >> 14) & 0x3)) >> 1;

- pos += seq_printf(s, "[%03d] Desc at %08lx(virt %p)\n",
- i, phys_desc, desc);
- pos += seq_printf(s, "\tDDADR = %08x\n", desc->ddadr);
- pos += seq_printf(s, "\tDSADR = %08x\n", desc->dsadr);
- pos += seq_printf(s, "\tDTADR = %08x\n", desc->dtadr);
- pos += seq_printf(s, "\tDCMD = %08x (%s%s%s%s%s%s%sburst=%d"
- " width=%d len=%d)\n",
- dcmd,
- DCMD_STR(INCSRCADDR), DCMD_STR(INCTRGADDR),
- DCMD_STR(FLOWSRC), DCMD_STR(FLOWTRG),
- DCMD_STR(STARTIRQEN), DCMD_STR(ENDIRQEN),
- DCMD_STR(ENDIAN), burst, width,
- dcmd & DCMD_LENGTH);
+ seq_printf(s, "[%03d] Desc at %08lx(virt %p)\n",
+ i, phys_desc, desc);
+ seq_printf(s, "\tDDADR = %08x\n", desc->ddadr);
+ seq_printf(s, "\tDSADR = %08x\n", desc->dsadr);
+ seq_printf(s, "\tDTADR = %08x\n", desc->dtadr);
+ seq_printf(s, "\tDCMD = %08x (%s%s%s%s%s%s%sburst=%d width=%d len=%d)\n",
+ dcmd,
+ DCMD_STR(INCSRCADDR), DCMD_STR(INCTRGADDR),
+ DCMD_STR(FLOWSRC), DCMD_STR(FLOWTRG),
+ DCMD_STR(STARTIRQEN), DCMD_STR(ENDIRQEN),
+ DCMD_STR(ENDIAN), burst, width,
+ dcmd & DCMD_LENGTH);
phys_desc = desc->ddadr;
}
if (i == max_show)
- pos += seq_printf(s, "[%03d] Desc at %08lx ... max display reached\n",
- i, phys_desc);
+ seq_printf(s, "[%03d] Desc at %08lx ... max display reached\n",
+ i, phys_desc);
else
- pos += seq_printf(s, "[%03d] Desc at %08lx is %s\n",
- i, phys_desc, phys_desc == DDADR_STOP ?
- "DDADR_STOP" : "invalid");
+ seq_printf(s, "[%03d] Desc at %08lx is %s\n",
+ i, phys_desc, phys_desc == DDADR_STOP ?
+ "DDADR_STOP" : "invalid");

spin_unlock_irqrestore(&dma_channels[chan].lock, flags);
- return pos;
+
+ return 0;
}

static int dbg_show_chan_state(struct seq_file *s, void *p)
{
- int pos = 0;
int chan = (int)s->private;
u32 dcsr, dcmd;
int burst, width;
@@ -142,42 +140,39 @@ static int dbg_show_chan_state(struct seq_file *s, void *p)
burst = dbg_burst_from_dcmd(dcmd);
width = (1 << ((dcmd >> 14) & 0x3)) >> 1;

- pos += seq_printf(s, "DMA channel %d\n", chan);
- pos += seq_printf(s, "\tPriority : %s\n",
- str_prio[dma_channels[chan].prio]);
- pos += seq_printf(s, "\tUnaligned transfer bit: %s\n",
- DALGN & (1 << chan) ? "yes" : "no");
- pos += seq_printf(s, "\tDCSR = %08x (%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s)\n",
- dcsr, DCSR_STR(RUN), DCSR_STR(NODESC),
- DCSR_STR(STOPIRQEN), DCSR_STR(EORIRQEN),
- DCSR_STR(EORJMPEN), DCSR_STR(EORSTOPEN),
- DCSR_STR(SETCMPST), DCSR_STR(CLRCMPST),
- DCSR_STR(CMPST), DCSR_STR(EORINTR), DCSR_STR(REQPEND),
- DCSR_STR(STOPSTATE), DCSR_STR(ENDINTR),
- DCSR_STR(STARTINTR), DCSR_STR(BUSERR));
-
- pos += seq_printf(s, "\tDCMD = %08x (%s%s%s%s%s%s%sburst=%d width=%d"
- " len=%d)\n",
- dcmd,
- DCMD_STR(INCSRCADDR), DCMD_STR(INCTRGADDR),
- DCMD_STR(FLOWSRC), DCMD_STR(FLOWTRG),
- DCMD_STR(STARTIRQEN), DCMD_STR(ENDIRQEN),
- DCMD_STR(ENDIAN), burst, width, dcmd & DCMD_LENGTH);
- pos += seq_printf(s, "\tDSADR = %08x\n", DSADR(chan));
- pos += seq_printf(s, "\tDTADR = %08x\n", DTADR(chan));
- pos += seq_printf(s, "\tDDADR = %08x\n", DDADR(chan));
- return pos;
+ seq_printf(s, "DMA channel %d\n", chan);
+ seq_printf(s, "\tPriority : %s\n", str_prio[dma_channels[chan].prio]);
+ seq_printf(s, "\tUnaligned transfer bit: %s\n",
+ DALGN & (1 << chan) ? "yes" : "no");
+ seq_printf(s, "\tDCSR = %08x (%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s)\n",
+ dcsr, DCSR_STR(RUN), DCSR_STR(NODESC),
+ DCSR_STR(STOPIRQEN), DCSR_STR(EORIRQEN),
+ DCSR_STR(EORJMPEN), DCSR_STR(EORSTOPEN),
+ DCSR_STR(SETCMPST), DCSR_STR(CLRCMPST),
+ DCSR_STR(CMPST), DCSR_STR(EORINTR), DCSR_STR(REQPEND),
+ DCSR_STR(STOPSTATE), DCSR_STR(ENDINTR),
+ DCSR_STR(STARTINTR), DCSR_STR(BUSERR));
+
+ seq_printf(s, "\tDCMD = %08x (%s%s%s%s%s%s%sburst=%d width=%d len=%d)\n",
+ dcmd,
+ DCMD_STR(INCSRCADDR), DCMD_STR(INCTRGADDR),
+ DCMD_STR(FLOWSRC), DCMD_STR(FLOWTRG),
+ DCMD_STR(STARTIRQEN), DCMD_STR(ENDIRQEN),
+ DCMD_STR(ENDIAN), burst, width, dcmd & DCMD_LENGTH);
+ seq_printf(s, "\tDSADR = %08x\n", DSADR(chan));
+ seq_printf(s, "\tDTADR = %08x\n", DTADR(chan));
+ seq_printf(s, "\tDDADR = %08x\n", DDADR(chan));
+
+ return 0;
}

static int dbg_show_state(struct seq_file *s, void *p)
{
- int pos = 0;
-
/* basic device status */
- pos += seq_printf(s, "DMA engine status\n");
- pos += seq_printf(s, "\tChannel number: %d\n", num_dma_channels);
+ seq_puts(s, "DMA engine status\n");
+ seq_printf(s, "\tChannel number: %d\n", num_dma_channels);

- return pos;
+ return 0;
}

#define DBGFS_FUNC_DECL(name) \
--
2.1.2

2015-02-22 02:55:18

by Joe Perches

[permalink] [raw]
Subject: [PATCH 14/27] openrisc: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
arch/openrisc/kernel/setup.c | 50 +++++++++++++++++++++++---------------------
1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
index 4fc7ccc..b4ed8b3 100644
--- a/arch/openrisc/kernel/setup.c
+++ b/arch/openrisc/kernel/setup.c
@@ -329,30 +329,32 @@ static int show_cpuinfo(struct seq_file *m, void *v)
version = (vr & SPR_VR_VER) >> 24;
revision = vr & SPR_VR_REV;

- return seq_printf(m,
- "cpu\t\t: OpenRISC-%x\n"
- "revision\t: %d\n"
- "frequency\t: %ld\n"
- "dcache size\t: %d bytes\n"
- "dcache block size\t: %d bytes\n"
- "icache size\t: %d bytes\n"
- "icache block size\t: %d bytes\n"
- "immu\t\t: %d entries, %lu ways\n"
- "dmmu\t\t: %d entries, %lu ways\n"
- "bogomips\t: %lu.%02lu\n",
- version,
- revision,
- loops_per_jiffy * HZ,
- cpuinfo.dcache_size,
- cpuinfo.dcache_block_size,
- cpuinfo.icache_size,
- cpuinfo.icache_block_size,
- 1 << ((mfspr(SPR_DMMUCFGR) & SPR_DMMUCFGR_NTS) >> 2),
- 1 + (mfspr(SPR_DMMUCFGR) & SPR_DMMUCFGR_NTW),
- 1 << ((mfspr(SPR_IMMUCFGR) & SPR_IMMUCFGR_NTS) >> 2),
- 1 + (mfspr(SPR_IMMUCFGR) & SPR_IMMUCFGR_NTW),
- (loops_per_jiffy * HZ) / 500000,
- ((loops_per_jiffy * HZ) / 5000) % 100);
+ seq_printf(m,
+ "cpu\t\t: OpenRISC-%x\n"
+ "revision\t: %d\n"
+ "frequency\t: %ld\n"
+ "dcache size\t: %d bytes\n"
+ "dcache block size\t: %d bytes\n"
+ "icache size\t: %d bytes\n"
+ "icache block size\t: %d bytes\n"
+ "immu\t\t: %d entries, %lu ways\n"
+ "dmmu\t\t: %d entries, %lu ways\n"
+ "bogomips\t: %lu.%02lu\n",
+ version,
+ revision,
+ loops_per_jiffy * HZ,
+ cpuinfo.dcache_size,
+ cpuinfo.dcache_block_size,
+ cpuinfo.icache_size,
+ cpuinfo.icache_block_size,
+ 1 << ((mfspr(SPR_DMMUCFGR) & SPR_DMMUCFGR_NTS) >> 2),
+ 1 + (mfspr(SPR_DMMUCFGR) & SPR_DMMUCFGR_NTW),
+ 1 << ((mfspr(SPR_IMMUCFGR) & SPR_IMMUCFGR_NTS) >> 2),
+ 1 + (mfspr(SPR_IMMUCFGR) & SPR_IMMUCFGR_NTW),
+ (loops_per_jiffy * HZ) / 500000,
+ ((loops_per_jiffy * HZ) / 5000) % 100);
+
+ return 0;
}

static void *c_start(struct seq_file *m, loff_t * pos)
--
2.1.2

2015-02-22 02:58:48

by Joe Perches

[permalink] [raw]
Subject: [PATCH 15/27] cris: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
arch/cris/arch-v10/kernel/setup.c | 58 ++++++++++++++++++------------------
arch/cris/arch-v32/kernel/setup.c | 62 ++++++++++++++++++++-------------------
2 files changed, 62 insertions(+), 58 deletions(-)

diff --git a/arch/cris/arch-v10/kernel/setup.c b/arch/cris/arch-v10/kernel/setup.c
index 4f96d71..d0434a9 100644
--- a/arch/cris/arch-v10/kernel/setup.c
+++ b/arch/cris/arch-v10/kernel/setup.c
@@ -63,35 +63,37 @@ int show_cpuinfo(struct seq_file *m, void *v)
else
info = &cpu_info[revision];

- return seq_printf(m,
- "processor\t: 0\n"
- "cpu\t\t: CRIS\n"
- "cpu revision\t: %lu\n"
- "cpu model\t: %s\n"
- "cache size\t: %d kB\n"
- "fpu\t\t: %s\n"
- "mmu\t\t: %s\n"
- "mmu DMA bug\t: %s\n"
- "ethernet\t: %s Mbps\n"
- "token ring\t: %s\n"
- "scsi\t\t: %s\n"
- "ata\t\t: %s\n"
- "usb\t\t: %s\n"
- "bogomips\t: %lu.%02lu\n",
+ seq_printf(m,
+ "processor\t: 0\n"
+ "cpu\t\t: CRIS\n"
+ "cpu revision\t: %lu\n"
+ "cpu model\t: %s\n"
+ "cache size\t: %d kB\n"
+ "fpu\t\t: %s\n"
+ "mmu\t\t: %s\n"
+ "mmu DMA bug\t: %s\n"
+ "ethernet\t: %s Mbps\n"
+ "token ring\t: %s\n"
+ "scsi\t\t: %s\n"
+ "ata\t\t: %s\n"
+ "usb\t\t: %s\n"
+ "bogomips\t: %lu.%02lu\n",

- revision,
- info->model,
- info->cache,
- info->flags & HAS_FPU ? "yes" : "no",
- info->flags & HAS_MMU ? "yes" : "no",
- info->flags & HAS_MMU_BUG ? "yes" : "no",
- info->flags & HAS_ETHERNET100 ? "10/100" : "10",
- info->flags & HAS_TOKENRING ? "4/16 Mbps" : "no",
- info->flags & HAS_SCSI ? "yes" : "no",
- info->flags & HAS_ATA ? "yes" : "no",
- info->flags & HAS_USB ? "yes" : "no",
- (loops_per_jiffy * HZ + 500) / 500000,
- ((loops_per_jiffy * HZ + 500) / 5000) % 100);
+ revision,
+ info->model,
+ info->cache,
+ info->flags & HAS_FPU ? "yes" : "no",
+ info->flags & HAS_MMU ? "yes" : "no",
+ info->flags & HAS_MMU_BUG ? "yes" : "no",
+ info->flags & HAS_ETHERNET100 ? "10/100" : "10",
+ info->flags & HAS_TOKENRING ? "4/16 Mbps" : "no",
+ info->flags & HAS_SCSI ? "yes" : "no",
+ info->flags & HAS_ATA ? "yes" : "no",
+ info->flags & HAS_USB ? "yes" : "no",
+ (loops_per_jiffy * HZ + 500) / 500000,
+ ((loops_per_jiffy * HZ + 500) / 5000) % 100);
+
+ return 0;
}

#endif /* CONFIG_PROC_FS */
diff --git a/arch/cris/arch-v32/kernel/setup.c b/arch/cris/arch-v32/kernel/setup.c
index 61e10ae..81715c6 100644
--- a/arch/cris/arch-v32/kernel/setup.c
+++ b/arch/cris/arch-v32/kernel/setup.c
@@ -77,36 +77,38 @@ int show_cpuinfo(struct seq_file *m, void *v)
}
}

- return seq_printf(m,
- "processor\t: %d\n"
- "cpu\t\t: CRIS\n"
- "cpu revision\t: %lu\n"
- "cpu model\t: %s\n"
- "cache size\t: %d KB\n"
- "fpu\t\t: %s\n"
- "mmu\t\t: %s\n"
- "mmu DMA bug\t: %s\n"
- "ethernet\t: %s Mbps\n"
- "token ring\t: %s\n"
- "scsi\t\t: %s\n"
- "ata\t\t: %s\n"
- "usb\t\t: %s\n"
- "bogomips\t: %lu.%02lu\n\n",
-
- cpu,
- revision,
- info->cpu_model,
- info->cache_size,
- info->flags & HAS_FPU ? "yes" : "no",
- info->flags & HAS_MMU ? "yes" : "no",
- info->flags & HAS_MMU_BUG ? "yes" : "no",
- info->flags & HAS_ETHERNET100 ? "10/100" : "10",
- info->flags & HAS_TOKENRING ? "4/16 Mbps" : "no",
- info->flags & HAS_SCSI ? "yes" : "no",
- info->flags & HAS_ATA ? "yes" : "no",
- info->flags & HAS_USB ? "yes" : "no",
- (loops_per_jiffy * HZ + 500) / 500000,
- ((loops_per_jiffy * HZ + 500) / 5000) % 100);
+ seq_printf(m,
+ "processor\t: %d\n"
+ "cpu\t\t: CRIS\n"
+ "cpu revision\t: %lu\n"
+ "cpu model\t: %s\n"
+ "cache size\t: %d KB\n"
+ "fpu\t\t: %s\n"
+ "mmu\t\t: %s\n"
+ "mmu DMA bug\t: %s\n"
+ "ethernet\t: %s Mbps\n"
+ "token ring\t: %s\n"
+ "scsi\t\t: %s\n"
+ "ata\t\t: %s\n"
+ "usb\t\t: %s\n"
+ "bogomips\t: %lu.%02lu\n\n",
+
+ cpu,
+ revision,
+ info->cpu_model,
+ info->cache_size,
+ info->flags & HAS_FPU ? "yes" : "no",
+ info->flags & HAS_MMU ? "yes" : "no",
+ info->flags & HAS_MMU_BUG ? "yes" : "no",
+ info->flags & HAS_ETHERNET100 ? "10/100" : "10",
+ info->flags & HAS_TOKENRING ? "4/16 Mbps" : "no",
+ info->flags & HAS_SCSI ? "yes" : "no",
+ info->flags & HAS_ATA ? "yes" : "no",
+ info->flags & HAS_USB ? "yes" : "no",
+ (loops_per_jiffy * HZ + 500) / 500000,
+ ((loops_per_jiffy * HZ + 500) / 5000) % 100);
+
+ return 0;
}

#endif /* CONFIG_PROC_FS */
--
2.1.2

2015-02-22 02:55:24

by Joe Perches

[permalink] [raw]
Subject: [PATCH 16/27] mfd: ab8500-debugfs: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
drivers/mfd/ab8500-debugfs.c | 196 ++++++++++++++++++++++++++-----------------
1 file changed, 121 insertions(+), 75 deletions(-)

diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c
index 9a8e185..cdd6f3d 100644
--- a/drivers/mfd/ab8500-debugfs.c
+++ b/drivers/mfd/ab8500-debugfs.c
@@ -1283,7 +1283,7 @@ static irqreturn_t ab8500_debug_handler(int irq, void *data)

/* Prints to seq_file or log_buf */
static int ab8500_registers_print(struct device *dev, u32 bank,
- struct seq_file *s)
+ struct seq_file *s)
{
unsigned int i;

@@ -1304,20 +1304,19 @@ static int ab8500_registers_print(struct device *dev, u32 bank,
}

if (s) {
- err = seq_printf(s,
- " [0x%02X/0x%02X]: 0x%02X\n",
- bank, reg, value);
- if (err < 0) {
- /* Error is not returned here since
- * the output is wanted in any case */
+ seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
+ bank, reg, value);
+ /* Error is not returned here since
+ * the output is wanted in any case */
+ if (seq_has_overflowed(s))
return 0;
- }
} else {
dev_info(dev, " [0x%02X/0x%02X]: 0x%02X\n",
bank, reg, value);
}
}
}
+
return 0;
}

@@ -1330,8 +1329,7 @@ static int ab8500_print_bank_registers(struct seq_file *s, void *p)

seq_printf(s, " bank 0x%02X:\n", bank);

- ab8500_registers_print(dev, bank, s);
- return 0;
+ return ab8500_registers_print(dev, bank, s);
}

static int ab8500_registers_open(struct inode *inode, struct file *file)
@@ -1355,9 +1353,12 @@ static int ab8500_print_all_banks(struct seq_file *s, void *p)
seq_puts(s, AB8500_NAME_STRING " register values:\n");

for (i = 0; i < AB8500_NUM_BANKS; i++) {
- seq_printf(s, " bank 0x%02X:\n", i);
+ int err;

- ab8500_registers_print(dev, i, s);
+ seq_printf(s, " bank 0x%02X:\n", i);
+ err = ab8500_registers_print(dev, i, s);
+ if (err)
+ return err;
}
return 0;
}
@@ -1458,7 +1459,8 @@ static const struct file_operations ab8500_all_banks_fops = {

static int ab8500_bank_print(struct seq_file *s, void *p)
{
- return seq_printf(s, "0x%02X\n", debug_bank);
+ seq_printf(s, "0x%02X\n", debug_bank);
+ return 0;
}

static int ab8500_bank_open(struct inode *inode, struct file *file)
@@ -1490,7 +1492,8 @@ static ssize_t ab8500_bank_write(struct file *file,

static int ab8500_address_print(struct seq_file *s, void *p)
{
- return seq_printf(s, "0x%02X\n", debug_address);
+ seq_printf(s, "0x%02X\n", debug_address);
+ return 0;
}

static int ab8500_address_open(struct inode *inode, struct file *file)
@@ -1598,7 +1601,8 @@ static int ab8500_interrupts_print(struct seq_file *s, void *p)
for (line = 0; line < num_interrupt_lines; line++) {
struct irq_desc *desc = irq_to_desc(line + irq_first);

- seq_printf(s, "%3i: %6i %4i", line,
+ seq_printf(s, "%3i: %6i %4i",
+ line,
num_interrupts[line],
num_wake_interrupts[line]);

@@ -1705,8 +1709,7 @@ static int ab8500_print_modem_registers(struct seq_file *s, void *p)
dev_err(dev, "ab->read fail %d\n", err);
return err;
}
- err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
- bank, reg, value);
+ seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n", bank, reg, value);
}
err = abx500_set_register_interruptible(dev,
AB8500_REGU_CTRL1, AB8500_SUPPLY_CONTROL_REG, orig_value);
@@ -1743,8 +1746,9 @@ static int ab8500_gpadc_bat_ctrl_print(struct seq_file *s, void *p)
bat_ctrl_convert = ab8500_gpadc_ad_to_voltage(gpadc,
BAT_CTRL, bat_ctrl_raw);

- return seq_printf(s, "%d,0x%X\n",
- bat_ctrl_convert, bat_ctrl_raw);
+ seq_printf(s, "%d,0x%X\n", bat_ctrl_convert, bat_ctrl_raw);
+
+ return 0;
}

static int ab8500_gpadc_bat_ctrl_open(struct inode *inode, struct file *file)
@@ -1773,8 +1777,9 @@ static int ab8500_gpadc_btemp_ball_print(struct seq_file *s, void *p)
btemp_ball_convert = ab8500_gpadc_ad_to_voltage(gpadc, BTEMP_BALL,
btemp_ball_raw);

- return seq_printf(s,
- "%d,0x%X\n", btemp_ball_convert, btemp_ball_raw);
+ seq_printf(s, "%d,0x%X\n", btemp_ball_convert, btemp_ball_raw);
+
+ return 0;
}

static int ab8500_gpadc_btemp_ball_open(struct inode *inode,
@@ -1804,8 +1809,9 @@ static int ab8500_gpadc_main_charger_v_print(struct seq_file *s, void *p)
main_charger_v_convert = ab8500_gpadc_ad_to_voltage(gpadc,
MAIN_CHARGER_V, main_charger_v_raw);

- return seq_printf(s, "%d,0x%X\n",
- main_charger_v_convert, main_charger_v_raw);
+ seq_printf(s, "%d,0x%X\n", main_charger_v_convert, main_charger_v_raw);
+
+ return 0;
}

static int ab8500_gpadc_main_charger_v_open(struct inode *inode,
@@ -1835,8 +1841,9 @@ static int ab8500_gpadc_acc_detect1_print(struct seq_file *s, void *p)
acc_detect1_convert = ab8500_gpadc_ad_to_voltage(gpadc, ACC_DETECT1,
acc_detect1_raw);

- return seq_printf(s, "%d,0x%X\n",
- acc_detect1_convert, acc_detect1_raw);
+ seq_printf(s, "%d,0x%X\n", acc_detect1_convert, acc_detect1_raw);
+
+ return 0;
}

static int ab8500_gpadc_acc_detect1_open(struct inode *inode,
@@ -1866,8 +1873,9 @@ static int ab8500_gpadc_acc_detect2_print(struct seq_file *s, void *p)
acc_detect2_convert = ab8500_gpadc_ad_to_voltage(gpadc,
ACC_DETECT2, acc_detect2_raw);

- return seq_printf(s, "%d,0x%X\n",
- acc_detect2_convert, acc_detect2_raw);
+ seq_printf(s, "%d,0x%X\n", acc_detect2_convert, acc_detect2_raw);
+
+ return 0;
}

static int ab8500_gpadc_acc_detect2_open(struct inode *inode,
@@ -1897,8 +1905,9 @@ static int ab8500_gpadc_aux1_print(struct seq_file *s, void *p)
aux1_convert = ab8500_gpadc_ad_to_voltage(gpadc, ADC_AUX1,
aux1_raw);

- return seq_printf(s, "%d,0x%X\n",
- aux1_convert, aux1_raw);
+ seq_printf(s, "%d,0x%X\n", aux1_convert, aux1_raw);
+
+ return 0;
}

static int ab8500_gpadc_aux1_open(struct inode *inode, struct file *file)
@@ -1926,8 +1935,9 @@ static int ab8500_gpadc_aux2_print(struct seq_file *s, void *p)
aux2_convert = ab8500_gpadc_ad_to_voltage(gpadc, ADC_AUX2,
aux2_raw);

- return seq_printf(s, "%d,0x%X\n",
- aux2_convert, aux2_raw);
+ seq_printf(s, "%d,0x%X\n", aux2_convert, aux2_raw);
+
+ return 0;
}

static int ab8500_gpadc_aux2_open(struct inode *inode, struct file *file)
@@ -1955,8 +1965,9 @@ static int ab8500_gpadc_main_bat_v_print(struct seq_file *s, void *p)
main_bat_v_convert = ab8500_gpadc_ad_to_voltage(gpadc, MAIN_BAT_V,
main_bat_v_raw);

- return seq_printf(s, "%d,0x%X\n",
- main_bat_v_convert, main_bat_v_raw);
+ seq_printf(s, "%d,0x%X\n", main_bat_v_convert, main_bat_v_raw);
+
+ return 0;
}

static int ab8500_gpadc_main_bat_v_open(struct inode *inode,
@@ -1986,8 +1997,9 @@ static int ab8500_gpadc_vbus_v_print(struct seq_file *s, void *p)
vbus_v_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBUS_V,
vbus_v_raw);

- return seq_printf(s, "%d,0x%X\n",
- vbus_v_convert, vbus_v_raw);
+ seq_printf(s, "%d,0x%X\n", vbus_v_convert, vbus_v_raw);
+
+ return 0;
}

static int ab8500_gpadc_vbus_v_open(struct inode *inode, struct file *file)
@@ -2015,8 +2027,9 @@ static int ab8500_gpadc_main_charger_c_print(struct seq_file *s, void *p)
main_charger_c_convert = ab8500_gpadc_ad_to_voltage(gpadc,
MAIN_CHARGER_C, main_charger_c_raw);

- return seq_printf(s, "%d,0x%X\n",
- main_charger_c_convert, main_charger_c_raw);
+ seq_printf(s, "%d,0x%X\n", main_charger_c_convert, main_charger_c_raw);
+
+ return 0;
}

static int ab8500_gpadc_main_charger_c_open(struct inode *inode,
@@ -2046,8 +2059,9 @@ static int ab8500_gpadc_usb_charger_c_print(struct seq_file *s, void *p)
usb_charger_c_convert = ab8500_gpadc_ad_to_voltage(gpadc,
USB_CHARGER_C, usb_charger_c_raw);

- return seq_printf(s, "%d,0x%X\n",
- usb_charger_c_convert, usb_charger_c_raw);
+ seq_printf(s, "%d,0x%X\n", usb_charger_c_convert, usb_charger_c_raw);
+
+ return 0;
}

static int ab8500_gpadc_usb_charger_c_open(struct inode *inode,
@@ -2077,8 +2091,9 @@ static int ab8500_gpadc_bk_bat_v_print(struct seq_file *s, void *p)
bk_bat_v_convert = ab8500_gpadc_ad_to_voltage(gpadc,
BK_BAT_V, bk_bat_v_raw);

- return seq_printf(s, "%d,0x%X\n",
- bk_bat_v_convert, bk_bat_v_raw);
+ seq_printf(s, "%d,0x%X\n", bk_bat_v_convert, bk_bat_v_raw);
+
+ return 0;
}

static int ab8500_gpadc_bk_bat_v_open(struct inode *inode, struct file *file)
@@ -2107,8 +2122,9 @@ static int ab8500_gpadc_die_temp_print(struct seq_file *s, void *p)
die_temp_convert = ab8500_gpadc_ad_to_voltage(gpadc, DIE_TEMP,
die_temp_raw);

- return seq_printf(s, "%d,0x%X\n",
- die_temp_convert, die_temp_raw);
+ seq_printf(s, "%d,0x%X\n", die_temp_convert, die_temp_raw);
+
+ return 0;
}

static int ab8500_gpadc_die_temp_open(struct inode *inode, struct file *file)
@@ -2137,8 +2153,9 @@ static int ab8500_gpadc_usb_id_print(struct seq_file *s, void *p)
usb_id_convert = ab8500_gpadc_ad_to_voltage(gpadc, USB_ID,
usb_id_raw);

- return seq_printf(s, "%d,0x%X\n",
- usb_id_convert, usb_id_raw);
+ seq_printf(s, "%d,0x%X\n", usb_id_convert, usb_id_raw);
+
+ return 0;
}

static int ab8500_gpadc_usb_id_open(struct inode *inode, struct file *file)
@@ -2166,8 +2183,9 @@ static int ab8540_gpadc_xtal_temp_print(struct seq_file *s, void *p)
xtal_temp_convert = ab8500_gpadc_ad_to_voltage(gpadc, XTAL_TEMP,
xtal_temp_raw);

- return seq_printf(s, "%d,0x%X\n",
- xtal_temp_convert, xtal_temp_raw);
+ seq_printf(s, "%d,0x%X\n", xtal_temp_convert, xtal_temp_raw);
+
+ return 0;
}

static int ab8540_gpadc_xtal_temp_open(struct inode *inode, struct file *file)
@@ -2197,8 +2215,9 @@ static int ab8540_gpadc_vbat_true_meas_print(struct seq_file *s, void *p)
ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
vbat_true_meas_raw);

- return seq_printf(s, "%d,0x%X\n",
- vbat_true_meas_convert, vbat_true_meas_raw);
+ seq_printf(s, "%d,0x%X\n", vbat_true_meas_convert, vbat_true_meas_raw);
+
+ return 0;
}

static int ab8540_gpadc_vbat_true_meas_open(struct inode *inode,
@@ -2233,9 +2252,13 @@ static int ab8540_gpadc_bat_ctrl_and_ibat_print(struct seq_file *s, void *p)
ibat_convert = ab8500_gpadc_ad_to_voltage(gpadc, IBAT_VIRTUAL_CHANNEL,
ibat_raw);

- return seq_printf(s, "%d,0x%X\n" "%d,0x%X\n",
- bat_ctrl_convert, bat_ctrl_raw,
- ibat_convert, ibat_raw);
+ seq_printf(s,
+ "%d,0x%X\n"
+ "%d,0x%X\n",
+ bat_ctrl_convert, bat_ctrl_raw,
+ ibat_convert, ibat_raw);
+
+ return 0;
}

static int ab8540_gpadc_bat_ctrl_and_ibat_open(struct inode *inode,
@@ -2269,9 +2292,13 @@ static int ab8540_gpadc_vbat_meas_and_ibat_print(struct seq_file *s, void *p)
ibat_convert = ab8500_gpadc_ad_to_voltage(gpadc, IBAT_VIRTUAL_CHANNEL,
ibat_raw);

- return seq_printf(s, "%d,0x%X\n" "%d,0x%X\n",
- vbat_meas_convert, vbat_meas_raw,
- ibat_convert, ibat_raw);
+ seq_printf(s,
+ "%d,0x%X\n"
+ "%d,0x%X\n",
+ vbat_meas_convert, vbat_meas_raw,
+ ibat_convert, ibat_raw);
+
+ return 0;
}

static int ab8540_gpadc_vbat_meas_and_ibat_open(struct inode *inode,
@@ -2307,9 +2334,13 @@ static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s,
ibat_convert = ab8500_gpadc_ad_to_voltage(gpadc, IBAT_VIRTUAL_CHANNEL,
ibat_raw);

- return seq_printf(s, "%d,0x%X\n" "%d,0x%X\n",
- vbat_true_meas_convert, vbat_true_meas_raw,
- ibat_convert, ibat_raw);
+ seq_printf(s,
+ "%d,0x%X\n"
+ "%d,0x%X\n",
+ vbat_true_meas_convert, vbat_true_meas_raw,
+ ibat_convert, ibat_raw);
+
+ return 0;
}

static int ab8540_gpadc_vbat_true_meas_and_ibat_open(struct inode *inode,
@@ -2344,9 +2375,13 @@ static int ab8540_gpadc_bat_temp_and_ibat_print(struct seq_file *s, void *p)
ibat_convert = ab8500_gpadc_ad_to_voltage(gpadc, IBAT_VIRTUAL_CHANNEL,
ibat_raw);

- return seq_printf(s, "%d,0x%X\n" "%d,0x%X\n",
- bat_temp_convert, bat_temp_raw,
- ibat_convert, ibat_raw);
+ seq_printf(s,
+ "%d,0x%X\n"
+ "%d,0x%X\n",
+ bat_temp_convert, bat_temp_raw,
+ ibat_convert, ibat_raw);
+
+ return 0;
}

static int ab8540_gpadc_bat_temp_and_ibat_open(struct inode *inode,
@@ -2373,16 +2408,19 @@ static int ab8540_gpadc_otp_cal_print(struct seq_file *s, void *p)
gpadc = ab8500_gpadc_get("ab8500-gpadc.0");
ab8540_gpadc_get_otp(gpadc, &vmain_l, &vmain_h, &btemp_l, &btemp_h,
&vbat_l, &vbat_h, &ibat_l, &ibat_h);
- return seq_printf(s, "VMAIN_L:0x%X\n"
- "VMAIN_H:0x%X\n"
- "BTEMP_L:0x%X\n"
- "BTEMP_H:0x%X\n"
- "VBAT_L:0x%X\n"
- "VBAT_H:0x%X\n"
- "IBAT_L:0x%X\n"
- "IBAT_H:0x%X\n",
- vmain_l, vmain_h, btemp_l, btemp_h,
- vbat_l, vbat_h, ibat_l, ibat_h);
+ seq_printf(s,
+ "VMAIN_L:0x%X\n"
+ "VMAIN_H:0x%X\n"
+ "BTEMP_L:0x%X\n"
+ "BTEMP_H:0x%X\n"
+ "VBAT_L:0x%X\n"
+ "VBAT_H:0x%X\n"
+ "IBAT_L:0x%X\n"
+ "IBAT_H:0x%X\n",
+ vmain_l, vmain_h, btemp_l, btemp_h,
+ vbat_l, vbat_h, ibat_l, ibat_h);
+
+ return 0;
}

static int ab8540_gpadc_otp_cal_open(struct inode *inode, struct file *file)
@@ -2400,7 +2438,9 @@ static const struct file_operations ab8540_gpadc_otp_calib_fops = {

static int ab8500_gpadc_avg_sample_print(struct seq_file *s, void *p)
{
- return seq_printf(s, "%d\n", avg_sample);
+ seq_printf(s, "%d\n", avg_sample);
+
+ return 0;
}

static int ab8500_gpadc_avg_sample_open(struct inode *inode, struct file *file)
@@ -2445,7 +2485,9 @@ static const struct file_operations ab8500_gpadc_avg_sample_fops = {

static int ab8500_gpadc_trig_edge_print(struct seq_file *s, void *p)
{
- return seq_printf(s, "%d\n", trig_edge);
+ seq_printf(s, "%d\n", trig_edge);
+
+ return 0;
}

static int ab8500_gpadc_trig_edge_open(struct inode *inode, struct file *file)
@@ -2490,7 +2532,9 @@ static const struct file_operations ab8500_gpadc_trig_edge_fops = {

static int ab8500_gpadc_trig_timer_print(struct seq_file *s, void *p)
{
- return seq_printf(s, "%d\n", trig_timer);
+ seq_printf(s, "%d\n", trig_timer);
+
+ return 0;
}

static int ab8500_gpadc_trig_timer_open(struct inode *inode, struct file *file)
@@ -2533,7 +2577,9 @@ static const struct file_operations ab8500_gpadc_trig_timer_fops = {

static int ab8500_gpadc_conv_type_print(struct seq_file *s, void *p)
{
- return seq_printf(s, "%d\n", conv_type);
+ seq_printf(s, "%d\n", conv_type);
+
+ return 0;
}

static int ab8500_gpadc_conv_type_open(struct inode *inode, struct file *file)
--
2.1.2

2015-02-22 02:55:27

by Joe Perches

[permalink] [raw]
Subject: [PATCH 17/27] staging: i2o: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
drivers/staging/i2o/i2o_proc.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/i2o/i2o_proc.c b/drivers/staging/i2o/i2o_proc.c
index ad84f33..0186c62 100644
--- a/drivers/staging/i2o/i2o_proc.c
+++ b/drivers/staging/i2o/i2o_proc.c
@@ -266,16 +266,22 @@ static int i2o_report_query_status(struct seq_file *seq, int block_status,
{
switch (block_status) {
case -ETIMEDOUT:
- return seq_printf(seq, "Timeout reading group %s.\n", group);
+ seq_printf(seq, "Timeout reading group %s.\n", group);
+ break;
case -ENOMEM:
- return seq_printf(seq, "No free memory to read the table.\n");
+ seq_puts(seq, "No free memory to read the table.\n");
+ break;
case -I2O_PARAMS_STATUS_INVALID_GROUP_ID:
- return seq_printf(seq, "Group %s not supported.\n", group);
+ seq_printf(seq, "Group %s not supported.\n", group);
+ break;
default:
- return seq_printf(seq,
- "Error reading group %s. BlockStatus 0x%02X\n",
- group, -block_status);
+ seq_printf(seq,
+ "Error reading group %s. BlockStatus 0x%02X\n",
+ group, -block_status);
+ break;
}
+
+ return 0;
}

static char *bus_strings[] = {
--
2.1.2

2015-02-22 02:57:53

by Joe Perches

[permalink] [raw]
Subject: [PATCH 18/27] staging: rtl8192x: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
drivers/staging/rtl8192e/rtllib_module.c | 4 +++-
drivers/staging/rtl8192u/ieee80211/ieee80211_module.c | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl8192e/rtllib_module.c
index 0cf3809..248cc0d 100644
--- a/drivers/staging/rtl8192e/rtllib_module.c
+++ b/drivers/staging/rtl8192e/rtllib_module.c
@@ -207,7 +207,9 @@ static struct proc_dir_entry *rtllib_proc;

static int show_debug_level(struct seq_file *m, void *v)
{
- return seq_printf(m, "0x%08X\n", rtllib_debug_level);
+ seq_printf(m, "0x%08X\n", rtllib_debug_level);
+
+ return 0;
}

static ssize_t write_debug_level(struct file *file, const char __user *buffer,
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
index afbd09d..330d206 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
@@ -245,7 +245,9 @@ static struct proc_dir_entry *ieee80211_proc;

static int show_debug_level(struct seq_file *m, void *v)
{
- return seq_printf(m, "0x%08X\n", ieee80211_debug_level);
+ seq_printf(m, "0x%08X\n", ieee80211_debug_level);
+
+ return 0;
}

static ssize_t write_debug_level(struct file *file, const char __user *buffer,
--
2.1.2

2015-02-22 02:55:32

by Joe Perches

[permalink] [raw]
Subject: [PATCH 19/27] s390: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
arch/s390/pci/pci_debug.c | 6 ++++--
drivers/s390/cio/blacklist.c | 12 +++++++-----
2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/arch/s390/pci/pci_debug.c b/arch/s390/pci/pci_debug.c
index 3229a2e..c22d440 100644
--- a/arch/s390/pci/pci_debug.c
+++ b/arch/s390/pci/pci_debug.c
@@ -45,8 +45,10 @@ static int pci_perf_show(struct seq_file *m, void *v)

if (!zdev)
return 0;
- if (!zdev->fmb)
- return seq_printf(m, "FMB statistics disabled\n");
+ if (!zdev->fmb) {
+ seq_puts(m, "FMB statistics disabled\n");
+ return 0;
+ }

/* header */
seq_printf(m, "FMB @ %p\n", zdev->fmb);
diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c
index b3f791b..20314aa 100644
--- a/drivers/s390/cio/blacklist.c
+++ b/drivers/s390/cio/blacklist.c
@@ -330,18 +330,20 @@ cio_ignore_proc_seq_show(struct seq_file *s, void *it)
if (!iter->in_range) {
/* First device in range. */
if ((iter->devno == __MAX_SUBCHANNEL) ||
- !is_blacklisted(iter->ssid, iter->devno + 1))
+ !is_blacklisted(iter->ssid, iter->devno + 1)) {
/* Singular device. */
- return seq_printf(s, "0.%x.%04x\n",
- iter->ssid, iter->devno);
+ seq_printf(s, "0.%x.%04x\n", iter->ssid, iter->devno);
+ return 0;
+ }
iter->in_range = 1;
- return seq_printf(s, "0.%x.%04x-", iter->ssid, iter->devno);
+ seq_printf(s, "0.%x.%04x-", iter->ssid, iter->devno);
+ return 0;
}
if ((iter->devno == __MAX_SUBCHANNEL) ||
!is_blacklisted(iter->ssid, iter->devno + 1)) {
/* Last device in range. */
iter->in_range = 0;
- return seq_printf(s, "0.%x.%04x\n", iter->ssid, iter->devno);
+ seq_printf(s, "0.%x.%04x\n", iter->ssid, iter->devno);
}
return 0;
}
--
2.1.2

2015-02-22 02:57:28

by Joe Perches

[permalink] [raw]
Subject: [PATCH 20/27] i8k: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
drivers/char/i8k.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c
index 24cc4ed..a43048b 100644
--- a/drivers/char/i8k.c
+++ b/drivers/char/i8k.c
@@ -510,13 +510,15 @@ static int i8k_proc_show(struct seq_file *seq, void *offset)
* 9) AC power
* 10) Fn Key status
*/
- return seq_printf(seq, "%s %s %s %d %d %d %d %d %d %d\n",
- I8K_PROC_FMT,
- bios_version,
- i8k_get_dmi_data(DMI_PRODUCT_SERIAL),
- cpu_temp,
- left_fan, right_fan, left_speed, right_speed,
- ac_power, fn_key);
+ seq_printf(seq, "%s %s %s %d %d %d %d %d %d %d\n",
+ I8K_PROC_FMT,
+ bios_version,
+ i8k_get_dmi_data(DMI_PRODUCT_SERIAL),
+ cpu_temp,
+ left_fan, right_fan, left_speed, right_speed,
+ ac_power, fn_key);
+
+ return 0;
}

static int i8k_open_fs(struct inode *inode, struct file *file)
--
2.1.2

2015-02-22 02:55:37

by Joe Perches

[permalink] [raw]
Subject: [PATCH 21/27] watchdog: bcm281xx: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
drivers/watchdog/bcm_kona_wdt.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/watchdog/bcm_kona_wdt.c b/drivers/watchdog/bcm_kona_wdt.c
index 4e37db3..22d8ae6 100644
--- a/drivers/watchdog/bcm_kona_wdt.c
+++ b/drivers/watchdog/bcm_kona_wdt.c
@@ -99,12 +99,14 @@ static int secure_register_read(struct bcm_kona_wdt *wdt, uint32_t offset)

static int bcm_kona_wdt_dbg_show(struct seq_file *s, void *data)
{
- int ctl_val, cur_val, ret;
+ int ctl_val, cur_val;
unsigned long flags;
struct bcm_kona_wdt *wdt = s->private;

- if (!wdt)
- return seq_puts(s, "No device pointer\n");
+ if (!wdt) {
+ seq_puts(s, "No device pointer\n");
+ return 0;
+ }

spin_lock_irqsave(&wdt->lock, flags);
ctl_val = secure_register_read(wdt, SECWDOG_CTRL_REG);
@@ -112,7 +114,7 @@ static int bcm_kona_wdt_dbg_show(struct seq_file *s, void *data)
spin_unlock_irqrestore(&wdt->lock, flags);

if (ctl_val < 0 || cur_val < 0) {
- ret = seq_puts(s, "Error accessing hardware\n");
+ seq_puts(s, "Error accessing hardware\n");
} else {
int ctl, cur, ctl_sec, cur_sec, res;

@@ -121,15 +123,18 @@ static int bcm_kona_wdt_dbg_show(struct seq_file *s, void *data)
cur = cur_val & SECWDOG_COUNT_MASK;
ctl_sec = TICKS_TO_SECS(ctl, wdt);
cur_sec = TICKS_TO_SECS(cur, wdt);
- ret = seq_printf(s, "Resolution: %d / %d\n"
- "Control: %d s / %d (%#x) ticks\n"
- "Current: %d s / %d (%#x) ticks\n"
- "Busy count: %lu\n", res,
- wdt->resolution, ctl_sec, ctl, ctl, cur_sec,
- cur, cur, wdt->busy_count);
+ seq_printf(s,
+ "Resolution: %d / %d\n"
+ "Control: %d s / %d (%#x) ticks\n"
+ "Current: %d s / %d (%#x) ticks\n"
+ "Busy count: %lu\n",
+ res, wdt->resolution,
+ ctl_sec, ctl, ctl,
+ cur_sec, cur, cur,
+ wdt->busy_count);
}

- return ret;
+ return 0;
}

static int bcm_kona_dbg_open(struct inode *inode, struct file *file)
--
2.1.2

2015-02-22 02:55:41

by Joe Perches

[permalink] [raw]
Subject: [PATCH 22/27] proc: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
fs/proc/array.c | 4 ++-
fs/proc/base.c | 82 +++++++++++++++++++++++++++++++++------------------------
2 files changed, 50 insertions(+), 36 deletions(-)

diff --git a/fs/proc/array.c b/fs/proc/array.c
index 1295a00..e49353b 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -614,7 +614,9 @@ static int children_seq_show(struct seq_file *seq, void *v)
pid_t pid;

pid = pid_nr_ns(v, inode->i_sb->s_fs_info);
- return seq_printf(seq, "%d ", pid);
+ seq_printf(seq, "%d ", pid);
+
+ return 0;
}

static void *children_seq_start(struct seq_file *seq, loff_t *pos)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 3f3d7ae..7a3b82f 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -238,13 +238,15 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,

wchan = get_wchan(task);

- if (lookup_symbol_name(wchan, symname) < 0)
+ if (lookup_symbol_name(wchan, symname) < 0) {
if (!ptrace_may_access(task, PTRACE_MODE_READ))
return 0;
- else
- return seq_printf(m, "%lu", wchan);
- else
- return seq_printf(m, "%s", symname);
+ seq_printf(m, "%lu", wchan);
+ } else {
+ seq_printf(m, "%s", symname);
+ }
+
+ return 0;
}
#endif /* CONFIG_KALLSYMS */

@@ -309,10 +311,12 @@ static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns,
static int proc_pid_schedstat(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *task)
{
- return seq_printf(m, "%llu %llu %lu\n",
- (unsigned long long)task->se.sum_exec_runtime,
- (unsigned long long)task->sched_info.run_delay,
- task->sched_info.pcount);
+ seq_printf(m, "%llu %llu %lu\n",
+ (unsigned long long)task->se.sum_exec_runtime,
+ (unsigned long long)task->sched_info.run_delay,
+ task->sched_info.pcount);
+
+ return 0;
}
#endif

@@ -387,7 +391,9 @@ static int proc_oom_score(struct seq_file *m, struct pid_namespace *ns,
points = oom_badness(task, NULL, NULL, totalpages) *
1000 / totalpages;
read_unlock(&tasklist_lock);
- return seq_printf(m, "%lu\n", points);
+ seq_printf(m, "%lu\n", points);
+
+ return 0;
}

struct limit_names {
@@ -432,15 +438,15 @@ static int proc_pid_limits(struct seq_file *m, struct pid_namespace *ns,
* print the file header
*/
seq_printf(m, "%-25s %-20s %-20s %-10s\n",
- "Limit", "Soft Limit", "Hard Limit", "Units");
+ "Limit", "Soft Limit", "Hard Limit", "Units");

for (i = 0; i < RLIM_NLIMITS; i++) {
if (rlim[i].rlim_cur == RLIM_INFINITY)
seq_printf(m, "%-25s %-20s ",
- lnames[i].name, "unlimited");
+ lnames[i].name, "unlimited");
else
seq_printf(m, "%-25s %-20lu ",
- lnames[i].name, rlim[i].rlim_cur);
+ lnames[i].name, rlim[i].rlim_cur);

if (rlim[i].rlim_max == RLIM_INFINITY)
seq_printf(m, "%-20s ", "unlimited");
@@ -462,7 +468,9 @@ static int proc_pid_syscall(struct seq_file *m, struct pid_namespace *ns,
{
long nr;
unsigned long args[6], sp, pc;
- int res = lock_trace(task);
+ int res;
+
+ res = lock_trace(task);
if (res)
return res;

@@ -477,7 +485,8 @@ static int proc_pid_syscall(struct seq_file *m, struct pid_namespace *ns,
args[0], args[1], args[2], args[3], args[4], args[5],
sp, pc);
unlock_trace(task);
- return res;
+
+ return 0;
}
#endif /* CONFIG_HAVE_ARCH_TRACEHOOK */

@@ -2002,12 +2011,13 @@ static int show_timer(struct seq_file *m, void *v)
notify = timer->it_sigev_notify;

seq_printf(m, "ID: %d\n", timer->it_id);
- seq_printf(m, "signal: %d/%p\n", timer->sigq->info.si_signo,
- timer->sigq->info.si_value.sival_ptr);
+ seq_printf(m, "signal: %d/%p\n",
+ timer->sigq->info.si_signo,
+ timer->sigq->info.si_value.sival_ptr);
seq_printf(m, "notify: %s/%s.%d\n",
- nstr[notify & ~SIGEV_THREAD_ID],
- (notify & SIGEV_THREAD_ID) ? "tid" : "pid",
- pid_nr_ns(timer->it_pid, tp->ns));
+ nstr[notify & ~SIGEV_THREAD_ID],
+ (notify & SIGEV_THREAD_ID) ? "tid" : "pid",
+ pid_nr_ns(timer->it_pid, tp->ns));
seq_printf(m, "ClockID: %d\n", timer->it_clock);

return 0;
@@ -2352,21 +2362,23 @@ static int do_io_accounting(struct task_struct *task, struct seq_file *m, int wh

unlock_task_sighand(task, &flags);
}
- result = seq_printf(m,
- "rchar: %llu\n"
- "wchar: %llu\n"
- "syscr: %llu\n"
- "syscw: %llu\n"
- "read_bytes: %llu\n"
- "write_bytes: %llu\n"
- "cancelled_write_bytes: %llu\n",
- (unsigned long long)acct.rchar,
- (unsigned long long)acct.wchar,
- (unsigned long long)acct.syscr,
- (unsigned long long)acct.syscw,
- (unsigned long long)acct.read_bytes,
- (unsigned long long)acct.write_bytes,
- (unsigned long long)acct.cancelled_write_bytes);
+ seq_printf(m,
+ "rchar: %llu\n"
+ "wchar: %llu\n"
+ "syscr: %llu\n"
+ "syscw: %llu\n"
+ "read_bytes: %llu\n"
+ "write_bytes: %llu\n"
+ "cancelled_write_bytes: %llu\n",
+ (unsigned long long)acct.rchar,
+ (unsigned long long)acct.wchar,
+ (unsigned long long)acct.syscr,
+ (unsigned long long)acct.syscw,
+ (unsigned long long)acct.read_bytes,
+ (unsigned long long)acct.write_bytes,
+ (unsigned long long)acct.cancelled_write_bytes);
+ result = 0;
+
out_unlock:
mutex_unlock(&task->signal->cred_guard_mutex);
return result;
--
2.1.2

2015-02-22 02:56:56

by Joe Perches

[permalink] [raw]
Subject: [PATCH 23/27] cgroup: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
kernel/cgroup.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 29a7b2c..e8c7e8c 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4199,7 +4199,9 @@ static void *cgroup_pidlist_next(struct seq_file *s, void *v, loff_t *pos)

static int cgroup_pidlist_show(struct seq_file *s, void *v)
{
- return seq_printf(s, "%d\n", *(int *)v);
+ seq_printf(s, "%d\n", *(int *)v);
+
+ return 0;
}

static u64 cgroup_read_notify_on_release(struct cgroup_subsys_state *css,
--
2.1.2

2015-02-22 02:56:39

by Joe Perches

[permalink] [raw]
Subject: [PATCH 24/27] tracing: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Miscellanea:

o Remove unused return value from trace_lookup_stack

Signed-off-by: Joe Perches <[email protected]>
---
kernel/trace/trace_stack.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index c3e4fcf..3f34496 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -327,11 +327,11 @@ static void t_stop(struct seq_file *m, void *p)
local_irq_enable();
}

-static int trace_lookup_stack(struct seq_file *m, long i)
+static void trace_lookup_stack(struct seq_file *m, long i)
{
unsigned long addr = stack_dump_trace[i];

- return seq_printf(m, "%pS\n", (void *)addr);
+ seq_printf(m, "%pS\n", (void *)addr);
}

static void print_disabled(struct seq_file *m)
--
2.1.2

2015-02-22 02:55:47

by Joe Perches

[permalink] [raw]
Subject: [PATCH 25/27] lru_cache: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
lib/lru_cache.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/lru_cache.c b/lib/lru_cache.c
index 852c81e..028f5d9 100644
--- a/lib/lru_cache.c
+++ b/lib/lru_cache.c
@@ -247,10 +247,11 @@ size_t lc_seq_printf_stats(struct seq_file *seq, struct lru_cache *lc)
* progress) and "changed", when this in fact lead to an successful
* update of the cache.
*/
- return seq_printf(seq, "\t%s: used:%u/%u "
- "hits:%lu misses:%lu starving:%lu locked:%lu changed:%lu\n",
- lc->name, lc->used, lc->nr_elements,
- lc->hits, lc->misses, lc->starving, lc->locked, lc->changed);
+ seq_printf(seq, "\t%s: used:%u/%u hits:%lu misses:%lu starving:%lu locked:%lu changed:%lu\n",
+ lc->name, lc->used, lc->nr_elements,
+ lc->hits, lc->misses, lc->starving, lc->locked, lc->changed);
+
+ return 0;
}

static struct hlist_head *lc_hash_slot(struct lru_cache *lc, unsigned int enr)
--
2.1.2

2015-02-22 02:55:49

by Joe Perches

[permalink] [raw]
Subject: [PATCH 26/27] parisc: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
drivers/parisc/ccio-dma.c | 54 ++++++++++++++---------------
drivers/parisc/sba_iommu.c | 86 ++++++++++++++++++++++------------------------
2 files changed, 68 insertions(+), 72 deletions(-)

diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
index 8b490d7..6bc1680 100644
--- a/drivers/parisc/ccio-dma.c
+++ b/drivers/parisc/ccio-dma.c
@@ -1021,7 +1021,6 @@ static struct hppa_dma_ops ccio_ops = {
#ifdef CONFIG_PROC_FS
static int ccio_proc_info(struct seq_file *m, void *p)
{
- int len = 0;
struct ioc *ioc = ioc_list;

while (ioc != NULL) {
@@ -1031,22 +1030,22 @@ static int ccio_proc_info(struct seq_file *m, void *p)
int j;
#endif

- len += seq_printf(m, "%s\n", ioc->name);
+ seq_printf(m, "%s\n", ioc->name);

- len += seq_printf(m, "Cujo 2.0 bug : %s\n",
- (ioc->cujo20_bug ? "yes" : "no"));
+ seq_printf(m, "Cujo 2.0 bug : %s\n",
+ (ioc->cujo20_bug ? "yes" : "no"));

- len += seq_printf(m, "IO PDIR size : %d bytes (%d entries)\n",
- total_pages * 8, total_pages);
+ seq_printf(m, "IO PDIR size : %d bytes (%d entries)\n",
+ total_pages * 8, total_pages);

#ifdef CCIO_COLLECT_STATS
- len += seq_printf(m, "IO PDIR entries : %ld free %ld used (%d%%)\n",
- total_pages - ioc->used_pages, ioc->used_pages,
- (int)(ioc->used_pages * 100 / total_pages));
+ seq_printf(m, "IO PDIR entries : %ld free %ld used (%d%%)\n",
+ total_pages - ioc->used_pages, ioc->used_pages,
+ (int)(ioc->used_pages * 100 / total_pages));
#endif

- len += seq_printf(m, "Resource bitmap : %d bytes (%d pages)\n",
- ioc->res_size, total_pages);
+ seq_printf(m, "Resource bitmap : %d bytes (%d pages)\n",
+ ioc->res_size, total_pages);

#ifdef CCIO_COLLECT_STATS
min = max = ioc->avg_search[0];
@@ -1058,26 +1057,26 @@ static int ccio_proc_info(struct seq_file *m, void *p)
min = ioc->avg_search[j];
}
avg /= CCIO_SEARCH_SAMPLE;
- len += seq_printf(m, " Bitmap search : %ld/%ld/%ld (min/avg/max CPU Cycles)\n",
- min, avg, max);
+ seq_printf(m, " Bitmap search : %ld/%ld/%ld (min/avg/max CPU Cycles)\n",
+ min, avg, max);

- len += seq_printf(m, "pci_map_single(): %8ld calls %8ld pages (avg %d/1000)\n",
- ioc->msingle_calls, ioc->msingle_pages,
- (int)((ioc->msingle_pages * 1000)/ioc->msingle_calls));
+ seq_printf(m, "pci_map_single(): %8ld calls %8ld pages (avg %d/1000)\n",
+ ioc->msingle_calls, ioc->msingle_pages,
+ (int)((ioc->msingle_pages * 1000)/ioc->msingle_calls));

/* KLUGE - unmap_sg calls unmap_single for each mapped page */
min = ioc->usingle_calls - ioc->usg_calls;
max = ioc->usingle_pages - ioc->usg_pages;
- len += seq_printf(m, "pci_unmap_single: %8ld calls %8ld pages (avg %d/1000)\n",
- min, max, (int)((max * 1000)/min));
+ seq_printf(m, "pci_unmap_single: %8ld calls %8ld pages (avg %d/1000)\n",
+ min, max, (int)((max * 1000)/min));

- len += seq_printf(m, "pci_map_sg() : %8ld calls %8ld pages (avg %d/1000)\n",
- ioc->msg_calls, ioc->msg_pages,
- (int)((ioc->msg_pages * 1000)/ioc->msg_calls));
+ seq_printf(m, "pci_map_sg() : %8ld calls %8ld pages (avg %d/1000)\n",
+ ioc->msg_calls, ioc->msg_pages,
+ (int)((ioc->msg_pages * 1000)/ioc->msg_calls));

- len += seq_printf(m, "pci_unmap_sg() : %8ld calls %8ld pages (avg %d/1000)\n\n\n",
- ioc->usg_calls, ioc->usg_pages,
- (int)((ioc->usg_pages * 1000)/ioc->usg_calls));
+ seq_printf(m, "pci_unmap_sg() : %8ld calls %8ld pages (avg %d/1000)\n\n\n",
+ ioc->usg_calls, ioc->usg_pages,
+ (int)((ioc->usg_pages * 1000)/ioc->usg_calls));
#endif /* CCIO_COLLECT_STATS */

ioc = ioc->next;
@@ -1101,7 +1100,6 @@ static const struct file_operations ccio_proc_info_fops = {

static int ccio_proc_bitmap_info(struct seq_file *m, void *p)
{
- int len = 0;
struct ioc *ioc = ioc_list;

while (ioc != NULL) {
@@ -1110,11 +1108,11 @@ static int ccio_proc_bitmap_info(struct seq_file *m, void *p)

for (j = 0; j < (ioc->res_size / sizeof(u32)); j++) {
if ((j & 7) == 0)
- len += seq_puts(m, "\n ");
- len += seq_printf(m, "%08x", *res_ptr);
+ seq_puts(m, "\n ");
+ seq_printf(m, "%08x", *res_ptr);
res_ptr++;
}
- len += seq_puts(m, "\n\n");
+ seq_puts(m, "\n\n");
ioc = ioc->next;
break; /* XXX - remove me */
}
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
index 1ff1b67..f074712 100644
--- a/drivers/parisc/sba_iommu.c
+++ b/drivers/parisc/sba_iommu.c
@@ -1774,37 +1774,35 @@ static int sba_proc_info(struct seq_file *m, void *p)
#ifdef SBA_COLLECT_STATS
unsigned long avg = 0, min, max;
#endif
- int i, len = 0;
-
- len += seq_printf(m, "%s rev %d.%d\n",
- sba_dev->name,
- (sba_dev->hw_rev & 0x7) + 1,
- (sba_dev->hw_rev & 0x18) >> 3
- );
- len += seq_printf(m, "IO PDIR size : %d bytes (%d entries)\n",
- (int) ((ioc->res_size << 3) * sizeof(u64)), /* 8 bits/byte */
- total_pages);
-
- len += seq_printf(m, "Resource bitmap : %d bytes (%d pages)\n",
- ioc->res_size, ioc->res_size << 3); /* 8 bits per byte */
-
- len += seq_printf(m, "LMMIO_BASE/MASK/ROUTE %08x %08x %08x\n",
- READ_REG32(sba_dev->sba_hpa + LMMIO_DIST_BASE),
- READ_REG32(sba_dev->sba_hpa + LMMIO_DIST_MASK),
- READ_REG32(sba_dev->sba_hpa + LMMIO_DIST_ROUTE)
- );
+ int i;
+
+ seq_printf(m, "%s rev %d.%d\n",
+ sba_dev->name,
+ (sba_dev->hw_rev & 0x7) + 1,
+ (sba_dev->hw_rev & 0x18) >> 3);
+ seq_printf(m, "IO PDIR size : %d bytes (%d entries)\n",
+ (int)((ioc->res_size << 3) * sizeof(u64)), /* 8 bits/byte */
+ total_pages);
+
+ seq_printf(m, "Resource bitmap : %d bytes (%d pages)\n",
+ ioc->res_size, ioc->res_size << 3); /* 8 bits per byte */
+
+ seq_printf(m, "LMMIO_BASE/MASK/ROUTE %08x %08x %08x\n",
+ READ_REG32(sba_dev->sba_hpa + LMMIO_DIST_BASE),
+ READ_REG32(sba_dev->sba_hpa + LMMIO_DIST_MASK),
+ READ_REG32(sba_dev->sba_hpa + LMMIO_DIST_ROUTE));

for (i=0; i<4; i++)
- len += seq_printf(m, "DIR%d_BASE/MASK/ROUTE %08x %08x %08x\n", i,
- READ_REG32(sba_dev->sba_hpa + LMMIO_DIRECT0_BASE + i*0x18),
- READ_REG32(sba_dev->sba_hpa + LMMIO_DIRECT0_MASK + i*0x18),
- READ_REG32(sba_dev->sba_hpa + LMMIO_DIRECT0_ROUTE + i*0x18)
- );
+ seq_printf(m, "DIR%d_BASE/MASK/ROUTE %08x %08x %08x\n",
+ i,
+ READ_REG32(sba_dev->sba_hpa + LMMIO_DIRECT0_BASE + i*0x18),
+ READ_REG32(sba_dev->sba_hpa + LMMIO_DIRECT0_MASK + i*0x18),
+ READ_REG32(sba_dev->sba_hpa + LMMIO_DIRECT0_ROUTE + i*0x18));

#ifdef SBA_COLLECT_STATS
- len += seq_printf(m, "IO PDIR entries : %ld free %ld used (%d%%)\n",
- total_pages - ioc->used_pages, ioc->used_pages,
- (int) (ioc->used_pages * 100 / total_pages));
+ seq_printf(m, "IO PDIR entries : %ld free %ld used (%d%%)\n",
+ total_pages - ioc->used_pages, ioc->used_pages,
+ (int)(ioc->used_pages * 100 / total_pages));

min = max = ioc->avg_search[0];
for (i = 0; i < SBA_SEARCH_SAMPLE; i++) {
@@ -1813,26 +1811,26 @@ static int sba_proc_info(struct seq_file *m, void *p)
if (ioc->avg_search[i] < min) min = ioc->avg_search[i];
}
avg /= SBA_SEARCH_SAMPLE;
- len += seq_printf(m, " Bitmap search : %ld/%ld/%ld (min/avg/max CPU Cycles)\n",
- min, avg, max);
+ seq_printf(m, " Bitmap search : %ld/%ld/%ld (min/avg/max CPU Cycles)\n",
+ min, avg, max);

- len += seq_printf(m, "pci_map_single(): %12ld calls %12ld pages (avg %d/1000)\n",
- ioc->msingle_calls, ioc->msingle_pages,
- (int) ((ioc->msingle_pages * 1000)/ioc->msingle_calls));
+ seq_printf(m, "pci_map_single(): %12ld calls %12ld pages (avg %d/1000)\n",
+ ioc->msingle_calls, ioc->msingle_pages,
+ (int)((ioc->msingle_pages * 1000)/ioc->msingle_calls));

/* KLUGE - unmap_sg calls unmap_single for each mapped page */
min = ioc->usingle_calls;
max = ioc->usingle_pages - ioc->usg_pages;
- len += seq_printf(m, "pci_unmap_single: %12ld calls %12ld pages (avg %d/1000)\n",
- min, max, (int) ((max * 1000)/min));
+ seq_printf(m, "pci_unmap_single: %12ld calls %12ld pages (avg %d/1000)\n",
+ min, max, (int)((max * 1000)/min));

- len += seq_printf(m, "pci_map_sg() : %12ld calls %12ld pages (avg %d/1000)\n",
- ioc->msg_calls, ioc->msg_pages,
- (int) ((ioc->msg_pages * 1000)/ioc->msg_calls));
+ seq_printf(m, "pci_map_sg() : %12ld calls %12ld pages (avg %d/1000)\n",
+ ioc->msg_calls, ioc->msg_pages,
+ (int)((ioc->msg_pages * 1000)/ioc->msg_calls));

- len += seq_printf(m, "pci_unmap_sg() : %12ld calls %12ld pages (avg %d/1000)\n",
- ioc->usg_calls, ioc->usg_pages,
- (int) ((ioc->usg_pages * 1000)/ioc->usg_calls));
+ seq_printf(m, "pci_unmap_sg() : %12ld calls %12ld pages (avg %d/1000)\n",
+ ioc->usg_calls, ioc->usg_pages,
+ (int)((ioc->usg_pages * 1000)/ioc->usg_calls));
#endif

return 0;
@@ -1858,14 +1856,14 @@ sba_proc_bitmap_info(struct seq_file *m, void *p)
struct sba_device *sba_dev = sba_list;
struct ioc *ioc = &sba_dev->ioc[0]; /* FIXME: Multi-IOC support! */
unsigned int *res_ptr = (unsigned int *)ioc->res_map;
- int i, len = 0;
+ int i;

for (i = 0; i < (ioc->res_size/sizeof(unsigned int)); ++i, ++res_ptr) {
if ((i & 7) == 0)
- len += seq_printf(m, "\n ");
- len += seq_printf(m, " %08x", *res_ptr);
+ seq_puts(m, "\n ");
+ seq_printf(m, " %08x", *res_ptr);
}
- len += seq_printf(m, "\n");
+ seq_putc(m, '\n');

return 0;
}
--
2.1.2

2015-02-22 02:56:20

by Joe Perches

[permalink] [raw]
Subject: [PATCH 27/27] regulator: dbx500: Remove use of seq_puts/seq_printf return value

The seq_puts/seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Miscellanea:

o Remove unnecessary dev_err("seq_<foo> overflow\n") messages

Signed-off-by: Joe Perches <[email protected]>
---
drivers/regulator/dbx500-prcmu.c | 32 +++++++++-----------------------
1 file changed, 9 insertions(+), 23 deletions(-)

diff --git a/drivers/regulator/dbx500-prcmu.c b/drivers/regulator/dbx500-prcmu.c
index 2d16b9f..3963dfa 100644
--- a/drivers/regulator/dbx500-prcmu.c
+++ b/drivers/regulator/dbx500-prcmu.c
@@ -95,14 +95,9 @@ void ux500_regulator_resume_debug(void)

static int ux500_regulator_power_state_cnt_print(struct seq_file *s, void *p)
{
- struct device *dev = s->private;
- int err;
-
/* print power state count */
- err = seq_printf(s, "ux500-regulator power state count: %i\n",
- power_state_active_get());
- if (err < 0)
- dev_err(dev, "seq_printf overflow\n");
+ seq_printf(s, "ux500-regulator power state count: %i\n",
+ power_state_active_get());

return 0;
}
@@ -124,19 +119,11 @@ static const struct file_operations ux500_regulator_power_state_cnt_fops = {

static int ux500_regulator_status_print(struct seq_file *s, void *p)
{
- struct device *dev = s->private;
- int err;
int i;

/* print dump header */
- err = seq_puts(s, "ux500-regulator status:\n");
- if (err < 0)
- dev_err(dev, "seq_puts overflow\n");
-
- err = seq_printf(s, "%31s : %8s : %8s\n", "current",
- "before", "after");
- if (err < 0)
- dev_err(dev, "seq_printf overflow\n");
+ seq_puts(s, "ux500-regulator status:\n");
+ seq_printf(s, "%31s : %8s : %8s\n", "current", "before", "after");

for (i = 0; i < rdebug.num_regulators; i++) {
struct dbx500_regulator_info *info;
@@ -144,12 +131,11 @@ static int ux500_regulator_status_print(struct seq_file *s, void *p)
info = &rdebug.regulator_array[i];

/* print status */
- err = seq_printf(s, "%20s : %8s : %8s : %8s\n", info->desc.name,
- info->is_enabled ? "enabled" : "disabled",
- rdebug.state_before_suspend[i] ? "enabled" : "disabled",
- rdebug.state_after_suspend[i] ? "enabled" : "disabled");
- if (err < 0)
- dev_err(dev, "seq_printf overflow\n");
+ seq_printf(s, "%20s : %8s : %8s : %8s\n",
+ info->desc.name,
+ info->is_enabled ? "enabled" : "disabled",
+ rdebug.state_before_suspend[i] ? "enabled" : "disabled",
+ rdebug.state_after_suspend[i] ? "enabled" : "disabled");
}

return 0;
--
2.1.2

2015-02-22 03:53:30

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 24/27] tracing: Remove use of seq_printf return value

On Sat, 21 Feb 2015 18:53:51 -0800
Joe Perches <[email protected]> wrote:

> The seq_printf return value, because it's frequently misused,
> will eventually be converted to void.
>
> See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
> seq_has_overflowed() and make public")
>
> Miscellanea:
>
> o Remove unused return value from trace_lookup_stack

Acked-by: Steven Rostedt <[email protected]>

-- Steve

>
> Signed-off-by: Joe Perches <[email protected]>
> ---
> kernel/trace/trace_stack.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
> index c3e4fcf..3f34496 100644
> --- a/kernel/trace/trace_stack.c
> +++ b/kernel/trace/trace_stack.c
> @@ -327,11 +327,11 @@ static void t_stop(struct seq_file *m, void *p)
> local_irq_enable();
> }
>
> -static int trace_lookup_stack(struct seq_file *m, long i)
> +static void trace_lookup_stack(struct seq_file *m, long i)
> {
> unsigned long addr = stack_dump_trace[i];
>
> - return seq_printf(m, "%pS\n", (void *)addr);
> + seq_printf(m, "%pS\n", (void *)addr);
> }
>
> static void print_disabled(struct seq_file *m)

2015-02-22 04:00:37

by Joe Perches

[permalink] [raw]
Subject: [PATCH V2 - 15/27] cris: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---

V2: Remove trailing whitespace (exist in original code)

arch/cris/arch-v10/kernel/setup.c | 58 ++++++++++++++++++------------------
arch/cris/arch-v32/kernel/setup.c | 62 ++++++++++++++++++++-------------------
2 files changed, 62 insertions(+), 58 deletions(-)

diff --git a/arch/cris/arch-v10/kernel/setup.c b/arch/cris/arch-v10/kernel/setup.c
index 4f96d71..d0434a9 100644
--- a/arch/cris/arch-v10/kernel/setup.c
+++ b/arch/cris/arch-v10/kernel/setup.c
@@ -63,35 +63,37 @@ int show_cpuinfo(struct seq_file *m, void *v)
else
info = &cpu_info[revision];

- return seq_printf(m,
- "processor\t: 0\n"
- "cpu\t\t: CRIS\n"
- "cpu revision\t: %lu\n"
- "cpu model\t: %s\n"
- "cache size\t: %d kB\n"
- "fpu\t\t: %s\n"
- "mmu\t\t: %s\n"
- "mmu DMA bug\t: %s\n"
- "ethernet\t: %s Mbps\n"
- "token ring\t: %s\n"
- "scsi\t\t: %s\n"
- "ata\t\t: %s\n"
- "usb\t\t: %s\n"
- "bogomips\t: %lu.%02lu\n",
+ seq_printf(m,
+ "processor\t: 0\n"
+ "cpu\t\t: CRIS\n"
+ "cpu revision\t: %lu\n"
+ "cpu model\t: %s\n"
+ "cache size\t: %d kB\n"
+ "fpu\t\t: %s\n"
+ "mmu\t\t: %s\n"
+ "mmu DMA bug\t: %s\n"
+ "ethernet\t: %s Mbps\n"
+ "token ring\t: %s\n"
+ "scsi\t\t: %s\n"
+ "ata\t\t: %s\n"
+ "usb\t\t: %s\n"
+ "bogomips\t: %lu.%02lu\n",

- revision,
- info->model,
- info->cache,
- info->flags & HAS_FPU ? "yes" : "no",
- info->flags & HAS_MMU ? "yes" : "no",
- info->flags & HAS_MMU_BUG ? "yes" : "no",
- info->flags & HAS_ETHERNET100 ? "10/100" : "10",
- info->flags & HAS_TOKENRING ? "4/16 Mbps" : "no",
- info->flags & HAS_SCSI ? "yes" : "no",
- info->flags & HAS_ATA ? "yes" : "no",
- info->flags & HAS_USB ? "yes" : "no",
- (loops_per_jiffy * HZ + 500) / 500000,
- ((loops_per_jiffy * HZ + 500) / 5000) % 100);
+ revision,
+ info->model,
+ info->cache,
+ info->flags & HAS_FPU ? "yes" : "no",
+ info->flags & HAS_MMU ? "yes" : "no",
+ info->flags & HAS_MMU_BUG ? "yes" : "no",
+ info->flags & HAS_ETHERNET100 ? "10/100" : "10",
+ info->flags & HAS_TOKENRING ? "4/16 Mbps" : "no",
+ info->flags & HAS_SCSI ? "yes" : "no",
+ info->flags & HAS_ATA ? "yes" : "no",
+ info->flags & HAS_USB ? "yes" : "no",
+ (loops_per_jiffy * HZ + 500) / 500000,
+ ((loops_per_jiffy * HZ + 500) / 5000) % 100);
+
+ return 0;
}

#endif /* CONFIG_PROC_FS */
diff --git a/arch/cris/arch-v32/kernel/setup.c b/arch/cris/arch-v32/kernel/setup.c
index 61e10ae..81715c6 100644
--- a/arch/cris/arch-v32/kernel/setup.c
+++ b/arch/cris/arch-v32/kernel/setup.c
@@ -77,36 +77,38 @@ int show_cpuinfo(struct seq_file *m, void *v)
}
}

- return seq_printf(m,
- "processor\t: %d\n"
- "cpu\t\t: CRIS\n"
- "cpu revision\t: %lu\n"
- "cpu model\t: %s\n"
- "cache size\t: %d KB\n"
- "fpu\t\t: %s\n"
- "mmu\t\t: %s\n"
- "mmu DMA bug\t: %s\n"
- "ethernet\t: %s Mbps\n"
- "token ring\t: %s\n"
- "scsi\t\t: %s\n"
- "ata\t\t: %s\n"
- "usb\t\t: %s\n"
- "bogomips\t: %lu.%02lu\n\n",
-
- cpu,
- revision,
- info->cpu_model,
- info->cache_size,
- info->flags & HAS_FPU ? "yes" : "no",
- info->flags & HAS_MMU ? "yes" : "no",
- info->flags & HAS_MMU_BUG ? "yes" : "no",
- info->flags & HAS_ETHERNET100 ? "10/100" : "10",
- info->flags & HAS_TOKENRING ? "4/16 Mbps" : "no",
- info->flags & HAS_SCSI ? "yes" : "no",
- info->flags & HAS_ATA ? "yes" : "no",
- info->flags & HAS_USB ? "yes" : "no",
- (loops_per_jiffy * HZ + 500) / 500000,
- ((loops_per_jiffy * HZ + 500) / 5000) % 100);
+ seq_printf(m,
+ "processor\t: %d\n"
+ "cpu\t\t: CRIS\n"
+ "cpu revision\t: %lu\n"
+ "cpu model\t: %s\n"
+ "cache size\t: %d KB\n"
+ "fpu\t\t: %s\n"
+ "mmu\t\t: %s\n"
+ "mmu DMA bug\t: %s\n"
+ "ethernet\t: %s Mbps\n"
+ "token ring\t: %s\n"
+ "scsi\t\t: %s\n"
+ "ata\t\t: %s\n"
+ "usb\t\t: %s\n"
+ "bogomips\t: %lu.%02lu\n\n",
+
+ cpu,
+ revision,
+ info->cpu_model,
+ info->cache_size,
+ info->flags & HAS_FPU ? "yes" : "no",
+ info->flags & HAS_MMU ? "yes" : "no",
+ info->flags & HAS_MMU_BUG ? "yes" : "no",
+ info->flags & HAS_ETHERNET100 ? "10/100" : "10",
+ info->flags & HAS_TOKENRING ? "4/16 Mbps" : "no",
+ info->flags & HAS_SCSI ? "yes" : "no",
+ info->flags & HAS_ATA ? "yes" : "no",
+ info->flags & HAS_USB ? "yes" : "no",
+ (loops_per_jiffy * HZ + 500) / 500000,
+ ((loops_per_jiffy * HZ + 500) / 5000) % 100);
+
+ return 0;
}

#endif /* CONFIG_PROC_FS */

2015-02-22 04:02:22

by Joe Perches

[permalink] [raw]
Subject: [PATCH V2 - 08/27] rtc: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---

V2: sigh - Fix : vs ; line termination typo in rtc-tegra

drivers/rtc/rtc-cmos.c | 36 +++++++++++++++++++-----------------
drivers/rtc/rtc-ds1305.c | 6 +++---
drivers/rtc/rtc-mrst.c | 16 +++++++++-------
drivers/rtc/rtc-tegra.c | 4 +++-
4 files changed, 34 insertions(+), 28 deletions(-)

diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 5b2e761..87647f4 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -459,23 +459,25 @@ static int cmos_procfs(struct device *dev, struct seq_file *seq)
/* NOTE: at least ICH6 reports battery status using a different
* (non-RTC) bit; and SQWE is ignored on many current systems.
*/
- return seq_printf(seq,
- "periodic_IRQ\t: %s\n"
- "update_IRQ\t: %s\n"
- "HPET_emulated\t: %s\n"
- // "square_wave\t: %s\n"
- "BCD\t\t: %s\n"
- "DST_enable\t: %s\n"
- "periodic_freq\t: %d\n"
- "batt_status\t: %s\n",
- (rtc_control & RTC_PIE) ? "yes" : "no",
- (rtc_control & RTC_UIE) ? "yes" : "no",
- is_hpet_enabled() ? "yes" : "no",
- // (rtc_control & RTC_SQWE) ? "yes" : "no",
- (rtc_control & RTC_DM_BINARY) ? "no" : "yes",
- (rtc_control & RTC_DST_EN) ? "yes" : "no",
- cmos->rtc->irq_freq,
- (valid & RTC_VRT) ? "okay" : "dead");
+ seq_printf(seq,
+ "periodic_IRQ\t: %s\n"
+ "update_IRQ\t: %s\n"
+ "HPET_emulated\t: %s\n"
+ // "square_wave\t: %s\n"
+ "BCD\t\t: %s\n"
+ "DST_enable\t: %s\n"
+ "periodic_freq\t: %d\n"
+ "batt_status\t: %s\n",
+ (rtc_control & RTC_PIE) ? "yes" : "no",
+ (rtc_control & RTC_UIE) ? "yes" : "no",
+ is_hpet_enabled() ? "yes" : "no",
+ // (rtc_control & RTC_SQWE) ? "yes" : "no",
+ (rtc_control & RTC_DM_BINARY) ? "no" : "yes",
+ (rtc_control & RTC_DST_EN) ? "yes" : "no",
+ cmos->rtc->irq_freq,
+ (valid & RTC_VRT) ? "okay" : "dead");
+
+ return 0;
}

#else
diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c
index 129add77..12b0715 100644
--- a/drivers/rtc/rtc-ds1305.c
+++ b/drivers/rtc/rtc-ds1305.c
@@ -434,9 +434,9 @@ static int ds1305_proc(struct device *dev, struct seq_file *seq)
}

done:
- return seq_printf(seq,
- "trickle_charge\t: %s%s\n",
- diodes, resistors);
+ seq_printf(seq, "trickle_charge\t: %s%s\n", diodes, resistors);
+
+ return 0;
}

#else
diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c
index e2436d1..ab02bda 100644
--- a/drivers/rtc/rtc-mrst.c
+++ b/drivers/rtc/rtc-mrst.c
@@ -277,13 +277,15 @@ static int mrst_procfs(struct device *dev, struct seq_file *seq)
valid = vrtc_cmos_read(RTC_VALID);
spin_unlock_irq(&rtc_lock);

- return seq_printf(seq,
- "periodic_IRQ\t: %s\n"
- "alarm\t\t: %s\n"
- "BCD\t\t: no\n"
- "periodic_freq\t: daily (not adjustable)\n",
- (rtc_control & RTC_PIE) ? "on" : "off",
- (rtc_control & RTC_AIE) ? "on" : "off");
+ seq_printf(seq,
+ "periodic_IRQ\t: %s\n"
+ "alarm\t\t: %s\n"
+ "BCD\t\t: no\n"
+ "periodic_freq\t: daily (not adjustable)\n",
+ (rtc_control & RTC_PIE) ? "on" : "off",
+ (rtc_control & RTC_AIE) ? "on" : "off");
+
+ return 0;
}

#else
diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c
index d948277..b318017 100644
--- a/drivers/rtc/rtc-tegra.c
+++ b/drivers/rtc/rtc-tegra.c
@@ -261,7 +261,9 @@ static int tegra_rtc_proc(struct device *dev, struct seq_file *seq)
if (!dev || !dev->driver)
return 0;

- return seq_printf(seq, "name\t\t: %s\n", dev_name(dev));
+ seq_printf(seq, "name\t\t: %s\n", dev_name(dev));
+
+ return 0;
}

static irqreturn_t tegra_rtc_irq_handler(int irq, void *data)

2015-02-22 04:41:53

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH 24/27] tracing: Remove use of seq_printf return value

On Sat, Feb 21, 2015 at 10:54:09PM -0500, Steven Rostedt wrote:
> On Sat, 21 Feb 2015 18:53:51 -0800
> Joe Perches <[email protected]> wrote:
>
> > The seq_printf return value, because it's frequently misused,
> > will eventually be converted to void.
> >
> > See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
> > seq_has_overflowed() and make public")
> >
> > Miscellanea:
> >
> > o Remove unused return value from trace_lookup_stack
>
> Acked-by: Steven Rostedt <[email protected]>

FWIW, this one should be Cc:stable - it's a plain and simple bugfix
(so are all of those that used to return the result of seq_printf() from
->show()).

2015-02-22 04:56:07

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 20/27] i8k: Remove use of seq_printf return value

On 02/21/2015 06:53 PM, Joe Perches wrote:
> The seq_printf return value, because it's frequently misused,
> will eventually be converted to void.
>
> See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
> seq_has_overflowed() and make public")
>
> Signed-off-by: Joe Perches <[email protected]>

Acked-by: Guenter Roeck <[email protected]>

2015-02-22 10:22:11

by Robert Jarzmik

[permalink] [raw]
Subject: Re: [PATCH 10/27] pxa27x_udc: Remove use of seq_printf return value

Joe Perches <[email protected]> writes:

> The seq_printf return value, because it's frequently misused,
> will eventually be converted to void.
>
> See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
> seq_has_overflowed() and make public")
>
> While there, simplify the error handler logic by returning
> immediately and remove the unnecessary labels.
>
> Signed-off-by: Joe Perches <[email protected]>
Tested-by: Robert Jarzmik <[email protected]>

Cheers.

--
Robert

2015-02-22 10:39:45

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 24/27] tracing: Remove use of seq_printf return value

On Sun, 2015-02-22 at 04:41 +0000, Al Viro wrote:
> On Sat, Feb 21, 2015 at 10:54:09PM -0500, Steven Rostedt wrote:
> > On Sat, 21 Feb 2015 18:53:51 -0800 Joe Perches <[email protected]> wrote:
> >
> > > The seq_printf return value, because it's frequently misused,
> > > will eventually be converted to void.
> > >
> > > See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
> > > seq_has_overflowed() and make public")
> > >
> > > Miscellanea:
> > >
> > > o Remove unused return value from trace_lookup_stack
> >
> > Acked-by: Steven Rostedt <[email protected]>
>
> FWIW, this one should be Cc:stable - it's a plain and simple bugfix
> (so are all of those that used to return the result of seq_printf() from
> ->show()).

Nah, it's not really a bugfix here.

Patches sent to stable should fix actual bugs or failures.

Sure, it's a defect, but it's only a logical one, not an
actual one. It doesn't/can't fail in practice.

This is only a single symbol and so it can't overflow the
initial allocation.

Besides that, the return value of the containing function
is ignored.

2015-02-22 12:54:03

by Sebastian Ott

[permalink] [raw]
Subject: Re: [PATCH 19/27] s390: Remove use of seq_printf return value

On Sat, 21 Feb 2015, Joe Perches wrote:

> The seq_printf return value, because it's frequently misused,
> will eventually be converted to void.
>
> See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
> seq_has_overflowed() and make public")
>

Acked-By: Sebastian Ott <[email protected]>

Regards,
Sebastian

> Signed-off-by: Joe Perches <[email protected]>
> ---
> arch/s390/pci/pci_debug.c | 6 ++++--
> drivers/s390/cio/blacklist.c | 12 +++++++-----
> 2 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/arch/s390/pci/pci_debug.c b/arch/s390/pci/pci_debug.c
> index 3229a2e..c22d440 100644
> --- a/arch/s390/pci/pci_debug.c
> +++ b/arch/s390/pci/pci_debug.c
> @@ -45,8 +45,10 @@ static int pci_perf_show(struct seq_file *m, void *v)
>
> if (!zdev)
> return 0;
> - if (!zdev->fmb)
> - return seq_printf(m, "FMB statistics disabled\n");
> + if (!zdev->fmb) {
> + seq_puts(m, "FMB statistics disabled\n");
> + return 0;
> + }
>
> /* header */
> seq_printf(m, "FMB @ %p\n", zdev->fmb);
> diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c
> index b3f791b..20314aa 100644
> --- a/drivers/s390/cio/blacklist.c
> +++ b/drivers/s390/cio/blacklist.c
> @@ -330,18 +330,20 @@ cio_ignore_proc_seq_show(struct seq_file *s, void *it)
> if (!iter->in_range) {
> /* First device in range. */
> if ((iter->devno == __MAX_SUBCHANNEL) ||
> - !is_blacklisted(iter->ssid, iter->devno + 1))
> + !is_blacklisted(iter->ssid, iter->devno + 1)) {
> /* Singular device. */
> - return seq_printf(s, "0.%x.%04x\n",
> - iter->ssid, iter->devno);
> + seq_printf(s, "0.%x.%04x\n", iter->ssid, iter->devno);
> + return 0;
> + }
> iter->in_range = 1;
> - return seq_printf(s, "0.%x.%04x-", iter->ssid, iter->devno);
> + seq_printf(s, "0.%x.%04x-", iter->ssid, iter->devno);
> + return 0;
> }
> if ((iter->devno == __MAX_SUBCHANNEL) ||
> !is_blacklisted(iter->ssid, iter->devno + 1)) {
> /* Last device in range. */
> iter->in_range = 0;
> - return seq_printf(s, "0.%x.%04x\n", iter->ssid, iter->devno);
> + seq_printf(s, "0.%x.%04x\n", iter->ssid, iter->devno);
> }
> return 0;
> }
> --
> 2.1.2
>
>

2015-02-22 13:41:40

by Tejun Heo

[permalink] [raw]
Subject: Re: [PATCH 23/27] cgroup: Remove use of seq_printf return value

On Sat, Feb 21, 2015 at 06:53:50PM -0800, Joe Perches wrote:
> The seq_printf return value, because it's frequently misused,
> will eventually be converted to void.
>
> See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
> seq_has_overflowed() and make public")
>
> Signed-off-by: Joe Perches <[email protected]>

Acked-by: Tejun Heo <[email protected]>

Please feel free to route the patch as you see fit.

Thanks.

--
tejun

2015-02-22 21:38:38

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH 06/27] power: wakeup: Remove use of seq_printf return value

On Sat 2015-02-21 18:53:33, Joe Perches wrote:
> The seq_printf return value, because it's frequently misused,
> will eventually be converted to void.
>
> See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
> seq_has_overflowed() and make public")

You've just removed overflow handling from
print_wakeup_source_stats. Can you explain why that is good idea?

Pavel

> --- a/drivers/base/power/wakeup.c
> +++ b/drivers/base/power/wakeup.c
> @@ -842,7 +842,6 @@ static int print_wakeup_source_stats(struct seq_file *m,
> unsigned long active_count;
> ktime_t active_time;
> ktime_t prevent_sleep_time;
> - int ret;
>
> spin_lock_irqsave(&ws->lock, flags);
>
> @@ -865,17 +864,16 @@ static int print_wakeup_source_stats(struct seq_file *m,
> active_time = ktime_set(0, 0);
> }
>
> - ret = seq_printf(m, "%-12s\t%lu\t\t%lu\t\t%lu\t\t%lu\t\t"
> - "%lld\t\t%lld\t\t%lld\t\t%lld\t\t%lld\n",
> - ws->name, active_count, ws->event_count,
> - ws->wakeup_count, ws->expire_count,
> - ktime_to_ms(active_time), ktime_to_ms(total_time),
> - ktime_to_ms(max_time), ktime_to_ms(ws->last_time),
> - ktime_to_ms(prevent_sleep_time));
> + seq_printf(m, "%-12s\t%lu\t\t%lu\t\t%lu\t\t%lu\t\t%lld\t\t%lld\t\t%lld\t\t%lld\t\t%lld\n",
> + ws->name, active_count, ws->event_count,
> + ws->wakeup_count, ws->expire_count,
> + ktime_to_ms(active_time), ktime_to_ms(total_time),
> + ktime_to_ms(max_time), ktime_to_ms(ws->last_time),
> + ktime_to_ms(prevent_sleep_time));
>
> spin_unlock_irqrestore(&ws->lock, flags);
>
> - return ret;
> + return 0;

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

2015-02-22 21:53:05

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 06/27] power: wakeup: Remove use of seq_printf return value

On Sun, 2015-02-22 at 22:38 +0100, Pavel Machek wrote:
> On Sat 2015-02-21 18:53:33, Joe Perches wrote:
> > The seq_printf return value, because it's frequently misused,
> > will eventually be converted to void.
> >
> > See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
> > seq_has_overflowed() and make public")
>
> You've just removed overflow handling from
> print_wakeup_source_stats.
>
> Can you explain why that is good idea?

If overflow occurs, the seq_file subsystem allocates
a bigger buffer and calls the show function again.

See Al's comment in the 0/n patch and here:
https://lkml.org/lkml/2015/2/17/642

2015-02-23 07:18:19

by Jesper Nilsson

[permalink] [raw]
Subject: Re: [PATCH V2 - 15/27] cris: Remove use of seq_printf return value

On Sun, Feb 22, 2015 at 05:00:30AM +0100, Joe Perches wrote:
> The seq_printf return value, because it's frequently misused,
> will eventually be converted to void.
>
> See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
> seq_has_overflowed() and make public")

> Signed-off-by: Joe Perches <[email protected]>

Acked-by: Jesper Nilsson <[email protected]>

/^JN - Jesper Nilsson
--
Jesper Nilsson -- [email protected]

2015-02-23 11:40:03

by Michal Simek

[permalink] [raw]
Subject: Re: [PATCH 11/27] microblaze: mb: Remove use of seq_printf return value

Hi Joe,

On 02/22/2015 03:53 AM, Joe Perches wrote:
> The seq_printf return value, because it's frequently misused,
> will eventually be converted to void.
>
> See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
> seq_has_overflowed() and make public")
>
> Signed-off-by: Joe Perches <[email protected]>
> ---
> arch/microblaze/kernel/cpu/mb.c | 149 ++++++++++++++++++++--------------------
> 1 file changed, 73 insertions(+), 76 deletions(-)
>
> diff --git a/arch/microblaze/kernel/cpu/mb.c b/arch/microblaze/kernel/cpu/mb.c
> index 7b5dca7..01ae077 100644
> --- a/arch/microblaze/kernel/cpu/mb.c
> +++ b/arch/microblaze/kernel/cpu/mb.c
> @@ -27,7 +27,6 @@
>
> static int show_cpuinfo(struct seq_file *m, void *v)
> {
> - int count = 0;
> char *fpga_family = "Unknown";
> char *cpu_ver = "Unknown";
> int i;
> @@ -48,91 +47,89 @@ static int show_cpuinfo(struct seq_file *m, void *v)
> }
> }
>
> - count = seq_printf(m,
> - "CPU-Family: MicroBlaze\n"
> - "FPGA-Arch: %s\n"
> - "CPU-Ver: %s, %s endian\n"
> - "CPU-MHz: %d.%02d\n"
> - "BogoMips: %lu.%02lu\n",
> - fpga_family,
> - cpu_ver,
> - cpuinfo.endian ? "little" : "big",
> - cpuinfo.cpu_clock_freq /
> - 1000000,
> - cpuinfo.cpu_clock_freq %
> - 1000000,
> - loops_per_jiffy / (500000 / HZ),
> - (loops_per_jiffy / (5000 / HZ)) % 100);
> -
> - count += seq_printf(m,
> - "HW:\n Shift:\t\t%s\n"
> - " MSR:\t\t%s\n"
> - " PCMP:\t\t%s\n"
> - " DIV:\t\t%s\n",
> - (cpuinfo.use_instr & PVR0_USE_BARREL_MASK) ? "yes" : "no",
> - (cpuinfo.use_instr & PVR2_USE_MSR_INSTR) ? "yes" : "no",
> - (cpuinfo.use_instr & PVR2_USE_PCMP_INSTR) ? "yes" : "no",
> - (cpuinfo.use_instr & PVR0_USE_DIV_MASK) ? "yes" : "no");
> -
> - count += seq_printf(m,
> - " MMU:\t\t%x\n",
> - cpuinfo.mmu);
> -
> - count += seq_printf(m,
> - " MUL:\t\t%s\n"
> - " FPU:\t\t%s\n",
> - (cpuinfo.use_mult & PVR2_USE_MUL64_MASK) ? "v2" :
> - (cpuinfo.use_mult & PVR0_USE_HW_MUL_MASK) ? "v1" : "no",
> - (cpuinfo.use_fpu & PVR2_USE_FPU2_MASK) ? "v2" :
> - (cpuinfo.use_fpu & PVR0_USE_FPU_MASK) ? "v1" : "no");
> -
> - count += seq_printf(m,
> - " Exc:\t\t%s%s%s%s%s%s%s%s\n",
> - (cpuinfo.use_exc & PVR2_OPCODE_0x0_ILL_MASK) ? "op0x0 " : "",
> - (cpuinfo.use_exc & PVR2_UNALIGNED_EXC_MASK) ? "unal " : "",
> - (cpuinfo.use_exc & PVR2_ILL_OPCODE_EXC_MASK) ? "ill " : "",
> - (cpuinfo.use_exc & PVR2_IOPB_BUS_EXC_MASK) ? "iopb " : "",
> - (cpuinfo.use_exc & PVR2_DOPB_BUS_EXC_MASK) ? "dopb " : "",
> - (cpuinfo.use_exc & PVR2_DIV_ZERO_EXC_MASK) ? "zero " : "",
> - (cpuinfo.use_exc & PVR2_FPU_EXC_MASK) ? "fpu " : "",
> - (cpuinfo.use_exc & PVR2_USE_FSL_EXC) ? "fsl " : "");
> -
> - count += seq_printf(m,
> - "Stream-insns:\t%sprivileged\n",
> - cpuinfo.mmu_privins ? "un" : "");
> + seq_printf(m,
> + "CPU-Family: MicroBlaze\n"
> + "FPGA-Arch: %s\n"
> + "CPU-Ver: %s, %s endian\n"
> + "CPU-MHz: %d.%02d\n"
> + "BogoMips: %lu.%02lu\n",
> + fpga_family,
> + cpu_ver,
> + cpuinfo.endian ? "little" : "big",
> + cpuinfo.cpu_clock_freq / 1000000,
> + cpuinfo.cpu_clock_freq % 1000000,
> + loops_per_jiffy / (500000 / HZ),
> + (loops_per_jiffy / (5000 / HZ)) % 100);
> +
> + seq_printf(m,
> + "HW:\n Shift:\t\t%s\n"
> + " MSR:\t\t%s\n"
> + " PCMP:\t\t%s\n"
> + " DIV:\t\t%s\n",
> + (cpuinfo.use_instr & PVR0_USE_BARREL_MASK) ? "yes" : "no",
> + (cpuinfo.use_instr & PVR2_USE_MSR_INSTR) ? "yes" : "no",
> + (cpuinfo.use_instr & PVR2_USE_PCMP_INSTR) ? "yes" : "no",
> + (cpuinfo.use_instr & PVR0_USE_DIV_MASK) ? "yes" : "no");
> +
> + seq_printf(m, " MMU:\t\t%x\n", cpuinfo.mmu);
> +
> + seq_printf(m,
> + " MUL:\t\t%s\n"
> + " FPU:\t\t%s\n",
> + (cpuinfo.use_mult & PVR2_USE_MUL64_MASK) ? "v2" :
> + (cpuinfo.use_mult & PVR0_USE_HW_MUL_MASK) ? "v1" : "no",
> + (cpuinfo.use_fpu & PVR2_USE_FPU2_MASK) ? "v2" :
> + (cpuinfo.use_fpu & PVR0_USE_FPU_MASK) ? "v1" : "no");
> +
> + seq_printf(m,
> + " Exc:\t\t%s%s%s%s%s%s%s%s\n",
> + (cpuinfo.use_exc & PVR2_OPCODE_0x0_ILL_MASK) ? "op0x0 " : "",
> + (cpuinfo.use_exc & PVR2_UNALIGNED_EXC_MASK) ? "unal " : "",
> + (cpuinfo.use_exc & PVR2_ILL_OPCODE_EXC_MASK) ? "ill " : "",
> + (cpuinfo.use_exc & PVR2_IOPB_BUS_EXC_MASK) ? "iopb " : "",
> + (cpuinfo.use_exc & PVR2_DOPB_BUS_EXC_MASK) ? "dopb " : "",
> + (cpuinfo.use_exc & PVR2_DIV_ZERO_EXC_MASK) ? "zero " : "",
> + (cpuinfo.use_exc & PVR2_FPU_EXC_MASK) ? "fpu " : "",
> + (cpuinfo.use_exc & PVR2_USE_FSL_EXC) ? "fsl " : "");
> +
> + seq_printf(m,
> + "Stream-insns:\t%sprivileged\n",
> + cpuinfo.mmu_privins ? "un" : "");
>
> if (cpuinfo.use_icache)
> - count += seq_printf(m,
> - "Icache:\t\t%ukB\tline length:\t%dB\n",
> - cpuinfo.icache_size >> 10,
> - cpuinfo.icache_line_length);
> + seq_printf(m,
> + "Icache:\t\t%ukB\tline length:\t%dB\n",
> + cpuinfo.icache_size >> 10,
> + cpuinfo.icache_line_length);
> else
> - count += seq_printf(m, "Icache:\t\tno\n");
> + x seq_puts(m, "Icache:\t\tno\n");
>
> if (cpuinfo.use_dcache) {
> - count += seq_printf(m,
> - "Dcache:\t\t%ukB\tline length:\t%dB\n",
> - cpuinfo.dcache_size >> 10,
> - cpuinfo.dcache_line_length);
> - seq_printf(m, "Dcache-Policy:\t");
> + seq_printf(m,
> + "Dcache:\t\t%ukB\tline length:\t%dB\n",
> + cpuinfo.dcache_size >> 10,
> + cpuinfo.dcache_line_length);
> + seq_puts(m, "Dcache-Policy:\t");
> if (cpuinfo.dcache_wb)
> - count += seq_printf(m, "write-back\n");
> + seq_puts(m, "write-back\n");
> else
> - count += seq_printf(m, "write-through\n");
> - } else
> - count += seq_printf(m, "Dcache:\t\tno\n");
> + seq_puts(m, "write-through\n");
> + } else {
> + seq_puts(m, "Dcache:\t\tno\n");
> + }
> +
> + seq_printf(m,
> + "HW-Debug:\t%s\n",
> + cpuinfo.hw_debug ? "yes" : "no");
>
> - count += seq_printf(m,
> - "HW-Debug:\t%s\n",
> - cpuinfo.hw_debug ? "yes" : "no");
> + seq_printf(m,
> + "PVR-USR1:\t%02x\n"
> + "PVR-USR2:\t%08x\n",
> + cpuinfo.pvr_user1,
> + cpuinfo.pvr_user2);
>
> - count += seq_printf(m,
> - "PVR-USR1:\t%02x\n"
> - "PVR-USR2:\t%08x\n",
> - cpuinfo.pvr_user1,
> - cpuinfo.pvr_user2);
> + seq_printf(m, "Page size:\t%lu\n", PAGE_SIZE);
>
> - count += seq_printf(m, "Page size:\t%lu\n", PAGE_SIZE);
> return 0;
> }

Acked-by: Michal Simek <[email protected]>

Do you want to add it to microblaze next branch?

Thanks,
Michal

--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: http://www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



Attachments:
signature.asc (198.00 B)
OpenPGP digital signature

2015-02-23 11:56:47

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH 06/27] power: wakeup: Remove use of seq_printf return value

On Sun 2015-02-22 13:52:58, Joe Perches wrote:
> On Sun, 2015-02-22 at 22:38 +0100, Pavel Machek wrote:
> > On Sat 2015-02-21 18:53:33, Joe Perches wrote:
> > > The seq_printf return value, because it's frequently misused,
> > > will eventually be converted to void.
> > >
> > > See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
> > > seq_has_overflowed() and make public")
> >
> > You've just removed overflow handling from
> > print_wakeup_source_stats.
> >
> > Can you explain why that is good idea?
>
> If overflow occurs, the seq_file subsystem allocates
> a bigger buffer and calls the show function again.
>
> See Al's comment in the 0/n patch and here:
> https://lkml.org/lkml/2015/2/17/642

You may want to explain while this is good idea in the changelog.

>From your explanation it looks like error is somehow handled
on higher-level retry, but...

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

2015-02-23 13:56:36

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 27/27] regulator: dbx500: Remove use of seq_puts/seq_printf return value

On Sat, Feb 21, 2015 at 06:53:54PM -0800, Joe Perches wrote:
> The seq_puts/seq_printf return value, because it's frequently misused,
> will eventually be converted to void.

I'm missing both the cover letter and the previous 26 patches - are
there any dependencies?


Attachments:
(No filename) (267.00 B)
signature.asc (473.00 B)
Digital signature
Download all attachments

2015-02-23 14:52:55

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 27/27] regulator: dbx500: Remove use of seq_puts/seq_printf return value

On Mon, 2015-02-23 at 22:55 +0900, Mark Brown wrote:
> On Sat, Feb 21, 2015 at 06:53:54PM -0800, Joe Perches wrote:
> > The seq_puts/seq_printf return value, because it's frequently misused,
> > will eventually be converted to void.
>
> I'm missing both the cover letter and the previous 26 patches - are
> there any dependencies?

The cover letter was sent only to mailing lists because
adding all the various maintainers to the cover letter
would cause mailing list bounces.

https://lkml.org/lkml/2015/2/21/221

No dependencies.

2015-02-23 17:20:40

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 24/27] tracing: Remove use of seq_printf return value

On Sun, 22 Feb 2015 02:39:38 -0800
Joe Perches <[email protected]> wrote:

> > FWIW, this one should be Cc:stable - it's a plain and simple bugfix
> > (so are all of those that used to return the result of seq_printf() from
> > ->show()).
>
> Nah, it's not really a bugfix here.
>
> Patches sent to stable should fix actual bugs or failures.
>
> Sure, it's a defect, but it's only a logical one, not an
> actual one. It doesn't/can't fail in practice.
>
> This is only a single symbol and so it can't overflow the
> initial allocation.
>
> Besides that, the return value of the containing function
> is ignored.
>

Right, there's nothing that will actually break with the current code.
The return value is ignored in the one place it is used. And no new
code is going to expect a result.

It's a fix that's fine for the next merge window. It's not even
important enough to get into this window.

-- Steve

2015-02-23 17:36:31

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 24/27] tracing: Remove use of seq_printf return value

On Mon, 2015-02-23 at 12:20 -0500, Steven Rostedt wrote:
> On Sun, 22 Feb 2015 02:39:38 -0800
> Joe Perches <[email protected]> wrote:
>
> > > FWIW, this one should be Cc:stable - it's a plain and simple bugfix
> > > (so are all of those that used to return the result of seq_printf() from
> > > ->show()).
> >
> > Nah, it's not really a bugfix here.
> >
> > Patches sent to stable should fix actual bugs or failures.
> >
> > Sure, it's a defect, but it's only a logical one, not an
> > actual one. It doesn't/can't fail in practice.
> >
> > This is only a single symbol and so it can't overflow the
> > initial allocation.
> >
> > Besides that, the return value of the containing function
> > is ignored.
> >
>
> Right, there's nothing that will actually break with the current code.
> The return value is ignored in the one place it is used. And no new
> code is going to expect a result.
>
> It's a fix that's fine for the next merge window. It's not even
> important enough to get into this window.

All of these "int->void seq_<foo>" changes are for 4.1
or whatever the next version is going to be called.

And I think date based kernel versioning like <yyyy.mm.v>
would have been better.

2015-02-23 19:29:24

by Guenter Roeck

[permalink] [raw]
Subject: Re: [21/27] watchdog: bcm281xx: Remove use of seq_printf return value

On Sat, Feb 21, 2015 at 06:53:48PM -0800, Joe Perches wrote:
> The seq_printf return value, because it's frequently misused,
> will eventually be converted to void.
>
> See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
> seq_has_overflowed() and make public")
>
> Signed-off-by: Joe Perches <[email protected]>

Acked-by: Guenter Roeck <linux~roeck-us.net>

2015-02-23 23:50:55

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 07/27] ipmi: Remove use of seq_printf return value

On Sat, 21 Feb 2015 18:53:34 -0800 Joe Perches <[email protected]> wrote:

> The seq_printf return value, because it's frequently misused,
> will eventually be converted to void.
>
> See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
> seq_has_overflowed() and make public")

4.0-rc1 appears to have an earlier and different version of this.

commit d6c5dc18d863338528f4e89e8dba9449c6e30f4e
Author: Joe Perches <[email protected]>
AuthorDate: Tue Feb 17 11:10:56 2015 -0800
Commit: Corey Minyard <[email protected]>
CommitDate: Thu Feb 19 20:58:41 2015 -0600

ipmi: Remove uses of return value of seq_printf

2015-02-24 01:23:19

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 07/27] ipmi: Remove use of seq_printf return value

On Mon, 2015-02-23 at 15:50 -0800, Andrew Morton wrote:
> On Sat, 21 Feb 2015 18:53:34 -0800 Joe Perches <[email protected]> wrote:
>
> > The seq_printf return value, because it's frequently misused,
> > will eventually be converted to void.
> >
> > See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
> > seq_has_overflowed() and make public")
>
> 4.0-rc1 appears to have an earlier and different version of this.
>
> commit d6c5dc18d863338528f4e89e8dba9449c6e30f4e
> Author: Joe Perches <[email protected]>
> AuthorDate: Tue Feb 17 11:10:56 2015 -0800
> Commit: Corey Minyard <[email protected]>
> CommitDate: Thu Feb 19 20:58:41 2015 -0600
>
> ipmi: Remove uses of return value of seq_printf

Yeah, I sent Corey a relative patch too.

https://lkml.org/lkml/2015/2/22/133

2015-02-24 08:19:17

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 27/27] regulator: dbx500: Remove use of seq_puts/seq_printf return value

On Mon, Feb 23, 2015 at 06:52:50AM -0800, Joe Perches wrote:

> The cover letter was sent only to mailing lists because
> adding all the various maintainers to the cover letter
> would cause mailing list bounces.

> https://lkml.org/lkml/2015/2/21/221

> No dependencies.

OK, I've applied it. If you're doing something like this where your
"series" doesn't actually have any dependencies it's probably better to
just send a lot of individual patches, that's much easier to understand
and handle than just getting one odd patch in the middle of a series and
means things are less likely to get snarled up by process as a result.


Attachments:
(No filename) (630.00 B)
signature.asc (473.00 B)
Digital signature
Download all attachments

2015-02-26 12:10:49

by Joe Perches

[permalink] [raw]
Subject: [PATCH 11/27 v2] microblaze: mb: Remove use of seq_printf return value

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <[email protected]>
---
V2: Joe can't type.
Remove errant x char after tab found by kbuild test robot

arch/microblaze/kernel/cpu/mb.c | 149 ++++++++++++++++++++--------------------
1 file changed, 73 insertions(+), 76 deletions(-)

diff --git a/arch/microblaze/kernel/cpu/mb.c b/arch/microblaze/kernel/cpu/mb.c
index 7b5dca7..01ae077 100644
--- a/arch/microblaze/kernel/cpu/mb.c
+++ b/arch/microblaze/kernel/cpu/mb.c
@@ -27,7 +27,6 @@

static int show_cpuinfo(struct seq_file *m, void *v)
{
- int count = 0;
char *fpga_family = "Unknown";
char *cpu_ver = "Unknown";
int i;
@@ -48,91 +47,89 @@ static int show_cpuinfo(struct seq_file *m, void *v)
}
}

- count = seq_printf(m,
- "CPU-Family: MicroBlaze\n"
- "FPGA-Arch: %s\n"
- "CPU-Ver: %s, %s endian\n"
- "CPU-MHz: %d.%02d\n"
- "BogoMips: %lu.%02lu\n",
- fpga_family,
- cpu_ver,
- cpuinfo.endian ? "little" : "big",
- cpuinfo.cpu_clock_freq /
- 1000000,
- cpuinfo.cpu_clock_freq %
- 1000000,
- loops_per_jiffy / (500000 / HZ),
- (loops_per_jiffy / (5000 / HZ)) % 100);
-
- count += seq_printf(m,
- "HW:\n Shift:\t\t%s\n"
- " MSR:\t\t%s\n"
- " PCMP:\t\t%s\n"
- " DIV:\t\t%s\n",
- (cpuinfo.use_instr & PVR0_USE_BARREL_MASK) ? "yes" : "no",
- (cpuinfo.use_instr & PVR2_USE_MSR_INSTR) ? "yes" : "no",
- (cpuinfo.use_instr & PVR2_USE_PCMP_INSTR) ? "yes" : "no",
- (cpuinfo.use_instr & PVR0_USE_DIV_MASK) ? "yes" : "no");
-
- count += seq_printf(m,
- " MMU:\t\t%x\n",
- cpuinfo.mmu);
-
- count += seq_printf(m,
- " MUL:\t\t%s\n"
- " FPU:\t\t%s\n",
- (cpuinfo.use_mult & PVR2_USE_MUL64_MASK) ? "v2" :
- (cpuinfo.use_mult & PVR0_USE_HW_MUL_MASK) ? "v1" : "no",
- (cpuinfo.use_fpu & PVR2_USE_FPU2_MASK) ? "v2" :
- (cpuinfo.use_fpu & PVR0_USE_FPU_MASK) ? "v1" : "no");
-
- count += seq_printf(m,
- " Exc:\t\t%s%s%s%s%s%s%s%s\n",
- (cpuinfo.use_exc & PVR2_OPCODE_0x0_ILL_MASK) ? "op0x0 " : "",
- (cpuinfo.use_exc & PVR2_UNALIGNED_EXC_MASK) ? "unal " : "",
- (cpuinfo.use_exc & PVR2_ILL_OPCODE_EXC_MASK) ? "ill " : "",
- (cpuinfo.use_exc & PVR2_IOPB_BUS_EXC_MASK) ? "iopb " : "",
- (cpuinfo.use_exc & PVR2_DOPB_BUS_EXC_MASK) ? "dopb " : "",
- (cpuinfo.use_exc & PVR2_DIV_ZERO_EXC_MASK) ? "zero " : "",
- (cpuinfo.use_exc & PVR2_FPU_EXC_MASK) ? "fpu " : "",
- (cpuinfo.use_exc & PVR2_USE_FSL_EXC) ? "fsl " : "");
-
- count += seq_printf(m,
- "Stream-insns:\t%sprivileged\n",
- cpuinfo.mmu_privins ? "un" : "");
+ seq_printf(m,
+ "CPU-Family: MicroBlaze\n"
+ "FPGA-Arch: %s\n"
+ "CPU-Ver: %s, %s endian\n"
+ "CPU-MHz: %d.%02d\n"
+ "BogoMips: %lu.%02lu\n",
+ fpga_family,
+ cpu_ver,
+ cpuinfo.endian ? "little" : "big",
+ cpuinfo.cpu_clock_freq / 1000000,
+ cpuinfo.cpu_clock_freq % 1000000,
+ loops_per_jiffy / (500000 / HZ),
+ (loops_per_jiffy / (5000 / HZ)) % 100);
+
+ seq_printf(m,
+ "HW:\n Shift:\t\t%s\n"
+ " MSR:\t\t%s\n"
+ " PCMP:\t\t%s\n"
+ " DIV:\t\t%s\n",
+ (cpuinfo.use_instr & PVR0_USE_BARREL_MASK) ? "yes" : "no",
+ (cpuinfo.use_instr & PVR2_USE_MSR_INSTR) ? "yes" : "no",
+ (cpuinfo.use_instr & PVR2_USE_PCMP_INSTR) ? "yes" : "no",
+ (cpuinfo.use_instr & PVR0_USE_DIV_MASK) ? "yes" : "no");
+
+ seq_printf(m, " MMU:\t\t%x\n", cpuinfo.mmu);
+
+ seq_printf(m,
+ " MUL:\t\t%s\n"
+ " FPU:\t\t%s\n",
+ (cpuinfo.use_mult & PVR2_USE_MUL64_MASK) ? "v2" :
+ (cpuinfo.use_mult & PVR0_USE_HW_MUL_MASK) ? "v1" : "no",
+ (cpuinfo.use_fpu & PVR2_USE_FPU2_MASK) ? "v2" :
+ (cpuinfo.use_fpu & PVR0_USE_FPU_MASK) ? "v1" : "no");
+
+ seq_printf(m,
+ " Exc:\t\t%s%s%s%s%s%s%s%s\n",
+ (cpuinfo.use_exc & PVR2_OPCODE_0x0_ILL_MASK) ? "op0x0 " : "",
+ (cpuinfo.use_exc & PVR2_UNALIGNED_EXC_MASK) ? "unal " : "",
+ (cpuinfo.use_exc & PVR2_ILL_OPCODE_EXC_MASK) ? "ill " : "",
+ (cpuinfo.use_exc & PVR2_IOPB_BUS_EXC_MASK) ? "iopb " : "",
+ (cpuinfo.use_exc & PVR2_DOPB_BUS_EXC_MASK) ? "dopb " : "",
+ (cpuinfo.use_exc & PVR2_DIV_ZERO_EXC_MASK) ? "zero " : "",
+ (cpuinfo.use_exc & PVR2_FPU_EXC_MASK) ? "fpu " : "",
+ (cpuinfo.use_exc & PVR2_USE_FSL_EXC) ? "fsl " : "");
+
+ seq_printf(m,
+ "Stream-insns:\t%sprivileged\n",
+ cpuinfo.mmu_privins ? "un" : "");

if (cpuinfo.use_icache)
- count += seq_printf(m,
- "Icache:\t\t%ukB\tline length:\t%dB\n",
- cpuinfo.icache_size >> 10,
- cpuinfo.icache_line_length);
+ seq_printf(m,
+ "Icache:\t\t%ukB\tline length:\t%dB\n",
+ cpuinfo.icache_size >> 10,
+ cpuinfo.icache_line_length);
else
- count += seq_printf(m, "Icache:\t\tno\n");
+ seq_puts(m, "Icache:\t\tno\n");

if (cpuinfo.use_dcache) {
- count += seq_printf(m,
- "Dcache:\t\t%ukB\tline length:\t%dB\n",
- cpuinfo.dcache_size >> 10,
- cpuinfo.dcache_line_length);
- seq_printf(m, "Dcache-Policy:\t");
+ seq_printf(m,
+ "Dcache:\t\t%ukB\tline length:\t%dB\n",
+ cpuinfo.dcache_size >> 10,
+ cpuinfo.dcache_line_length);
+ seq_puts(m, "Dcache-Policy:\t");
if (cpuinfo.dcache_wb)
- count += seq_printf(m, "write-back\n");
+ seq_puts(m, "write-back\n");
else
- count += seq_printf(m, "write-through\n");
- } else
- count += seq_printf(m, "Dcache:\t\tno\n");
+ seq_puts(m, "write-through\n");
+ } else {
+ seq_puts(m, "Dcache:\t\tno\n");
+ }
+
+ seq_printf(m,
+ "HW-Debug:\t%s\n",
+ cpuinfo.hw_debug ? "yes" : "no");

- count += seq_printf(m,
- "HW-Debug:\t%s\n",
- cpuinfo.hw_debug ? "yes" : "no");
+ seq_printf(m,
+ "PVR-USR1:\t%02x\n"
+ "PVR-USR2:\t%08x\n",
+ cpuinfo.pvr_user1,
+ cpuinfo.pvr_user2);

- count += seq_printf(m,
- "PVR-USR1:\t%02x\n"
- "PVR-USR2:\t%08x\n",
- cpuinfo.pvr_user1,
- cpuinfo.pvr_user2);
+ seq_printf(m, "Page size:\t%lu\n", PAGE_SIZE);

- count += seq_printf(m, "Page size:\t%lu\n", PAGE_SIZE);
return 0;
}