Received: by 10.192.165.156 with SMTP id m28csp446107imm; Wed, 11 Apr 2018 01:34:37 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+m9BPXtnZ8U6BJLDWx7YT7k9GeKjH9AIcupHCS+WhrOPAblhZsFfZVBe5ynTAJgrdiOnYH X-Received: by 10.101.102.5 with SMTP id w5mr2713462pgv.151.1523435677299; Wed, 11 Apr 2018 01:34:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523435677; cv=none; d=google.com; s=arc-20160816; b=Jnlju7EuTQJAitZ7c77leR0ga1rznOMAkZ+7x9KjN6ligSVGZkRbO7KTgsddvVk138 QkuhKwQfM+yxw9vwvqmqaAa3rfxycCNBL5n8Pbuf5VSDcGGefnR0PqzJ0hPWGXQtnIni pNVBcJ1qtbO3cu+E4GcIXVoXOuVbuRgBfxOlvp+fyVIUPxbDMTsRLiluSnsL7gss3DuL GiQU56xcqumop0OdsmdPkpBu83LkZ4MRVvxCvLPO75CBJr4s3XvMwEgE2AilYMgk3LqQ ooeakYDqKgbKTwcnJCWe7Q/zt3x9NLUMx39OKXX1B95Pf6+hlzxLEBoHvhJW+7OsI+yB h41A== 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=9Ng+CHlt/gluLDwGdHj94TXkGaSp62Puidk9hylt09s=; b=OnnuTw/Y2OfHwtOYFT+mdu+ot0+Ml0IrIvZ9BKn2ifKTW4QYOvmr3rH3SdCgjuV9GJ g/A3v8R/vFR+3zASAhNFVAYMHTSlX8N2aA/tMoYFLGDzOFYblwyowx4YeUuXM+MDNuVN +KMNllouTclLPaQxuvUdnGF40EEACatBEHyHAq+bIIuzkKRvLY4GlpUJ37hnwzCjltg5 QQ1XnN3KeqA6GnOgnzWAULvRg1cmkGpb+tdYJC2FvELwU5N4WY7UAZ9Fn5t5R+Oin7x5 /ARWsz2yTJipt4pDnQRgpJq9hfyU2Rw66kTl5KlUp4GOHdRn5HcsOjAGQ2l4HnEHYVKp +Nxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=E5f0LdYt; 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 z19si435569pgn.46.2018.04.11.01.33.59; Wed, 11 Apr 2018 01:34:37 -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=E5f0LdYt; 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 S1752430AbeDKIa1 (ORCPT + 99 others); Wed, 11 Apr 2018 04:30:27 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:52356 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751898AbeDKIaZ (ORCPT ); Wed, 11 Apr 2018 04:30:25 -0400 Received: by mail-it0-f67.google.com with SMTP id f6-v6so1702589ita.2 for ; Wed, 11 Apr 2018 01:30: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=9Ng+CHlt/gluLDwGdHj94TXkGaSp62Puidk9hylt09s=; b=E5f0LdYtP+NmKZwi7iNWwu9s0ciUS+PR1lTX82bDEzd8V1/JhmuWSqtiLyOsAhm9Tj k2DWogGT+TvvSplPpj4wXDOCb+b4hFZl6EsDTVraL7wLszx18PqAUqClRUeQgr5NE6a2 gB+I65xhWXfFJuELLbXtEVAhR3K6vLCJU3evvH6MExIVw7jBEOKM7WWTbZzaXEQ11Nyd WXxeJ1t8EKEYkN86pHMenf4J2bT4gv1FM/8vg1nDOJW/3984BhaEoDOXS3ntwPOwwcjZ Xx8tHeRxCgbrHdK7joqKpijmB/YpRMVfKDTH6bO2v0GWTfk6qnWKEPHu7S9c/v5Prwkf 9Igw== 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=9Ng+CHlt/gluLDwGdHj94TXkGaSp62Puidk9hylt09s=; b=S8bNhh9fAzxcPH7ZG3CUO4VZAHyF7eRY/nH6slgMWk6aD0Gg28Exkw+htwMDuTHnLq f9ZnTunNJ5JCPgZR7Rf7xns1gzhSYa6OkWUmwZXIeXwk42O1JhvaN7ZYgyscTQlj5XnS WmpkszkUfZZJgtgqUvzHj91ue4Ymqh2W9lAxH+3SyB6y3hN4cH/yYZWdKrWOeZ4QFRhW zcATvWWsjuLFvFw38vqBHxrKb+q+yth5Jba8uyxDBVbv2pNm4Baa1FEbx1vfMPtPhalh 1M9+lDfrhtqKr8nSAePxiHtJIwMtFHGrriJ7h0smS/sECxCu2ZErv0jVgEJkWEqlVJhu Nfxg== X-Gm-Message-State: ALQs6tAXHwPbdsbprWtNstHWXBIbKX2AFuEQsBQdzZC772xM8LwvGNpF qO/w2QpU05hx2Ql0G1W9XkM= X-Received: by 2002:a24:ac61:: with SMTP id m33-v6mr2895198iti.116.1523435424828; Wed, 11 Apr 2018 01:30:24 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id c90-v6sm477985itd.28.2018.04.11.01.30.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Apr 2018 01:30:24 -0700 (PDT) From: Jia-Ju Bai To: airlied@redhat.com, airlied@linux.ie Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 2/2] gpu: drm: ast: Replace mdelay with msleep in ast_post_chip_2500 Date: Wed, 11 Apr 2018 16:30:16 +0800 Message-Id: <1523435416-4256-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 ast_post_chip_2500() is never called in atomic context. The call chains ending up at reset_mmc_2500() are: [1] ast_post_chip_2500() <- ast_post_gpu() <- ast_drm_thaw() [2] ast_post_chip_2500() <- ast_post_gpu() <- ast_driver_load() ast_drm_thaw() calls console_lock() which can sleep. ast_driver_load() is set as ".load" in struct drm_driver. These functions are not called in atomic context. Despite never getting called from atomic context, ast_post_chip_2500() 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/gpu/drm/ast/ast_post.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c index f7d4213..67c5e50 100644 --- a/drivers/gpu/drm/ast/ast_post.c +++ b/drivers/gpu/drm/ast/ast_post.c @@ -2063,7 +2063,7 @@ void ast_post_chip_2500(struct drm_device *dev) temp = ast_mindwm(ast, 0x1e6e2070); if (temp & 0x00800000) { ast_moutdwm(ast, 0x1e6e207c, 0x00800000); - mdelay(100); + msleep(100); ast_moutdwm(ast, 0x1e6e2070, 0x00800000); } -- 1.9.1