Message ID | 1523413280-2336-1-git-send-email-baijiaju1990@gmail.com |
---|---|
State | Rejected, archived |
Delegated to: | David Miller |
Headers | show |
Series | net: samsung: sxgbe: Replace mdelay with usleep_range in sxgbe_sw_reset | expand |
Hi Jia-Ju, Thank you for the patch! Yet something to improve: [auto build test ERROR on net-next/master] [also build test ERROR on v4.16 next-20180411] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Jia-Ju-Bai/net-samsung-sxgbe-Replace-mdelay-with-usleep_range-in-sxgbe_sw_reset/20180411-225900 config: i386-randconfig-x019-201814 (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): drivers/net//ethernet/samsung/sxgbe/sxgbe_main.c: In function 'sxgbe_sw_reset': >> drivers/net//ethernet/samsung/sxgbe/sxgbe_main.c:2039:3: error: implicit declaration of function 'usleep'; did you mean 'ssleep'? [-Werror=implicit-function-declaration] usleep(10000, 11000); ^~~~~~ ssleep cc1: some warnings being treated as errors vim +2039 drivers/net//ethernet/samsung/sxgbe/sxgbe_main.c 2029 2030 static int sxgbe_sw_reset(void __iomem *addr) 2031 { 2032 int retry_count = 10; 2033 2034 writel(SXGBE_DMA_SOFT_RESET, addr + SXGBE_DMA_MODE_REG); 2035 while (retry_count--) { 2036 if (!(readl(addr + SXGBE_DMA_MODE_REG) & 2037 SXGBE_DMA_SOFT_RESET)) 2038 break; > 2039 usleep(10000, 11000); 2040 } 2041 2042 if (retry_count < 0) 2043 return -EBUSY; 2044 2045 return 0; 2046 } 2047 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi Jia-Ju, Thank you for the patch! Yet something to improve: [auto build test ERROR on net-next/master] [also build test ERROR on v4.16 next-20180411] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Jia-Ju-Bai/net-samsung-sxgbe-Replace-mdelay-with-usleep_range-in-sxgbe_sw_reset/20180411-225900 config: i386-randconfig-s1-201814 (attached as .config) compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026 reproduce: # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): drivers/net//ethernet/samsung/sxgbe/sxgbe_main.c: In function 'sxgbe_sw_reset': >> drivers/net//ethernet/samsung/sxgbe/sxgbe_main.c:2039:3: error: implicit declaration of function 'usleep' [-Werror=implicit-function-declaration] usleep(10000, 11000); ^~~~~~ cc1: some warnings being treated as errors vim +/usleep +2039 drivers/net//ethernet/samsung/sxgbe/sxgbe_main.c 2029 2030 static int sxgbe_sw_reset(void __iomem *addr) 2031 { 2032 int retry_count = 10; 2033 2034 writel(SXGBE_DMA_SOFT_RESET, addr + SXGBE_DMA_MODE_REG); 2035 while (retry_count--) { 2036 if (!(readl(addr + SXGBE_DMA_MODE_REG) & 2037 SXGBE_DMA_SOFT_RESET)) 2038 break; > 2039 usleep(10000, 11000); 2040 } 2041 2042 if (retry_count < 0) 2043 return -EBUSY; 2044 2045 return 0; 2046 } 2047 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c index 89831ad..99cd586 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c @@ -2038,7 +2038,7 @@ static int sxgbe_sw_reset(void __iomem *addr) if (!(readl(addr + SXGBE_DMA_MODE_REG) & SXGBE_DMA_SOFT_RESET)) break; - mdelay(10); + usleep(10000, 11000); } if (retry_count < 0)
sxgbe_sw_reset() is never called in atomic context. sxgbe_sw_reset() is only called by sxgbe_drv_probe(), which is only called by sxgbe_platform_probe(). sxgbe_platform_probe() is set as ".probe" in struct platform_driver. This function is not called in atomic context. Despite never getting called from atomic context, sxgbe_sw_reset() calls mdelay() to busily wait. This is not necessary and can be replaced with usleep_range() to avoid busy waiting. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> --- drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)