]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
phy: phy-bcm-sr-usb: convert to readl_poll_timeout_atomic()
authorChunfeng Yun <chunfeng.yun@mediatek.com>
Tue, 25 Aug 2020 02:03:04 +0000 (10:03 +0800)
committerVinod Koul <vkoul@kernel.org>
Tue, 8 Sep 2020 04:26:11 +0000 (09:56 +0530)
Use readl_poll_timeout_atomic() to simplify code

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1598320987-25518-3-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/broadcom/phy-bcm-sr-usb.c

index 77c025a0720ca77b0f7caea2fd0f63dd377a5ef1..c3e99ad174874496ac68978a98bebc55e37c1dc4 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <linux/delay.h>
 #include <linux/io.h>
+#include <linux/iopoll.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/phy/phy.h>
@@ -109,19 +110,15 @@ static inline void bcm_usb_reg32_setbits(void __iomem *addr, uint32_t set)
 
 static int bcm_usb_pll_lock_check(void __iomem *addr, u32 bit)
 {
-       int retry;
-       u32 rd_data;
+       u32 data;
+       int ret;
 
-       retry = PLL_LOCK_RETRY_COUNT;
-       do {
-               rd_data = readl(addr);
-               if (rd_data & bit)
-                       return 0;
-               udelay(1);
-       } while (--retry > 0);
+       ret = readl_poll_timeout_atomic(addr, data, (data & bit), 1,
+                                       PLL_LOCK_RETRY_COUNT);
+       if (ret)
+               pr_err("%s: FAIL\n", __func__);
 
-       pr_err("%s: FAIL\n", __func__);
-       return -ETIMEDOUT;
+       return ret;
 }
 
 static int bcm_usb_ss_phy_init(struct bcm_usb_phy_cfg *phy_cfg)