From patchwork Tue Apr 10 01:47:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia-Ju Bai X-Patchwork-Id: 10332201 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 41C536053B for ; Tue, 10 Apr 2018 01:47:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2413028C9B for ; Tue, 10 Apr 2018 01:47:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17C5D28C9A; Tue, 10 Apr 2018 01:47:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A78FE28C20 for ; Tue, 10 Apr 2018 01:47:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751650AbeDJBrZ (ORCPT ); Mon, 9 Apr 2018 21:47:25 -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-Google-Smtp-Source: AIpwx48tGN8Fk8/LWA/0XnFvIC/K9b5epQ2APS0j6mj/6VWUrf6iKmZz1kKTTN3c2tMy/TJX56wt9w== 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-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);