Skip to content

Commit cd2b293

Browse files
JoePerchestorvalds
authored andcommitted
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 1f33c41 ("seq_file: Rename seq_overflow() to seq_has_overflowed() and make public") Signed-off-by: Joe Perches <joe@perches.com> Cc: Russell King <linux@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 4122669 commit cd2b293

1 file changed

Lines changed: 53 additions & 58 deletions

File tree

‎arch/arm/plat-pxa/dma.c‎

Lines changed: 53 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,19 @@ static struct dentry *dbgfs_root, *dbgfs_state, **dbgfs_chan;
5151

5252
static int dbg_show_requester_chan(struct seq_file *s, void *p)
5353
{
54-
int pos = 0;
5554
int chan = (int)s->private;
5655
int i;
5756
u32 drcmr;
5857

59-
pos += seq_printf(s, "DMA channel %d requesters list :\n", chan);
58+
seq_printf(s, "DMA channel %d requesters list :\n", chan);
6059
for (i = 0; i < DMA_MAX_REQUESTERS; i++) {
6160
drcmr = DRCMR(i);
6261
if ((drcmr & DRCMR_CHLNUM) == chan)
63-
pos += seq_printf(s, "\tRequester %d (MAPVLD=%d)\n", i,
64-
!!(drcmr & DRCMR_MAPVLD));
62+
seq_printf(s, "\tRequester %d (MAPVLD=%d)\n",
63+
i, !!(drcmr & DRCMR_MAPVLD));
6564
}
66-
return pos;
65+
66+
return 0;
6767
}
6868

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

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

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

105-
pos += seq_printf(s, "[%03d] Desc at %08lx(virt %p)\n",
106-
i, phys_desc, desc);
107-
pos += seq_printf(s, "\tDDADR = %08x\n", desc->ddadr);
108-
pos += seq_printf(s, "\tDSADR = %08x\n", desc->dsadr);
109-
pos += seq_printf(s, "\tDTADR = %08x\n", desc->dtadr);
110-
pos += seq_printf(s, "\tDCMD = %08x (%s%s%s%s%s%s%sburst=%d"
111-
" width=%d len=%d)\n",
112-
dcmd,
113-
DCMD_STR(INCSRCADDR), DCMD_STR(INCTRGADDR),
114-
DCMD_STR(FLOWSRC), DCMD_STR(FLOWTRG),
115-
DCMD_STR(STARTIRQEN), DCMD_STR(ENDIRQEN),
116-
DCMD_STR(ENDIAN), burst, width,
117-
dcmd & DCMD_LENGTH);
104+
seq_printf(s, "[%03d] Desc at %08lx(virt %p)\n",
105+
i, phys_desc, desc);
106+
seq_printf(s, "\tDDADR = %08x\n", desc->ddadr);
107+
seq_printf(s, "\tDSADR = %08x\n", desc->dsadr);
108+
seq_printf(s, "\tDTADR = %08x\n", desc->dtadr);
109+
seq_printf(s, "\tDCMD = %08x (%s%s%s%s%s%s%sburst=%d width=%d len=%d)\n",
110+
dcmd,
111+
DCMD_STR(INCSRCADDR), DCMD_STR(INCTRGADDR),
112+
DCMD_STR(FLOWSRC), DCMD_STR(FLOWTRG),
113+
DCMD_STR(STARTIRQEN), DCMD_STR(ENDIRQEN),
114+
DCMD_STR(ENDIAN), burst, width,
115+
dcmd & DCMD_LENGTH);
118116
phys_desc = desc->ddadr;
119117
}
120118
if (i == max_show)
121-
pos += seq_printf(s, "[%03d] Desc at %08lx ... max display reached\n",
122-
i, phys_desc);
119+
seq_printf(s, "[%03d] Desc at %08lx ... max display reached\n",
120+
i, phys_desc);
123121
else
124-
pos += seq_printf(s, "[%03d] Desc at %08lx is %s\n",
125-
i, phys_desc, phys_desc == DDADR_STOP ?
126-
"DDADR_STOP" : "invalid");
122+
seq_printf(s, "[%03d] Desc at %08lx is %s\n",
123+
i, phys_desc, phys_desc == DDADR_STOP ?
124+
"DDADR_STOP" : "invalid");
127125

128126
spin_unlock_irqrestore(&dma_channels[chan].lock, flags);
129-
return pos;
127+
128+
return 0;
130129
}
131130

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

145-
pos += seq_printf(s, "DMA channel %d\n", chan);
146-
pos += seq_printf(s, "\tPriority : %s\n",
147-
str_prio[dma_channels[chan].prio]);
148-
pos += seq_printf(s, "\tUnaligned transfer bit: %s\n",
149-
DALGN & (1 << chan) ? "yes" : "no");
150-
pos += seq_printf(s, "\tDCSR = %08x (%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s)\n",
151-
dcsr, DCSR_STR(RUN), DCSR_STR(NODESC),
152-
DCSR_STR(STOPIRQEN), DCSR_STR(EORIRQEN),
153-
DCSR_STR(EORJMPEN), DCSR_STR(EORSTOPEN),
154-
DCSR_STR(SETCMPST), DCSR_STR(CLRCMPST),
155-
DCSR_STR(CMPST), DCSR_STR(EORINTR), DCSR_STR(REQPEND),
156-
DCSR_STR(STOPSTATE), DCSR_STR(ENDINTR),
157-
DCSR_STR(STARTINTR), DCSR_STR(BUSERR));
158-
159-
pos += seq_printf(s, "\tDCMD = %08x (%s%s%s%s%s%s%sburst=%d width=%d"
160-
" len=%d)\n",
161-
dcmd,
162-
DCMD_STR(INCSRCADDR), DCMD_STR(INCTRGADDR),
163-
DCMD_STR(FLOWSRC), DCMD_STR(FLOWTRG),
164-
DCMD_STR(STARTIRQEN), DCMD_STR(ENDIRQEN),
165-
DCMD_STR(ENDIAN), burst, width, dcmd & DCMD_LENGTH);
166-
pos += seq_printf(s, "\tDSADR = %08x\n", DSADR(chan));
167-
pos += seq_printf(s, "\tDTADR = %08x\n", DTADR(chan));
168-
pos += seq_printf(s, "\tDDADR = %08x\n", DDADR(chan));
169-
return pos;
143+
seq_printf(s, "DMA channel %d\n", chan);
144+
seq_printf(s, "\tPriority : %s\n", str_prio[dma_channels[chan].prio]);
145+
seq_printf(s, "\tUnaligned transfer bit: %s\n",
146+
DALGN & (1 << chan) ? "yes" : "no");
147+
seq_printf(s, "\tDCSR = %08x (%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s)\n",
148+
dcsr, DCSR_STR(RUN), DCSR_STR(NODESC),
149+
DCSR_STR(STOPIRQEN), DCSR_STR(EORIRQEN),
150+
DCSR_STR(EORJMPEN), DCSR_STR(EORSTOPEN),
151+
DCSR_STR(SETCMPST), DCSR_STR(CLRCMPST),
152+
DCSR_STR(CMPST), DCSR_STR(EORINTR), DCSR_STR(REQPEND),
153+
DCSR_STR(STOPSTATE), DCSR_STR(ENDINTR),
154+
DCSR_STR(STARTINTR), DCSR_STR(BUSERR));
155+
156+
seq_printf(s, "\tDCMD = %08x (%s%s%s%s%s%s%sburst=%d width=%d len=%d)\n",
157+
dcmd,
158+
DCMD_STR(INCSRCADDR), DCMD_STR(INCTRGADDR),
159+
DCMD_STR(FLOWSRC), DCMD_STR(FLOWTRG),
160+
DCMD_STR(STARTIRQEN), DCMD_STR(ENDIRQEN),
161+
DCMD_STR(ENDIAN), burst, width, dcmd & DCMD_LENGTH);
162+
seq_printf(s, "\tDSADR = %08x\n", DSADR(chan));
163+
seq_printf(s, "\tDTADR = %08x\n", DTADR(chan));
164+
seq_printf(s, "\tDDADR = %08x\n", DDADR(chan));
165+
166+
return 0;
170167
}
171168

172169
static int dbg_show_state(struct seq_file *s, void *p)
173170
{
174-
int pos = 0;
175-
176171
/* basic device status */
177-
pos += seq_printf(s, "DMA engine status\n");
178-
pos += seq_printf(s, "\tChannel number: %d\n", num_dma_channels);
172+
seq_puts(s, "DMA engine status\n");
173+
seq_printf(s, "\tChannel number: %d\n", num_dma_channels);
179174

180-
return pos;
175+
return 0;
181176
}
182177

183178
#define DBGFS_FUNC_DECL(name) \

0 commit comments

Comments
 (0)