Received: by 10.192.165.156 with SMTP id m28csp448268imm; Wed, 11 Apr 2018 01:37:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx49LCSQTOhV70nzOi+xIWZ4f4pmoeilpqFEd+B+i3dH5eQ3S1T2wlYp7BLbl8MbWuyLf0DBX X-Received: by 10.101.81.11 with SMTP id f11mr2766856pgq.150.1523435842807; Wed, 11 Apr 2018 01:37:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523435842; cv=none; d=google.com; s=arc-20160816; b=fPGFlq6JZwmkyFhMOB9eBgQMP83hqE9u9dKWt1IcZYSQfpxzWBPEeaA+eIXhBYoY6P OKvmmj/Bq6pK79mC1uhDDx6N3WeH/kCZkQFNx8XYwbxtAwWiVByip7XlK6qtXTp66S0X hUBE20wVHad/zcDwLaVgyezNpMb8hUO9o4FQMYlKMS+SDOm2iO+1/SIfuU+ghMsaMxMu p3/irau5vsxwWIdZiubttUYJQ4agw9BsnZgNrgaeJJzuBU6gT+e2n233wyBbFe/EL0gb FJzulmG9EuRNwFn2Tc5dG+XMDtEtl3oh3IUiwfzDdIYMWp7TOD+F6oFK/sHFbTpSpP96 jGNg== 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=JONa/8TNxGE1smXfAzaslXULuVWvaJ+2szyEOb+Dl/k=; b=weR/uE5Sub4lzCwskrX4NyEOMMVryZwf2QSWKmpq+ovo/hEXmklFwJD0Qx3+zy7z54 pUXhi1OcZmGCt67eP8oEE7fvWWoaPwb4PsHgIG381MPqXzPLYHSvq+imShJ7pZgdtAgV nPROP1ewCjEutA51LZLcJwK2BkdDverQrDlkbnW+3azUc7u/Dpd8CFTkrdVAVH8NFuok KYcJ4N9sGpdYxITXrMGYM+1q/tLyubTGXio4tp/+wYep9t8vhusIBoUIH5JaAb0TnTkB zrExmjl6EKlb4gEC426kQIHATvRpViVgi9IBiQZDKarpnaAlJ1SOX6s3S3iZ7axs2M8O UJDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Lm1cs9BI; 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 o27si427547pgn.428.2018.04.11.01.36.45; Wed, 11 Apr 2018 01:37:22 -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=Lm1cs9BI; 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 S1752323AbeDKIaD (ORCPT + 99 others); Wed, 11 Apr 2018 04:30:03 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:45644 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751861AbeDKIaA (ORCPT ); Wed, 11 Apr 2018 04:30:00 -0400 Received: by mail-pl0-f68.google.com with SMTP id e22-v6so849415plj.12 for ; Wed, 11 Apr 2018 01:30:00 -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=JONa/8TNxGE1smXfAzaslXULuVWvaJ+2szyEOb+Dl/k=; b=Lm1cs9BIu7CgGpvM7vkqYJTXgzrIOIX3JGytfjNcaCXuFHBIIdq9eb/RerAQXS9t/l bfUmigL8Jgb3zOMcqM+b2OTKA6RCndN/8ATVYcjJCO+B8JrAC73PzCm/prYFb2+LL6m7 wVMeYQZ01Rn+EMRF1FzM+PnufuP+RO7TAmD+vBXRd0AmX8uV3DAwwDYBOSNL4/ntRp87 jfaU4u0FymrzvQ4q6Pxy/39DMUKaplocYkw3mBF5FuUnWk01iaVyGXH9QMPgBEtGNsjF DO1oNJ4y2hOMBcTfF2EZ9qHhgY/r5YA27Dc7gjOk/TC4Ey7Es4mYmbnnCIh2QI5TM1gc xcAw== 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=JONa/8TNxGE1smXfAzaslXULuVWvaJ+2szyEOb+Dl/k=; b=WF4Sz1ge5kgKyMWMplRYlK0Gw2+yzVW89dEATlX/4j+eUtcjZFY9E23tGUJsBzDoiX dYxthpBAp+QKef3DlAI1GUc3ZRSj9SbhAlZkU1kJyFA701ZQey9SSbHiaamrgioe56n5 o9a3O3oF+9aUf8NLj82aelHSmsszkLmufd7g0B0FlnL3yMT7afZwoQs5KfvBrZCrF/Lv /lfVrreylfQ5VLteWb8utsF7VvfJGLLBL7A2dTYWk/rWmqAhwCnITLf6TARFNsoD68N+ 9kHj/jS57nTduoWQ5tQFy4fk7abomysRp5xGKu3hPFBYG/JlWjuUzafSGkqioWaffJXI hIzg== X-Gm-Message-State: ALQs6tDcT19ljwdDyMYmZfo0bgaBgtPd5zpL+EgmfVQqJ67VK7L+z+WI 3oBdqg46B6o2QWTCSqD+Ncs= X-Received: by 2002:a17:902:8c8e:: with SMTP id t14-v6mr4067329plo.206.1523435400595; Wed, 11 Apr 2018 01:30:00 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id s63sm2715200pfe.6.2018.04.11.01.29.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Apr 2018 01:30:00 -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 1/2] gpu: drm: ast: Replace mdelay with msleep in reset_mmc_2500 Date: Wed, 11 Apr 2018 16:29:36 +0800 Message-Id: <1523435376-4210-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 reset_mmc_2500() is never called in atomic context. The call chains ending up at reset_mmc_2500() are: [1] reset_mmc_2500() <- ast_dram_init_2500() <- ast_post_chip_2500() <- ast_post_gpu() <- ast_drm_thaw() [2] reset_mmc_2500() <- ast_dram_init_2500() <- 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, reset_mmc_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..12bbf64 100644 --- a/drivers/gpu/drm/ast/ast_post.c +++ b/drivers/gpu/drm/ast/ast_post.c @@ -1840,7 +1840,7 @@ static void reset_mmc_2500(struct ast_private *ast) ast_moutdwm(ast, 0x1E785044, 0x00000001); ast_moutdwm(ast, 0x1E785048, 0x00004755); ast_moutdwm(ast, 0x1E78504C, 0x00000013); - mdelay(100); + msleep(100); ast_moutdwm(ast, 0x1E785054, 0x00000077); ast_moutdwm(ast, 0x1E6E0000, 0xFC600309); } -- 1.9.1