Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1047262imm; Fri, 3 Aug 2018 17:07:02 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeSW3+0HoDW3bZc/0vKzOkliLK3kI4H57Z39jfmPSyloK4dpQ+xUyRXVaxq6qa8OBtMflUG X-Received: by 2002:a63:be4a:: with SMTP id g10-v6mr5615885pgo.378.1533341222927; Fri, 03 Aug 2018 17:07:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533341222; cv=none; d=google.com; s=arc-20160816; b=W3z62GGkoPrd0lUYKkMRx2tB1Ll4/7ugWr/xpGc9MkMSBuKaCWrXJHTdWvtieFnwLb tq5J3VRyk5pdJekadg6fZWCu1x0kH0KTmIXumEV3sejipt+uQ4sUo+uMAq05CkM0lodf YG/nYVSi1j2+xRQQogMvax0QOIGnN2wCne5OxzOnjVGcpc61LZ0DOPfwjBNrMlyGzYXp 93xbipXK+blR0lYPlQBApn2O4SE3zcLsdbOkvKZDmp+s9uRFsPJEYcb9jABnnv5fNfye FTyYD59i1qpH94AzgStngUryDUjSCg7xYx8V8Uf30WE1o8qzM8TpVKpQJJo92liozZxf C5hA== 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=SaSEMJhztCx4+OzbPsdgRi8XbeXf6VD4gQdmaadiG10=; b=RbiKryhJiYEF2xPBrZ87gwMF+q8918STZrJjJUqfKgN1gW1n8SmXdSh3V0IJZT9elB PrvSCv3Fh4qFOceyc3aTK5NIKge+U6EMASWE/OpceALtE2PHZGqM2fxUbbGqumTGXcPu 0pi+ZC1NvP9ya1MmjS7jWVpV746sKSskb6oidiQtSVoOfOTjoWy1ii6lWbxLyMo/lIfa odUYb9C8ltWp82zk1vyCCGDbkSWmrwXWp0zYxoJ7vJukCk8HhGvn0+0I57fSpq67MSO/ rUyZ5++er/5xzUoeRPOGXCR0DNbbPJmeu2B/r68kMuE+qVf8jiXJwusxPSGDjxRsbvyS pIwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TYDznb1s; 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 s23-v6si6118920pga.563.2018.08.03.17.06.48; Fri, 03 Aug 2018 17:07:02 -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=TYDznb1s; 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 S1732129AbeHDCEb (ORCPT + 99 others); Fri, 3 Aug 2018 22:04:31 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:40669 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731925AbeHDCEb (ORCPT ); Fri, 3 Aug 2018 22:04:31 -0400 Received: by mail-pg1-f194.google.com with SMTP id x5-v6so3544040pgp.7 for ; Fri, 03 Aug 2018 17:06:01 -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=SaSEMJhztCx4+OzbPsdgRi8XbeXf6VD4gQdmaadiG10=; b=TYDznb1sqvK/wtRwqeI9dosgH2VTwgJQlffHAOtO4h0tyHUgtASXLZR+vO7HuB9Sow W+wfZr9M0flP+YIlOizgH39Cw3GeYQEHyTzCy6c1Oy+wsa3PLGG5Sinulxpu6h40hpLs bPDT7QggLu6+3Wr2Ufa/Um1biDNKM3s6+UwSprQW/ddOK3A5y/mHN+9Wjd10T2X8/Df7 X4oc3VXFsuw7mlwK3bunMgaMiG6qaXYcTxX/NGz6KQ++y+E2M97JhXagrXfKVhXMlzQO w2xCsUTKTIF2LI62k6a1EoKt+E//e0q27U3B7LgR9fpE59eFwwpSs/CZMazvjcNwmQOA zQPA== 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=SaSEMJhztCx4+OzbPsdgRi8XbeXf6VD4gQdmaadiG10=; b=hIirKexCpdETO0gYntgI7c1BNtCVtLsZMbfRfwf6/tPL4vYKOgN+G96r3LY00ShOah TouUkiJfrerRgJz5+aJZgHqJ+ZUuXJzfFqZplDjRiRfGzN4Jl8QXZyAqQkKDTl6u5Ldp vCkZ8I+XOXm6BJdmWhkokF/m85QUfjbUX/7bQY6IPwfNiKCy4J27Td6xXEX1GOg4OhV7 TtzgB7jJL3cmWx46oFjoeo3L2bbqlgc890PeMlGi7pSgvgEKFhJAHm6cNdGFfH2D2SBj gqj8T8sJY1aLDyh9YcnPaTxvGK2fqrClOjV3QSq2iBeFaq3jNKGNNhvQVVLtk/fAXg+h +2SQ== X-Gm-Message-State: AOUpUlF2iVinzU3jHPCUITxkqw1GX9iM2LP+xGs0YppEZRwCFMVKBNRE nZ/AAy3BSHBQDIGPv8dDwj4= X-Received: by 2002:a65:41c6:: with SMTP id b6-v6mr5638034pgq.174.1533341160960; Fri, 03 Aug 2018 17:06:00 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:80c0:93b4:a4e2:6d2f]) by smtp.gmail.com with ESMTPSA id g15-v6sm9425986pfg.98.2018.08.03.17.05.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Aug 2018 17:06:00 -0700 (PDT) From: Jia-Ju Bai To: alexander.deucher@amd.com, christian.koenig@amd.com, David1.Zhou@amd.com, airlied@linux.ie Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] gpu: drm: radeon: rs600: Replace mdelay() with msleep() and usleep_range() in rs600_asic_reset() Date: Sat, 4 Aug 2018 08:05:52 +0800 Message-Id: <20180804000552.17886-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org rs600_asic_reset() is never called in atomic context. They call mdelay() to busily wait, which is not necessary. mdelay() can be replaced with msleep() and usleep_range(). This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- drivers/gpu/drm/radeon/rs600.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index f16af119c688..1a97f5fd719b 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c @@ -472,30 +472,30 @@ int rs600_asic_reset(struct radeon_device *rdev, bool hard) pci_save_state(rdev->pdev); /* disable bus mastering */ pci_clear_master(rdev->pdev); - mdelay(1); + usleep_range(1000, 2000); /* reset GA+VAP */ WREG32(R_0000F0_RBBM_SOFT_RESET, S_0000F0_SOFT_RESET_VAP(1) | S_0000F0_SOFT_RESET_GA(1)); RREG32(R_0000F0_RBBM_SOFT_RESET); - mdelay(500); + msleep(500); WREG32(R_0000F0_RBBM_SOFT_RESET, 0); - mdelay(1); + usleep_range(1000, 2000); status = RREG32(R_000E40_RBBM_STATUS); dev_info(rdev->dev, "(%s:%d) RBBM_STATUS=0x%08X\n", __func__, __LINE__, status); /* reset CP */ WREG32(R_0000F0_RBBM_SOFT_RESET, S_0000F0_SOFT_RESET_CP(1)); RREG32(R_0000F0_RBBM_SOFT_RESET); - mdelay(500); + msleep(500); WREG32(R_0000F0_RBBM_SOFT_RESET, 0); - mdelay(1); + usleep_range(1000, 2000); status = RREG32(R_000E40_RBBM_STATUS); dev_info(rdev->dev, "(%s:%d) RBBM_STATUS=0x%08X\n", __func__, __LINE__, status); /* reset MC */ WREG32(R_0000F0_RBBM_SOFT_RESET, S_0000F0_SOFT_RESET_MC(1)); RREG32(R_0000F0_RBBM_SOFT_RESET); - mdelay(500); + msleep(500); WREG32(R_0000F0_RBBM_SOFT_RESET, 0); - mdelay(1); + usleep_range(1000, 2000); status = RREG32(R_000E40_RBBM_STATUS); dev_info(rdev->dev, "(%s:%d) RBBM_STATUS=0x%08X\n", __func__, __LINE__, status); /* restore PCI & busmastering */ -- 2.17.0