Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1055906imm; Fri, 3 Aug 2018 17:19:50 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdXohvOODCXLpqeg2RH9GaP7+P0lKjIp5V1YxfydrQh8RHTcHbIhafRcktxVP2qS92EBazs X-Received: by 2002:a63:6002:: with SMTP id u2-v6mr5669313pgb.433.1533341990857; Fri, 03 Aug 2018 17:19:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533341990; cv=none; d=google.com; s=arc-20160816; b=duPeT539T6/F1GRw+LXsgM0lkGbNBVrHBttu+2NMuvo1qU4MQxETu026m5KowZn2x7 4LPsUfARqK2dLBdDFJQUnrfKe0zlEqr6WDLCLeZvkBU0Rpeu7ow/L4UqnqdvyuoEda9B ZpI6SimdV2YqMSVOkBpBbUU2tCqG9xgE3D8p0q1aAAvgP2uQbCZY25D8Tqwk/l/IDEwi 0begmmp3/lMrn+W1fh4dvPwZ2qYVmRRStpUbmJVLyoX6S6o37GdcFyVod8MqNQjKoQZV 7dZXgdkrV++wCQAPKzoxSgNoUpE50B+xtl0CzcUNrnLme0y8AFGXdVtvikNwlscYYGVN Ghlw== 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=ZukhOIu0CUod2Wi4pWyIZv0ruQ09mhO1Pq4jRI44TKM=; b=rAg1myzrSIFPDF/chyNYMzs3OvP2i56xTaiU2wAKjZIQGWX2V+A13Se0EMrlqtqjfC lKfssMynLw8i47pCuVSM4i+eMt7cAYRWgXv9zlobGkvRUEZrSaxbiY+D2gEf3iz1EKo+ /nrX/129w06meHaqidAVotY2f2PTbcF3djFuh4mucVBMPw4hucONKivtkjdswbXKqKjO Dvt2tbNTNYJ8xD5JIWTqxXMMyuE7w7yfLK/wB0obt22H0VjXPzAtV+roYqPBYjsAvWkG PJU1VBQ/VaPGB2JjsSSumXa7prKWgG+XmwoMZyXJscUVylmASIEl0FFzlzCSfX0MqApP I1lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SjcpegYa; 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 u184-v6si5515294pgd.31.2018.08.03.17.19.35; Fri, 03 Aug 2018 17:19:50 -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=SjcpegYa; 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 S1732049AbeHDCRU (ORCPT + 99 others); Fri, 3 Aug 2018 22:17:20 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:35380 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728173AbeHDCRU (ORCPT ); Fri, 3 Aug 2018 22:17:20 -0400 Received: by mail-pl0-f67.google.com with SMTP id w3-v6so3233323plq.2 for ; Fri, 03 Aug 2018 17:18:48 -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=ZukhOIu0CUod2Wi4pWyIZv0ruQ09mhO1Pq4jRI44TKM=; b=SjcpegYaUU5vEiVQPTfq0KOudd4sn3K+eqbl6BsmquRoX2a0D4u5NLX70fCKV1tv2+ 0/os8twjRmGvO1mAweRgXgjyed7Taq6WY9emzH5f7nO4sMmv8zbb8ZU8nDO6/Cp5a2VN 2+8ZpwG468PYg3s9gP5sh5o+E98FcsAkkD2hcv2u7Lq591VVFZELL6GGx3nYMNNp0M3J bMvxhdPeY21sHSVS+EWxfVExEmSIAPz+pzihoPry4Q24FXmRbfjy1gbH+IwW5hIgTNx3 aVZwL5/mJ8mZ6nTip8ZDQ3G9gIZq+g7mmVDnZMxZ/Wru3M7CoZ8wkh7tvGCOpRWbJabc f4Fg== 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=ZukhOIu0CUod2Wi4pWyIZv0ruQ09mhO1Pq4jRI44TKM=; b=biGX9Axzfw3Fe7MW/Bb4SS5h+17M25yNmI1YAAtGpsYbR54+Ydjq5QMKb9b5XqlS/3 Yp6RZLZZ/+E7vL7NnDGs/0K5u4zWcCrKb78xA7ZdLEd8XipiaqnrfnagMDcIZtS6At89 X6kSE61FN1LzQxt0dCDw/KLtK9CvnXMz7YXaBFG2TdclIt+VCfDoQK+0tHfL3NTIziY3 M+A7fopZ1sP2g7KeIeq0cVmi08kGs0PC2PDfq4xkBhY2keM3Q/+WmLJ/wEJMky1niz6R 8eMS1gTH3AX12j7sXCvdk04aM8rVTsv8Q7Qe6O1QdCoeix6OrctlsW1Hi99b++pfAy58 U6wQ== X-Gm-Message-State: AOUpUlGas59n0X8C4VlANgkQmaAW3d3jWiUPuSE6dTCw+vOl/wf2zFN2 V1GYuT/ea9N8Fo/yuWP0HYE= X-Received: by 2002:a17:902:7009:: with SMTP id y9-v6mr5545179plk.249.1533341928638; Fri, 03 Aug 2018 17:18:48 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:80c0:93b4:a4e2:6d2f]) by smtp.gmail.com with ESMTPSA id k1-v6sm5944812pfi.62.2018.08.03.17.18.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Aug 2018 17:18:48 -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: r100: Replace mdelay() with msleep() and usleep_range() in r100_asic_reset() Date: Sat, 4 Aug 2018 08:18:40 +0800 Message-Id: <20180804001840.18105-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 r100_asic_reset() is never called in atomic context. It calls 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/r100.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 7d39ed63e5be..09c418113d9a 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c @@ -2576,17 +2576,17 @@ int r100_asic_reset(struct radeon_device *rdev, bool hard) S_0000F0_SOFT_RESET_PP(1) | S_0000F0_SOFT_RESET_RB(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); /* restore PCI & busmastering */ -- 2.17.0