From patchwork Tue Apr 10 01:40:35 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: 10332197 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 DA4566020F for ; Tue, 10 Apr 2018 01:40:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C82DC28C80 for ; Tue, 10 Apr 2018 01:40:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BCF0E28C85; Tue, 10 Apr 2018 01:40:47 +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 5F1E728C80 for ; Tue, 10 Apr 2018 01:40:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751767AbeDJBkq (ORCPT ); Mon, 9 Apr 2018 21:40:46 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:40697 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751543AbeDJBkp (ORCPT ); Mon, 9 Apr 2018 21:40:45 -0400 Received: by mail-pl0-f67.google.com with SMTP id x4-v6so6340937pln.7; Mon, 09 Apr 2018 18:40:45 -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=xvNzqJjaTwn8dpUlPeL4ut3MgVTJyeqfLrr2r3kERPw=; b=qi7reEF7PiWKPHjcHi+CjMk0rtgExGnR3z+H3aZtnl2LdJ6DRBihhnxi4AFwYeI3O3 KskeCRwKuJbjRqCoYiG9MCO3leqdK0+ow70Z3ox0FNwBCz2tTut6bmPKw8zxgedzSYP7 T5paim496wlQIenngnZgwt40TLVYTekIyoot5IjXYKPGixFNP1qZY/axcSB/4+2vPkmS j8bZeXPA4+LlaF1fnYhkMpSbr1vFymqKA2aiwp63uihE70KJrjKS5v4QPY5Nrt35opgw Q3Ds3VQnWEik/tojfYgQQ3Q773DunaXOEVWA20EfT9SafyJ5Wl+2MK8CzD2X4JLh2Yz5 cW/A== 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=xvNzqJjaTwn8dpUlPeL4ut3MgVTJyeqfLrr2r3kERPw=; b=rYIzbVy3HJuWBNAwJhQ1FC/f9QS7MqzyfFq0ECWi0PN7s4vrLvFvNVek65YdxV1xpP Nsj/Nj/hdHbeoPc0qt5LNyREpGI0rV6B7xqU7v/ubBN1p+crHiRow2Lb9HS4zRXOmwMK CjoT3jWSmpn56sLTfZ+K7xhPQtWequNx2eCPGdOaNOC34MFkJxfv5mJm9IbGUYwi/qsD yl7cQ6b03kUb34LbFwoPyFea39mnNDQRBAiH2aMfuW2R6kJ8ElU+x0lXVYX3jT+sJqvw CHo7fWsxsUiLQJpXVlPGe3rQ43xFO+EPG8a8v3RDwsQDe2ZCTU4qEm8zpWjK9BhWkRg0 V2NQ== X-Gm-Message-State: ALQs6tAAG3oU0gwzj8QFZVEJZ4tGTH8j3FenNVyGqre6F1PeH7pmJUZB 3m3BFyp/3wchc088+jZX7IQ= X-Google-Smtp-Source: AIpwx4/NWRJ1QOt6WDKk+yv3oRYzVMvWvk3kvnaPj62yX6PtuLpjEkW5eqB7Jc/k2sjjoUzjJrx6ug== X-Received: by 2002:a17:902:d807:: with SMTP id a7-v6mr8345726plz.314.1523324445329; Mon, 09 Apr 2018 18:40:45 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id x137sm2489401pfd.162.2018.04.09.18.40.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Apr 2018 18:40:44 -0700 (PDT) From: Jia-Ju Bai To: paulus@samba.org, b.zolnierkie@samsung.com Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] video: fbdev: aty: aty128fb: Replace mdelay with msleep in aty128_set_suspend Date: Tue, 10 Apr 2018 09:40:35 +0800 Message-Id: <1523324435-28719-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 aty128_set_suspend() is never called in atomic context. The call chains ending up at aty128_set_suspend() are: [1] aty128_set_suspend() <- aty128_pci_suspend() [2] aty128_set_suspend() <- aty128_do_resume() <- aty128_pci_resume() [3] aty128_set_suspend() <- aty128_do_resume() <- aty128_early_resume() aty128_pci_suspend() is set as ".suspend" in struct pci_driver. aty128_pci_resume() is set as ".resume" in struct pci_driver. aty128_early_resume() is never called. These functions are not called in atomic context. Despite never getting called from atomic context, aty128_set_suspend() calls mdelay() to busily wait. This is not necessary and can be replaced with msleep() 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/aty128fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c index db18474..15dfdff 100644 --- a/drivers/video/fbdev/aty/aty128fb.c +++ b/drivers/video/fbdev/aty/aty128fb.c @@ -2442,7 +2442,7 @@ static void aty128_set_suspend(struct aty128fb_par *par, int suspend) (void)aty_ld_pll(POWER_MANAGEMENT); aty_st_le32(BUS_CNTL1, 0x00000010); aty_st_le32(MEM_POWER_MISC, 0x0c830000); - mdelay(100); + msleep(100); /* Switch PCI power management to D2 */ pci_set_power_state(pdev, PCI_D2);