lkml.org 
[lkml]   [2020]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] usb: gadget: bdc: use readl_poll_timeout() to simplify code
From
Date
On Fri, 2020-07-10 at 16:37 -0700, Stephen Boyd wrote:
> Quoting Chunfeng Yun (2020-07-09 20:30:56)
> > diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c
> > index 02a3a77..fa173de 100644
> > --- a/drivers/usb/gadget/udc/bdc/bdc_core.c
> > +++ b/drivers/usb/gadget/udc/bdc/bdc_core.c
> > @@ -32,21 +33,14 @@
> > static int poll_oip(struct bdc *bdc, int usec)
>
> Can we change usec to unsigned? Not sure why negative time is important.
Yes, it's sensible to use unsigned.

>
> > {
> > u32 status;
> > - /* Poll till STS!= OIP */
> > - while (usec) {
> > - status = bdc_readl(bdc->regs, BDC_BDCSC);
> > - if (BDC_CSTS(status) != BDC_OIP) {
> > - dev_dbg(bdc->dev,
> > - "poll_oip complete status=%d",
> > - BDC_CSTS(status));
>
> This debug message was lost in the conversion. Any reason?
No, will add it back
>
> > - return 0;
> > - }
> > - udelay(10);
> > - usec -= 10;
> > - }
> > - dev_err(bdc->dev, "Err: operation timedout BDCSC: 0x%08x\n", status);
> > + int ret;
> >
> > - return -ETIMEDOUT;
> > + ret = readl_poll_timeout(bdc->regs + BDC_BDCSC, status,
> > + (BDC_CSTS(status) != BDC_OIP), 10, usec);
> > + if (ret)
> > + dev_err(bdc->dev, "Err: operation timedout BDCSC: 0x%08x\n", status);
>
> Please drop "Err:" as we have kernel log levels (i.e. dev_err() used
> here) for that.
Ok

Thanks

>
> > +
> > + return ret;
> > }

\
 
 \ /
  Last update: 2020-07-13 05:08    [W:0.061 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site