[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <159486157046.1987609.11356860908068064534@swboyd.mtv.corp.google.com>
Date: Wed, 15 Jul 2020 18:06:10 -0700
From: Stephen Boyd <swboyd@...omium.org>
To: Chunfeng Yun <chunfeng.yun@...iatek.com>,
Felipe Balbi <balbi@...nel.org>,
Florian Fainelli <f.fainelli@...il.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-usb@...r.kernel.org, YueHaibing <yuehaibing@...wei.com>,
linux-kernel@...r.kernel.org,
Chunfeng Yun <chunfeng.yun@...iatek.com>,
linux-mediatek@...ts.infradead.org,
Matthias Brugger <matthias.bgg@...il.com>,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [v3 PATCH] usb: gadget: bdc: use readl_poll_timeout() to simplify code
Quoting Chunfeng Yun (2020-07-12 23:48:01)
> diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c
> index 02a3a77..d567e20 100644
> --- a/drivers/usb/gadget/udc/bdc/bdc_core.c
> +++ b/drivers/usb/gadget/udc/bdc/bdc_core.c
> @@ -29,24 +30,19 @@
> #include "bdc_dbg.h"
>
> /* Poll till controller status is not OIP */
> -static int poll_oip(struct bdc *bdc, int usec)
> +static int poll_oip(struct bdc *bdc, u32 usec)
> {
> 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));
> - 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, "operation timedout BDCSC: 0x%08x\n", status);
> + else
> + dev_dbg(bdc->dev, "%s complete status=%d", __func__, BDC_CSTS(status));
Different than before but OK.
Reviewed-by: Stephen Boyd <swboyd@...omium.org>
Powered by blists - more mailing lists