From nobody Sun Feb 8 02:34:56 2026 Received: from pdx-out-007.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-007.esa.us-west-2.outbound.mail-perimeter.amazon.com [52.34.181.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C99B42D979B; Fri, 17 Oct 2025 09:07:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=52.34.181.151 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760692073; cv=none; b=VBm+1zNvTC+HqHqfjfuiOKeC3t6rwWIyxpYSVwAbmJD6ekWXfQstHCsUIhqrYeIp+RRLMKEkkfDp0RWsGB+HPpYnsZENhuBkoQTzRsX0lGACKO0XKyv01ueVgvKvTYHz/l8CQhinWEH0vD3H+IlXXCnA1GSqtQCGMD8av5pe9UQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760692073; c=relaxed/simple; bh=nf038t2TN/ovKGoldR3+YYFqmXFXalZNj9+zBEhOEHc=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MA0juxyaq6aCNC6KSMV0YcqHufTaxXQKuK65IWPCJTZ3zcfXsgJW+EciJXXJ1ORJeEb7TnGS7jYu1kVA03XSYDINyCubbOqM3NIoJo6cyZFa3cCcVQVc9isVZBuGXq7NXRgHB+QvdHSf0lQcCYqMQ/ELlaAapG2zHb+Ho6tMmnw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.com; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b=Ace7whsq; arc=none smtp.client-ip=52.34.181.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b="Ace7whsq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1760692071; x=1792228071; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=Axggb3gQ9gMod1E1Yl366ABHVZrqad4JWTadzq2JQtY=; b=Ace7whsqyRPitkXJlxv3UsuquuG3XhxQL/3m/bLlRWV7IysSURj7tWe0 ZDeffQvNaeHI2eVwzPtCpYJsPqZADGqE6fh00/SzbX3Z2NZLmBqWGRtwA sC4JDIW7Lbx6oiI/KlRP07q7yqQfQLfflHpcIiW4HfngXZOC+zN4YPZAG CH1McvxWnsEHG+TmTSzfoFVsanOLbcmAoLJVKfJfApq+oYu7L6vDEJijs rXwpZk0uyMuJvAYeAMgIZRttP7DnV6MIBtoEsVz+hi0VadYawCFVSb5iN E+w520oArxuSa03lCV9mlLwWO1ThsvqG6oQfDg/uQzzko9CFg2e04z4Ng Q==; X-CSE-ConnectionGUID: KhdS/BHxQO6GfnkB7Y5SdA== X-CSE-MsgGUID: lUTObcljTvugkRhBtO1Rag== X-IronPort-AV: E=Sophos;i="6.18,263,1751241600"; d="scan'208";a="5073215" Received: from ip-10-5-12-219.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.12.219]) by internal-pdx-out-007.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2025 09:07:49 +0000 Received: from EX19MTAUWC002.ant.amazon.com [205.251.233.51:5394] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.11.52:2525] with esmtp (Farcaster) id 6f0c35a7-7288-49ab-a83f-0cddef51b437; Fri, 17 Oct 2025 09:07:48 +0000 (UTC) X-Farcaster-Flow-ID: 6f0c35a7-7288-49ab-a83f-0cddef51b437 Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWC002.ant.amazon.com (10.250.64.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.20; Fri, 17 Oct 2025 09:07:45 +0000 Received: from dev-dsk-farbere-1a-46ecabed.eu-west-1.amazon.com (172.19.116.181) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.20; Fri, 17 Oct 2025 09:07:31 +0000 From: Eliav Farber To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 07/27 5.10.y] minmax: deduplicate __unconst_integer_typeof() Date: Fri, 17 Oct 2025 09:04:59 +0000 Message-ID: <20251017090519.46992-8-farbere@amazon.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251017090519.46992-1-farbere@amazon.com> References: <20251017090519.46992-1-farbere@amazon.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: EX19D044UWB002.ant.amazon.com (10.13.139.188) To EX19D001UWA001.ant.amazon.com (10.13.138.214) Content-Type: text/plain; charset="utf-8" From: Andy Shevchenko [ Upstream commit 5e57418a2031cd5e1863efdf3d7447a16a368172 ] It appears that compiler_types.h already have an implementation of the __unconst_integer_typeof() called __unqual_scalar_typeof(). Use it instead of the copy. Link: https://lkml.kernel.org/r/20230911154913.4176033-1-andriy.shevchenko@= linux.intel.com Signed-off-by: Andy Shevchenko Acked-by: Herve Codina Signed-off-by: Andrew Morton Signed-off-by: Eliav Farber --- include/linux/minmax.h | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/include/linux/minmax.h b/include/linux/minmax.h index 0e89c78810f6..c813c1187510 100644 --- a/include/linux/minmax.h +++ b/include/linux/minmax.h @@ -2,6 +2,7 @@ #ifndef _LINUX_MINMAX_H #define _LINUX_MINMAX_H =20 +#include #include #include =20 @@ -151,27 +152,6 @@ */ #define max_t(type, x, y) __careful_cmp((type)(x), (type)(y), >) =20 -/* - * Remove a const qualifier from integer types - * _Generic(foo, type-name: association, ..., default: association) perfor= ms a - * comparison against the foo type (not the qualified type). - * Do not use the const keyword in the type-name as it will not match the - * unqualified type of foo. - */ -#define __unconst_integer_type_cases(type) \ - unsigned type: (unsigned type)0, \ - signed type: (signed type)0 - -#define __unconst_integer_typeof(x) typeof( \ - _Generic((x), \ - char: (char)0, \ - __unconst_integer_type_cases(char), \ - __unconst_integer_type_cases(short), \ - __unconst_integer_type_cases(int), \ - __unconst_integer_type_cases(long), \ - __unconst_integer_type_cases(long long), \ - default: (x))) - /* * Do not check the array parameter using __must_be_array(). * In the following legit use-case where the "array" passed is a simple po= inter, @@ -186,13 +166,13 @@ * 'int *buff' and 'int buff[N]' types. * * The array can be an array of const items. - * typeof() keeps the const qualifier. Use __unconst_integer_typeof() in o= rder + * typeof() keeps the const qualifier. Use __unqual_scalar_typeof() in ord= er * to discard the const qualifier for the __element variable. */ #define __minmax_array(op, array, len) ({ \ typeof(&(array)[0]) __array =3D (array); \ typeof(len) __len =3D (len); \ - __unconst_integer_typeof(__array[0]) __element =3D __array[--__len]; \ + __unqual_scalar_typeof(__array[0]) __element =3D __array[--__len];\ while (__len--) \ __element =3D op(__element, __array[__len]); \ __element; }) --=20 2.47.3