lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1594609574.23885.35.camel@mhfsdcap03>
Date:   Mon, 13 Jul 2020 11:06:14 +0800
From:   Chunfeng Yun <chunfeng.yun@...iatek.com>
To:     Stephen Boyd <swboyd@...omium.org>
CC:     Felipe Balbi <balbi@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        <linux-usb@...r.kernel.org>, YueHaibing <yuehaibing@...wei.com>,
        <linux-kernel@...r.kernel.org>,
        <linux-mediatek@...ts.infradead.org>,
        Matthias Brugger <matthias.bgg@...il.com>,
        <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH] usb: gadget: bdc: use readl_poll_timeout() to simplify
 code

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;
> >  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ