Re: [PATCH] usb: gadget: bdc: use readl_poll_timeout() to simplify code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

>  {
>         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?

> -                       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.

> +
> +       return ret;
>  }




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux