Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp237978pxb; Wed, 18 Nov 2020 03:17:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzp2rsQ1zgElEvzmcupiDlQPit98GAHqJLnpdqotmmVQjzMpnw0kUJgCO764em6/hES3Ucr X-Received: by 2002:a17:906:7aca:: with SMTP id k10mr22739748ejo.215.1605698253924; Wed, 18 Nov 2020 03:17:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605698253; cv=none; d=google.com; s=arc-20160816; b=D5I4xBrg25RiQBSiBemO/gKCHYVPujdwCUCOtg6Wfqwm3sf837Yx/yN/mTQZMXVDkw FUfwd2AHKynSE5My/g5Mlu/UlfFroCftnpSLbUUCo4G7dZBn+VpZhELMKIH6OQY2arlf 5xrDzYMg0sgMje2RI0Y2sh1dzclrrw/65Kn3mRVKXpF75nGzD1s4+s8OQJeWo4ekNOiw hHhBiaj+ogaOly/4D+xG5CtMpp/K5/W1AzydrnqZi4PDLjlEM/xLvS9U95rCPOhIdTLs B0nRE+jbilDvh1BGdvV53Ip1kTFaLD7AwYJAnSqJTg0SD73p92D6oIutIO6LSP8FQPG+ qBlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=OP6blAz5+JIX7tH4ktR5haqQrKT7znYzdmUpUtGM9M0=; b=QmEGwPzhFAHHBV9RJ29MrRka5m/UJsDiwF0IiMkL29HRDoXU0X6jzAK3Ql4DB2lY5F 2bkxQ/PN86wL4ncR7mDDDLKYRfMvs8dgTIts5KwrYB5yt/NlzNOWZLvlxOzGnDu9SMgM YlFycbZ+iS9Oqnml9RBSCWmZokt5ypZbrYXRWnD6qwDocaEUssh/+lpOf8DK0w/FJ1fP tdzl5iiOtSiAa3G9Z+rOJBMFnpyGk0xE2uTse1nvac4S4U9bNH5dCvOKqZ7ITJ5Ipj9i 4msKQl5Zww2yy8TkckYs+lS+fvNJq7UnvE0UXBBPsXAo8UqG5MfL/CEC7sRvrXvsDlgK uvzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vivo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bx4si15791804edb.505.2020.11.18.03.17.11; Wed, 18 Nov 2020 03:17:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726281AbgKRLNj (ORCPT + 99 others); Wed, 18 Nov 2020 06:13:39 -0500 Received: from m17618.mail.qiye.163.com ([59.111.176.18]:31969 "EHLO m17618.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725781AbgKRLNj (ORCPT ); Wed, 18 Nov 2020 06:13:39 -0500 Received: from ubuntu.localdomain (unknown [157.0.31.124]) by m17618.mail.qiye.163.com (Hmail) with ESMTPA id 276954E1771; Wed, 18 Nov 2020 19:13:34 +0800 (CST) From: Bernard Zhao To: VMware Graphics , Roland Scheidegger , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Bernard Zhao Subject: [PATCH] drm/vmwgfx: use min_t to replace min Date: Wed, 18 Nov 2020 03:13:27 -0800 Message-Id: <20201118111327.105071-1-bernard@vivo.com> X-Mailer: git-send-email 2.29.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZS1VLWVdZKFlBSE83V1ktWUFJV1kPCR oVCBIfWUFZQ0tMHk0dQx5CQhhNVkpNS05NQkNLSk9PT0tVEwETFhoSFyQUDg9ZV1kWGg8SFR0UWU FZT0tIVUpKS09ISFVLWQY+ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6Phg6MSo5Tz8tLw4vPxMYVh4O PzIaFC9VSlVKTUtOTUJDS0pOS0tLVTMWGhIXVRkeCRUaCR87DRINFFUYFBZFWVdZEgtZQVlKTkxV S1VISlVKSU9ZV1kIAVlBSUtDSjcG X-HM-Tid: 0a75db0f4c5b9376kuws276954e1771 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use min_t to replace min, min_t is a bit fast because min use twice typeof. This patch also fix check_patch.pl warning: WARNING: min() should probably be min_t(unsigned long, num_pages, VMW_PPN_PER_REMAP) +unsigned long nr = min(num_pages, (unsigned long) VMW_PPN_PER_REMAP); Signed-off-by: Bernard Zhao --- drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c b/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c index 83c0d5a3e4fd..b8f6fe1a71e6 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c @@ -72,7 +72,7 @@ static int vmw_gmr2_bind(struct vmw_private *dev_priv, SVGA_REMAP_GMR2_PPN64 : SVGA_REMAP_GMR2_PPN32; while (num_pages > 0) { - unsigned long nr = min(num_pages, (unsigned long)VMW_PPN_PER_REMAP); + unsigned long nr = min_t((unsigned long), num_pages, VMW_PPN_PER_REMAP); remap_cmd.offsetPages = remap_pos; remap_cmd.numPages = nr; -- 2.29.0