* [PATCH 00/27] Convert seq_<foo> output calls to return void
@ 2015-02-22 2:53 Joe Perches
2015-02-22 2:53 ` [PATCH 10/27] pxa27x_udc: Remove use of seq_printf return value Joe Perches
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Joe Perches @ 2015-02-22 2:53 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 10/27] pxa27x_udc: Remove use of seq_printf return value
2015-02-22 2:53 [PATCH 00/27] Convert seq_<foo> output calls to return void Joe Perches
@ 2015-02-22 2:53 ` Joe Perches
2015-02-22 10:22 ` Robert Jarzmik
2015-02-22 2:53 ` [PATCH 13/27] ARM: plat-pxa: " Joe Perches
2015-02-22 2:53 ` [PATCH 16/27] mfd: ab8500-debugfs: " Joe Perches
2 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2015-02-22 2:53 UTC (permalink / raw)
To: linux-arm-kernel
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 <joe@perches.com>
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 13/27] ARM: plat-pxa: Remove use of seq_printf return value
2015-02-22 2:53 [PATCH 00/27] Convert seq_<foo> output calls to return void Joe Perches
2015-02-22 2:53 ` [PATCH 10/27] pxa27x_udc: Remove use of seq_printf return value Joe Perches
@ 2015-02-22 2:53 ` Joe Perches
2015-02-22 2:53 ` [PATCH 16/27] mfd: ab8500-debugfs: " Joe Perches
2 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2015-02-22 2:53 UTC (permalink / raw)
To: linux-arm-kernel
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 <joe@perches.com>
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 16/27] mfd: ab8500-debugfs: Remove use of seq_printf return value
2015-02-22 2:53 [PATCH 00/27] Convert seq_<foo> output calls to return void Joe Perches
2015-02-22 2:53 ` [PATCH 10/27] pxa27x_udc: Remove use of seq_printf return value Joe Perches
2015-02-22 2:53 ` [PATCH 13/27] ARM: plat-pxa: " Joe Perches
@ 2015-02-22 2:53 ` Joe Perches
2015-03-06 10:54 ` Lee Jones
2 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2015-02-22 2:53 UTC (permalink / raw)
To: linux-arm-kernel
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 <joe@perches.com>
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 10/27] pxa27x_udc: Remove use of seq_printf return value
2015-02-22 2:53 ` [PATCH 10/27] pxa27x_udc: Remove use of seq_printf return value Joe Perches
@ 2015-02-22 10:22 ` Robert Jarzmik
0 siblings, 0 replies; 6+ messages in thread
From: Robert Jarzmik @ 2015-02-22 10:22 UTC (permalink / raw)
To: linux-arm-kernel
Joe Perches <joe@perches.com> 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 <joe@perches.com>
Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Cheers.
--
Robert
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 16/27] mfd: ab8500-debugfs: Remove use of seq_printf return value
2015-02-22 2:53 ` [PATCH 16/27] mfd: ab8500-debugfs: " Joe Perches
@ 2015-03-06 10:54 ` Lee Jones
0 siblings, 0 replies; 6+ messages in thread
From: Lee Jones @ 2015-03-06 10:54 UTC (permalink / raw)
To: linux-arm-kernel
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")
I'm not a fan of mixing functional patches with clean-ups, but I'm in
a particually good mood today (it must be Firday).
Applied, thanks.
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> 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)
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-03-06 10:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-22 2:53 [PATCH 00/27] Convert seq_<foo> output calls to return void Joe Perches
2015-02-22 2:53 ` [PATCH 10/27] pxa27x_udc: Remove use of seq_printf return value Joe Perches
2015-02-22 10:22 ` Robert Jarzmik
2015-02-22 2:53 ` [PATCH 13/27] ARM: plat-pxa: " Joe Perches
2015-02-22 2:53 ` [PATCH 16/27] mfd: ab8500-debugfs: " Joe Perches
2015-03-06 10:54 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).