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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 44F21CCD1A2 for ; Fri, 17 Oct 2025 09:07:54 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4cnzVw5gQBz3cYG; Fri, 17 Oct 2025 20:07:52 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=35.83.148.184 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1760692072; cv=none; b=QrzGOeY6V3+k3oKHtj8rXcPIQXpR002GFR4pATkuwPYdLg4qbZImD2Bbf8wkihoY51HjmrQF/4L3GxmsIc8+qLImayUCzAp+PYwsA3iah/Ii/itth57xgh4BDjRbdwf+LV0WvLXmlq/I9fYNrcrhrhL++PkJ5/lKxfDZtCKjIFDXWgePXCVfnTfOF9ThLFmFNxX5P14zGnkvQGqyLEfMzVttR3+NYqhSSPIQGJsX4yN3SI3hQJ9av6PvRUHEdIhRH6osf/AOs4hz2dGogWituDXV8tZrVbdROr9ZiVqjBrofZHrJLTPV++sngTW/NY8gPbgZj/BGX9Ge2VtwYbX1hQ== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1760692072; c=relaxed/relaxed; bh=Axggb3gQ9gMod1E1Yl366ABHVZrqad4JWTadzq2JQtY=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BNuE4JN1Pgf8Ek1sUvL0kfoNkiJerCQZB+RXvAY0TSjoDyfUHoytn64Orde3ZMUgv7Aiuf8J2x/2wy/6Ye9hWUJlhK/8DBzdH1VFMgIy647gw5lj6ShocKgq7NL5bUWwQQAbA8mmYtLu8VZqN41b0xcN2aaz7xtFaGR413fEFM/1r2hUg9WD+BKZG17frxsCYB3gF8nwhY0cCJW9MtuVxZw0dBvmMAGCVXP91x34uH/utgMUqAqgSGB80MtnGNB7YvnvOW2nPGHLpoCAuOVIcKeM36GiUIDYkkj5b9OOTwDS4fwxEfleZeiQsPhx3b/78qynm119dgdZRrCDbTfUIA== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; dkim=pass (2048-bit key; unprotected) header.d=amazon.com header.i=@amazon.com header.a=rsa-sha256 header.s=amazoncorp2 header.b=L/i5KZtu; dkim-atps=neutral; spf=pass (client-ip=35.83.148.184; helo=pdx-out-014.esa.us-west-2.outbound.mail-perimeter.amazon.com; envelope-from=prvs=378230090=farbere@amazon.com; receiver=lists.ozlabs.org) smtp.mailfrom=amazon.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=amazon.com header.i=@amazon.com header.a=rsa-sha256 header.s=amazoncorp2 header.b=L/i5KZtu; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=amazon.com (client-ip=35.83.148.184; helo=pdx-out-014.esa.us-west-2.outbound.mail-perimeter.amazon.com; envelope-from=prvs=378230090=farbere@amazon.com; receiver=lists.ozlabs.org) Received: from pdx-out-014.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-014.esa.us-west-2.outbound.mail-perimeter.amazon.com [35.83.148.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4cnzVv6cz0z2xcB for ; Fri, 17 Oct 2025 20:07:51 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1760692072; x=1792228072; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=Axggb3gQ9gMod1E1Yl366ABHVZrqad4JWTadzq2JQtY=; b=L/i5KZtuJRYtJEtD7fr5sDkaYcH9WbYRdPnReCiWiuaN9G+7oUa7fGKb gtXcwgbOpS5sNCCJc8Y2152+/FZ4SRxzLpbKfsRdCfUjaFOlq3rcUVux8 Guz95IqfkUCSvJh8C5yKAk4EVJG8c/FOj1TM7yCkrLcNZMI5YSrQyxKu+ XOxPf3vUAhvVZiwCgFAx1nggDNXJDbV944KsErQRw4dbhOMxl5EPOh83b ZeQfiPEMd1+pWmLlkximNXylM34C6j6WDOhhMfmysZqV8M6ZjcU1x9voC SGqFQaHq++NDISvmirv+0PFzrVmlUhQ26oEDI8DmKrRWX9qxmP73u9ivf g==; X-CSE-ConnectionGUID: plDg+TL0RJuYnIuIvzyxwg== X-CSE-MsgGUID: 8TFf8viySyudMMaCnxenXg== X-IronPort-AV: E=Sophos;i="6.19,236,1754956800"; d="scan'208";a="4872727" 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-014.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 d86868d2-96ac-429e-9410-ceea5e8bf28e; Fri, 17 Oct 2025 09:07:48 +0000 (UTC) X-Farcaster-Flow-ID: d86868d2-96ac-429e-9410-ceea5e8bf28e 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> X-Mailing-List: linux-erofs@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.19.116.181] X-ClientProxiedBy: EX19D044UWB002.ant.amazon.com (10.13.139.188) To EX19D001UWA001.ant.amazon.com (10.13.138.214) 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 +#include #include #include @@ -151,27 +152,6 @@ */ #define max_t(type, x, y) __careful_cmp((type)(x), (type)(y), >) -/* - * Remove a const qualifier from integer types - * _Generic(foo, type-name: association, ..., default: association) performs 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 pointer, @@ -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 order + * typeof() keeps the const qualifier. Use __unqual_scalar_typeof() in order * to discard the const qualifier for the __element variable. */ #define __minmax_array(op, array, len) ({ \ typeof(&(array)[0]) __array = (array); \ typeof(len) __len = (len); \ - __unconst_integer_typeof(__array[0]) __element = __array[--__len]; \ + __unqual_scalar_typeof(__array[0]) __element = __array[--__len];\ while (__len--) \ __element = op(__element, __array[__len]); \ __element; }) -- 2.47.3