Received: by 10.213.65.68 with SMTP id h4csp3312617imn; Mon, 9 Apr 2018 18:50:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+sGGBfH2/95yTEkNgue/Gp5jJniS2yjumSLNmA/ZzZEDT8x3sW4W9SjiOwf2efq/iJJ1r+ X-Received: by 2002:a17:902:6b8b:: with SMTP id p11-v6mr41466715plk.213.1523325051587; Mon, 09 Apr 2018 18:50:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523325051; cv=none; d=google.com; s=arc-20160816; b=FceSIweJsML2IkB9ZjpZ2IMroQEt6k44HZlUn6Bb1I9y44cblBomf1docaGkkHiYvl j0FE10Tc83AuBkjzxTsfv3zg1B4tok7uZr2SPqRN2yB2K7nx7lHKWR0TOyJBJvRTANAS GNjhGrCa+etT5kOgZliaga/8ngozwjD8PmrhPpfK2v7iKBemrdwLiU0ZZj+Bu/1B8094 3EqVCq3GjluevlVqnxFviJ6agshzUMh1kPH1ddVktuzVIR72bNROICFq4QaNpARSMA0t yR+Zhmx/hoZZy+Ffk2iNj/gj6NR+sxATlfLpLdBEWghu6XzVESxC34sEvAK+KhBwI9p2 w+YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=aGlR7UHEKZMm/FIfpZQBzZTimiTxfG3mmmX9G4th1DY=; b=ggSVCmO02jhHMUjuI63+v2/bHuxgkSCUbI/Aas7ZgWMSljAieKT44bpCoIBdjqRJKq psE6wQnh3Opfzm3RPzjK0Q6VBeVDUCG0SaNtR9RSkHCuwXQ9Hsy6V5zC+uCTRVXQWt88 5E/XIhlbMtRCNCgRp36vufWG1j8/1OhwMCZvlmYG7+2+BLfWEDyYANq68fW++/Fu8dCK dau5wSOWfeYhz9LMv2dZSX8ZuBU8gRi//hHO43Ke6M0F4EkKehvtuKQPuPoSffRa+If5 hJv+4AS6lqKuh8J+z/zFWykfsikdTp8sAiAFRS0rmVZRz0FlEtR9njzmHXQcFJGqc4hD sZgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jMeXjLBF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 126si1000020pgd.375.2018.04.09.18.50.14; Mon, 09 Apr 2018 18:50:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jMeXjLBF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751856AbeDJBr0 (ORCPT + 99 others); Mon, 9 Apr 2018 21:47:26 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:46620 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751505AbeDJBrZ (ORCPT ); Mon, 9 Apr 2018 21:47:25 -0400 Received: by mail-pf0-f194.google.com with SMTP id h69so6906746pfe.13; Mon, 09 Apr 2018 18:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=aGlR7UHEKZMm/FIfpZQBzZTimiTxfG3mmmX9G4th1DY=; b=jMeXjLBFoRQUzztSyEZcbOBVgY+UbZZAnAdKBhlTq2rJ2XEWXEvtCzzkRsp+219K1s t4n9WsXh6zIHizXNzVIYuLB2ErFwweGIBRlYgMoe+XabZVoeILLKJGqm0ASLdaGuaHUB t0bV70G+gLwPNkPT/zxNOyfc0ZtIDA1rHWHrcB38ipwimpHdIs2SKr6aFKP4o9oNSx/P pO8SP85LOdGsa8Kwgq1l7uWfBPWxh55GAWJS0kIDhw56frPNakDf53VYYzuwz16tvIu6 JYNacFjz8xocPDjelDID0rjaywqug99vcQ9tUzA2R+owig6Ia9L+DxjR2frJewaaCnUj G1jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=aGlR7UHEKZMm/FIfpZQBzZTimiTxfG3mmmX9G4th1DY=; b=YksJO3pVD0dNaJ6xt/+EGh3+2F1+asuw02lW+OBjS1xzz2iIebIXe4aKrlQxSdazip JA1fUpyIcG26+JMmsebiRDow0qYZ8NsMyMB8RQaI5MWT3iCZacRo1Nn1fGIybh4vOA8n lhosFX9wobODP9yZ4BySf9ZonrR1K8v5iX8BA9w8+/vpAkDmax3fGS1HtL5ImG4gWeHf 3kOnZS9qVeZ+hzp5zUMSMJFNfxWKEK8gqgw4+AlWeGzJPUuJtyuDv6hDErCDUaOztkEd EJI9HLf/JCIxl1MsUvKtD1zMAlZhxn75cuPsUYCUrXsyW/tTbuxBuCebIWGJ2FWcWH8+ y15g== X-Gm-Message-State: ALQs6tCkEzzXsmb+KJEkPSFG4nbUwNRKEQc77yV84lMqGV4KXBv4QHp4 BkBNrlbF/QRkmFP9TE6owgI= X-Received: by 10.101.71.136 with SMTP id e8mr15159729pgs.12.1523324844752; Mon, 09 Apr 2018 18:47:24 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id r9sm2713352pfg.128.2018.04.09.18.47.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Apr 2018 18:47:24 -0700 (PDT) From: Jia-Ju Bai To: benh@kernel.crashing.org, b.zolnierkie@samsung.com Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] video: fbdev: aty: radeon_pm: Replace mdelay with msleep in radeonfb_pci_suspend Date: Tue, 10 Apr 2018 09:47:20 +0800 Message-Id: <1523324840-28830-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/video/fbdev/aty/radeon_pm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/aty/radeon_pm.c b/drivers/video/fbdev/aty/radeon_pm.c index 1417542..a8de909 100644 --- a/drivers/video/fbdev/aty/radeon_pm.c +++ b/drivers/video/fbdev/aty/radeon_pm.c @@ -2674,17 +2674,17 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t mesg) * it, we'll restore the dynamic clocks state on wakeup */ radeon_pm_disable_dynamic_mode(rinfo); - mdelay(50); + msleep(50); radeon_pm_save_regs(rinfo, 1); if (rinfo->is_mobility && !(rinfo->pm_mode & radeon_pm_d2)) { /* Switch off LVDS interface */ - mdelay(1); + usleep_range(1000, 2000); OUTREG(LVDS_GEN_CNTL, INREG(LVDS_GEN_CNTL) & ~(LVDS_BL_MOD_EN)); - mdelay(1); + usleep_range(1000, 2000); OUTREG(LVDS_GEN_CNTL, INREG(LVDS_GEN_CNTL) & ~(LVDS_EN | LVDS_ON)); OUTREG(LVDS_PLL_CNTL, (INREG(LVDS_PLL_CNTL) & ~30000) | 0x20000); - mdelay(20); + msleep(20); OUTREG(LVDS_GEN_CNTL, INREG(LVDS_GEN_CNTL) & ~(LVDS_DIGON)); } pci_disable_device(pdev); -- 1.9.1