From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89EA7C433F5 for ; Mon, 27 Sep 2021 17:33:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 67D9360E08 for ; Mon, 27 Sep 2021 17:33:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236202AbhI0Rfb (ORCPT ); Mon, 27 Sep 2021 13:35:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:43744 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236088AbhI0RaJ (ORCPT ); Mon, 27 Sep 2021 13:30:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7475C61527; Mon, 27 Sep 2021 17:18:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632763089; bh=U595uBJGQBwncERun0OReAfOMr+OX6JYE3VtFMuFF1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H9MZB6TVCkGnutTXg/2XGWDwLGABJusSfzvxWBh6oheRjIs3zPJhiqnL7uOFkpFyF Z3o80xM2EQLbRz/JujdcXz8mdyurwXvz6EdzMLAgMTdTwt9/CaAGBhwNPqyfuAgV44 JL+tVkNzIDeKUqb8zTxJcQ+tu8eK2blp1qi374QI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Torvalds , Huang Rui , =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher , David Airlie , Daniel Vetter , Guenter Roeck , Sasha Levin Subject: [PATCH 5.14 131/162] drm/ttm: fix type mismatch error on sparc64 Date: Mon, 27 Sep 2021 19:02:57 +0200 Message-Id: <20210927170237.959413851@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210927170233.453060397@linuxfoundation.org> References: <20210927170233.453060397@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Huang Rui [ Upstream commit 3ca706c189db861b2ca2019a0901b94050ca49d8 ] On sparc64, __fls() returns an "int", but the drm TTM code expected it to be "unsigned long" as on x86. As a result, on sparc (and arc, and m68k) you get build errors because 'min()' checks that the types match. As suggested by Linus, it can use min_t instead of min to force the type to be "unsigned int". Suggested-by: Linus Torvalds Signed-off-by: Huang Rui Reviewed-by: Christian König Cc: Alex Deucher Cc: David Airlie Cc: Daniel Vetter Cc: Guenter Roeck Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- drivers/gpu/drm/ttm/ttm_pool.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c index cb38b1a17b09..82cbb29a05aa 100644 --- a/drivers/gpu/drm/ttm/ttm_pool.c +++ b/drivers/gpu/drm/ttm/ttm_pool.c @@ -383,7 +383,8 @@ int ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt, else gfp_flags |= GFP_HIGHUSER; - for (order = min(MAX_ORDER - 1UL, __fls(num_pages)); num_pages; + for (order = min_t(unsigned int, MAX_ORDER - 1, __fls(num_pages)); + num_pages; order = min_t(unsigned int, order, __fls(num_pages))) { bool apply_caching = false; struct ttm_pool_type *pt; -- 2.33.0