Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

video: fbdev: aty: radeon_pm: Replace mdelay with msleep in radeonfb_pci_suspend

radeonfb_pci_suspend() is never called in atomic context.

radeonfb_pci_suspend() is only set as ".suspend" in struct pci_driver.
This function is not called in atomic context.

Despite never getting called from atomic context, radeonfb_pci_suspend()
calls mdelay() to busily wait.
This is not necessary and can be replaced with msleep()
and 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>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

authored by

Jia-Ju Bai and committed by
Bartlomiej Zolnierkiewicz
de117312 86c4e7c3

+4 -4
+4 -4
drivers/video/fbdev/aty/radeon_pm.c
··· 2678 2678 * it, we'll restore the dynamic clocks state on wakeup 2679 2679 */ 2680 2680 radeon_pm_disable_dynamic_mode(rinfo); 2681 - mdelay(50); 2681 + msleep(50); 2682 2682 radeon_pm_save_regs(rinfo, 1); 2683 2683 2684 2684 if (rinfo->is_mobility && !(rinfo->pm_mode & radeon_pm_d2)) { 2685 2685 /* Switch off LVDS interface */ 2686 - mdelay(1); 2686 + usleep_range(1000, 2000); 2687 2687 OUTREG(LVDS_GEN_CNTL, INREG(LVDS_GEN_CNTL) & ~(LVDS_BL_MOD_EN)); 2688 - mdelay(1); 2688 + usleep_range(1000, 2000); 2689 2689 OUTREG(LVDS_GEN_CNTL, INREG(LVDS_GEN_CNTL) & ~(LVDS_EN | LVDS_ON)); 2690 2690 OUTREG(LVDS_PLL_CNTL, (INREG(LVDS_PLL_CNTL) & ~30000) | 0x20000); 2691 - mdelay(20); 2691 + msleep(20); 2692 2692 OUTREG(LVDS_GEN_CNTL, INREG(LVDS_GEN_CNTL) & ~(LVDS_DIGON)); 2693 2693 } 2694 2694 pci_disable_device(pdev);