提交 25140ce6 编写于 作者: J Joe Perches 提交者: Felipe Balbi

usb: gadget: udc: 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 1f33c41c ("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.
Tested-by: NRobert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: NJoe Perches <joe@perches.com>
Signed-off-by: NFelipe Balbi <balbi@ti.com>
上级 8f2c9544
...@@ -93,23 +93,22 @@ static void handle_ep(struct pxa_ep *ep); ...@@ -93,23 +93,22 @@ static void handle_ep(struct pxa_ep *ep);
static int state_dbg_show(struct seq_file *s, void *p) static int state_dbg_show(struct seq_file *s, void *p)
{ {
struct pxa_udc *udc = s->private; struct pxa_udc *udc = s->private;
int pos = 0, ret;
u32 tmp; u32 tmp;
ret = -ENODEV;
if (!udc->driver) if (!udc->driver)
goto out; return -ENODEV;
/* basic device status */ /* basic device status */
pos += seq_printf(s, DRIVER_DESC "\n" seq_printf(s, DRIVER_DESC "\n"
"%s version: %s\nGadget driver: %s\n", "%s version: %s\n"
"Gadget driver: %s\n",
driver_name, DRIVER_VERSION, driver_name, DRIVER_VERSION,
udc->driver ? udc->driver->driver.name : "(none)"); udc->driver ? udc->driver->driver.name : "(none)");
tmp = udc_readl(udc, UDCCR); tmp = udc_readl(udc, UDCCR);
pos += seq_printf(s, seq_printf(s,
"udccr=0x%0x(%s%s%s%s%s%s%s%s%s%s), " "udccr=0x%0x(%s%s%s%s%s%s%s%s%s%s), con=%d,inter=%d,altinter=%d\n",
"con=%d,inter=%d,altinter=%d\n", tmp, tmp,
(tmp & UDCCR_OEN) ? " oen":"", (tmp & UDCCR_OEN) ? " oen":"",
(tmp & UDCCR_AALTHNP) ? " aalthnp":"", (tmp & UDCCR_AALTHNP) ? " aalthnp":"",
(tmp & UDCCR_AHNP) ? " rem" : "", (tmp & UDCCR_AHNP) ? " rem" : "",
...@@ -124,19 +123,16 @@ static int state_dbg_show(struct seq_file *s, void *p) ...@@ -124,19 +123,16 @@ static int state_dbg_show(struct seq_file *s, void *p)
(tmp & UDCCR_AIN) >> UDCCR_AIN_S, (tmp & UDCCR_AIN) >> UDCCR_AIN_S,
(tmp & UDCCR_AAISN) >> UDCCR_AAISN_S); (tmp & UDCCR_AAISN) >> UDCCR_AAISN_S);
/* registers for device and ep0 */ /* registers for device and ep0 */
pos += seq_printf(s, "udcicr0=0x%08x udcicr1=0x%08x\n", seq_printf(s, "udcicr0=0x%08x udcicr1=0x%08x\n",
udc_readl(udc, UDCICR0), udc_readl(udc, UDCICR1)); udc_readl(udc, UDCICR0), udc_readl(udc, UDCICR1));
pos += seq_printf(s, "udcisr0=0x%08x udcisr1=0x%08x\n", seq_printf(s, "udcisr0=0x%08x udcisr1=0x%08x\n",
udc_readl(udc, UDCISR0), udc_readl(udc, UDCISR1)); udc_readl(udc, UDCISR0), udc_readl(udc, UDCISR1));
pos += seq_printf(s, "udcfnr=%d\n", udc_readl(udc, UDCFNR)); seq_printf(s, "udcfnr=%d\n", udc_readl(udc, UDCFNR));
pos += seq_printf(s, "irqs: reset=%lu, suspend=%lu, resume=%lu, " seq_printf(s, "irqs: reset=%lu, suspend=%lu, resume=%lu, reconfig=%lu\n",
"reconfig=%lu\n",
udc->stats.irqs_reset, udc->stats.irqs_suspend, udc->stats.irqs_reset, udc->stats.irqs_suspend,
udc->stats.irqs_resume, udc->stats.irqs_reconfig); udc->stats.irqs_resume, udc->stats.irqs_reconfig);
ret = 0; return 0;
out:
return ret;
} }
static int queues_dbg_show(struct seq_file *s, void *p) static int queues_dbg_show(struct seq_file *s, void *p)
...@@ -144,50 +140,47 @@ static int queues_dbg_show(struct seq_file *s, void *p) ...@@ -144,50 +140,47 @@ static int queues_dbg_show(struct seq_file *s, void *p)
struct pxa_udc *udc = s->private; struct pxa_udc *udc = s->private;
struct pxa_ep *ep; struct pxa_ep *ep;
struct pxa27x_request *req; struct pxa27x_request *req;
int pos = 0, i, maxpkt, ret; int i, maxpkt;
ret = -ENODEV;
if (!udc->driver) if (!udc->driver)
goto out; return -ENODEV;
/* dump endpoint queues */ /* dump endpoint queues */
for (i = 0; i < NR_PXA_ENDPOINTS; i++) { for (i = 0; i < NR_PXA_ENDPOINTS; i++) {
ep = &udc->pxa_ep[i]; ep = &udc->pxa_ep[i];
maxpkt = ep->fifo_size; maxpkt = ep->fifo_size;
pos += seq_printf(s, "%-12s max_pkt=%d %s\n", seq_printf(s, "%-12s max_pkt=%d %s\n",
EPNAME(ep), maxpkt, "pio"); EPNAME(ep), maxpkt, "pio");
if (list_empty(&ep->queue)) { if (list_empty(&ep->queue)) {
pos += seq_printf(s, "\t(nothing queued)\n"); seq_puts(s, "\t(nothing queued)\n");
continue; continue;
} }
list_for_each_entry(req, &ep->queue, queue) { list_for_each_entry(req, &ep->queue, queue) {
pos += seq_printf(s, "\treq %p len %d/%d buf %p\n", seq_printf(s, "\treq %p len %d/%d buf %p\n",
&req->req, req->req.actual, &req->req, req->req.actual,
req->req.length, req->req.buf); req->req.length, req->req.buf);
} }
} }
ret = 0; return 0;
out:
return ret;
} }
static int eps_dbg_show(struct seq_file *s, void *p) static int eps_dbg_show(struct seq_file *s, void *p)
{ {
struct pxa_udc *udc = s->private; struct pxa_udc *udc = s->private;
struct pxa_ep *ep; struct pxa_ep *ep;
int pos = 0, i, ret; int i;
u32 tmp; u32 tmp;
ret = -ENODEV;
if (!udc->driver) if (!udc->driver)
goto out; return -ENODEV;
ep = &udc->pxa_ep[0]; ep = &udc->pxa_ep[0];
tmp = udc_ep_readl(ep, UDCCSR); tmp = udc_ep_readl(ep, UDCCSR);
pos += seq_printf(s, "udccsr0=0x%03x(%s%s%s%s%s%s%s)\n", tmp, seq_printf(s, "udccsr0=0x%03x(%s%s%s%s%s%s%s)\n",
tmp,
(tmp & UDCCSR0_SA) ? " sa" : "", (tmp & UDCCSR0_SA) ? " sa" : "",
(tmp & UDCCSR0_RNE) ? " rne" : "", (tmp & UDCCSR0_RNE) ? " rne" : "",
(tmp & UDCCSR0_FST) ? " fst" : "", (tmp & UDCCSR0_FST) ? " fst" : "",
...@@ -198,10 +191,7 @@ static int eps_dbg_show(struct seq_file *s, void *p) ...@@ -198,10 +191,7 @@ static int eps_dbg_show(struct seq_file *s, void *p)
for (i = 0; i < NR_PXA_ENDPOINTS; i++) { for (i = 0; i < NR_PXA_ENDPOINTS; i++) {
ep = &udc->pxa_ep[i]; ep = &udc->pxa_ep[i];
tmp = i? udc_ep_readl(ep, UDCCR) : udc_readl(udc, UDCCR); tmp = i? udc_ep_readl(ep, UDCCR) : udc_readl(udc, UDCCR);
pos += seq_printf(s, "%-12s: " seq_printf(s, "%-12s: IN %lu(%lu reqs), OUT %lu(%lu reqs), irqs=%lu, udccr=0x%08x, udccsr=0x%03x, udcbcr=%d\n",
"IN %lu(%lu reqs), OUT %lu(%lu reqs), "
"irqs=%lu, udccr=0x%08x, udccsr=0x%03x, "
"udcbcr=%d\n",
EPNAME(ep), EPNAME(ep),
ep->stats.in_bytes, ep->stats.in_ops, ep->stats.in_bytes, ep->stats.in_ops,
ep->stats.out_bytes, ep->stats.out_ops, ep->stats.out_bytes, ep->stats.out_ops,
...@@ -210,9 +200,7 @@ static int eps_dbg_show(struct seq_file *s, void *p) ...@@ -210,9 +200,7 @@ static int eps_dbg_show(struct seq_file *s, void *p)
udc_ep_readl(ep, UDCBCR)); udc_ep_readl(ep, UDCBCR));
} }
ret = 0; return 0;
out:
return ret;
} }
static int eps_dbg_open(struct inode *inode, struct file *file) static int eps_dbg_open(struct inode *inode, struct file *file)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册