[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c28a906c-ed1a-8884-3016-b8664a313331@gmail.com>
Date: Thu, 20 Aug 2020 13:17:49 +0300
From: Sergei Shtylyov <sergei.shtylyov@...il.com>
To: Chunfeng Yun <chunfeng.yun@...iatek.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Felipe Balbi <balbi@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org,
Lee Jones <lee.jones@...aro.org>
Subject: Re: [PATCH v2 09/11] usb: phy: phy-mv-usb: convert to
readl_poll_timeout_atomic()
On 20.08.2020 8:45, Chunfeng Yun wrote:
> Use readl_poll_timeout_atomic() to simplify code
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@...iatek.com>
> ---
> v2: udelay 10us instead of 20us according to kerneldoc
> ---
> drivers/usb/phy/phy-mv-usb.c | 16 +++++++---------
> 1 file changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/usb/phy/phy-mv-usb.c b/drivers/usb/phy/phy-mv-usb.c
> index ce767ec..e801569 100644
> --- a/drivers/usb/phy/phy-mv-usb.c
> +++ b/drivers/usb/phy/phy-mv-usb.c
> @@ -8,6 +8,7 @@
> #include <linux/module.h>
> #include <linux/kernel.h>
> #include <linux/io.h>
> +#include <linux/iopoll.h>
> #include <linux/uaccess.h>
> #include <linux/device.h>
> #include <linux/proc_fs.h>
> @@ -135,8 +136,8 @@ static int mv_otg_set_timer(struct mv_otg *mvotg, unsigned int id,
>
> static int mv_otg_reset(struct mv_otg *mvotg)
> {
> - unsigned int loops;
> u32 tmp;
> + int ret;
>
> /* Stop the controller */
> tmp = readl(&mvotg->op_regs->usbcmd);
> @@ -146,15 +147,12 @@ static int mv_otg_reset(struct mv_otg *mvotg)
> /* Reset the controller to get default values */
> writel(USBCMD_CTRL_RESET, &mvotg->op_regs->usbcmd);
>
> - loops = 500;
> - while (readl(&mvotg->op_regs->usbcmd) & USBCMD_CTRL_RESET) {
> - if (loops == 0) {
> - dev_err(&mvotg->pdev->dev,
> + ret = readl_poll_timeout_atomic(&mvotg->op_regs->usbcmd, tmp,
> + (tmp & USBCMD_CTRL_RESET), 10, 10000);
> + if (ret < 0) {
> + dev_err(&mvotg->pdev->dev,
> "Wait for RESET completed TIMEOUT\n");
You forgot to re-align this argument, it should start under & on the
previous line...
[...]
MBR, Sergei
Powered by blists - more mailing lists