From patchwork Mon Nov 18 19:11:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Laight X-Patchwork-Id: 13878983 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2ABF5D591AD for ; Mon, 18 Nov 2024 19:11:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B3A766B008A; Mon, 18 Nov 2024 14:11:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AEA736B008C; Mon, 18 Nov 2024 14:11:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 98A696B0093; Mon, 18 Nov 2024 14:11:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 73F2C6B008A for ; Mon, 18 Nov 2024 14:11:33 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 025E7A04A6 for ; Mon, 18 Nov 2024 19:11:32 +0000 (UTC) X-FDA: 82800157398.08.DE1AA14 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by imf01.hostedemail.com (Postfix) with ESMTP id 3571740007 for ; Mon, 18 Nov 2024 19:10:52 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=aculab.com; spf=pass (imf01.hostedemail.com: domain of david.laight@aculab.com designates 185.58.86.151 as permitted sender) smtp.mailfrom=david.laight@aculab.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731956908; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z33N7mgF2KOq9AaIi5l929I/cDq7Ura0ZVwAuZiFio8=; b=4U3gfOWwIeuR468ZFcMd7GgSrIZnhjZaQMPnukcH26N/9Q2QnMcrhJ+0X1iWM6MwaA2gKD L8yehkK4en+zuUVvc3EhaP2ubnq4cfzy/nnnyKowqZz+CKY1rMAkqBCeUVVhETy+bDlGPA tJ5schyLC6c2SHwzlKXxcqSeijmm9xY= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=aculab.com; spf=pass (imf01.hostedemail.com: domain of david.laight@aculab.com designates 185.58.86.151 as permitted sender) smtp.mailfrom=david.laight@aculab.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731956908; a=rsa-sha256; cv=none; b=NoZ3gPAqLfrB/KydEkLUinHi5Kxxl4tz66ZCggXGCp08bNpmgK+YRVgFHCRmPj2hf5FbQc RIkGH06RrzhLV+/jvFuhN2azTeMjuukfV2qzHHIWSMpSugdliu0OPalWV8aimP8Itekcv0 0yZhFZzBx3D9HtEBAZeUIF6SIAzMcKY= Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-13-pwgGBRruNOqD6Np7u3lSnQ-1; Mon, 18 Nov 2024 19:11:25 +0000 X-MC-Unique: pwgGBRruNOqD6Np7u3lSnQ-1 X-Mimecast-MFC-AGG-ID: pwgGBRruNOqD6Np7u3lSnQ Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Mon, 18 Nov 2024 19:11:24 +0000 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Mon, 18 Nov 2024 19:11:24 +0000 From: David Laight To: Linus Torvalds CC: 'Arnd Bergmann' , "'linux-kernel@vger.kernel.org'" , 'Jens Axboe' , "'Matthew Wilcox'" , 'Christoph Hellwig' , 'Andrew Morton' , 'Andy Shevchenko' , 'Dan Carpenter' , "'Jason A . Donenfeld'" , "'pedro.falcato@gmail.com'" , 'Mateusz Guzik' , "'linux-mm@kvack.org'" , "'Lorenzo Stoakes'" Subject: [PATCH next 1/7] minmax.h: Add whitespace around operators and after commas Thread-Topic: [PATCH next 1/7] minmax.h: Add whitespace around operators and after commas Thread-Index: Ads57aZG7lyHiUjzR+iewqg1n0YFUQ== Date: Mon, 18 Nov 2024 19:11:24 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: fgKjrjAVkrkyhQVmcNFeJMuIstvGMNSGRy8ef11FnPY_1731957084 X-Mimecast-Originator: aculab.com Content-Language: en-US X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 3571740007 X-Stat-Signature: qy9r9b7ixkmjoqfpgue4fbjrdy8tm3sj X-Rspam-User: X-HE-Tag: 1731957052-545690 X-HE-Meta: U2FsdGVkX19Lcsjyk6DHMlDDvgN3EkaN3Mp1mm/CbXX8e74ITqoVrnizqLUbwU6lmdg8cyyLH5OfvotkzdjxRo57pW5pF0yoarHQBuxQVLJC7FANLMvG5Rdtlq7zuBdSVCIMDY/o3ep+JvwvkNnR/VVK9ofZF4z6JMlyNPa53PsOQAp7IVSa6OF6XEE6mSFYaGzhZujH8Am8SuloiKlNHS6LOWk925xP5vrfp+wuvUqK847cwVxjW1KnmqmcnbimbGFC1h7qgR3t1jIADqG9/8TySSSte9hMpvpw/oVmFDzwfd1vB0XyDAbVrs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As/Fyogzd1lSd8kYTNJw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Signed-off-by: David Laight --- include/linux/minmax.h | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/include/linux/minmax.h b/include/linux/minmax.h index 98008dd92153..51b0d988e322 100644 --- a/include/linux/minmax.h +++ b/include/linux/minmax.h @@ -51,10 +51,10 @@ * only need to be careful to not cause warnings for * pointer use. */ -#define __signed_type_use(x,ux) (2+__is_nonneg(x,ux)) -#define __unsigned_type_use(x,ux) (1+2*(sizeof(ux)<4)) -#define __sign_use(x,ux) (is_signed_type(typeof(ux))? \ - __signed_type_use(x,ux):__unsigned_type_use(x,ux)) +#define __signed_type_use(x, ux) (2 + __is_nonneg(x, ux)) +#define __unsigned_type_use(x, ux) (1 + 2 * (sizeof(ux) < 4)) +#define __sign_use(x, ux) (is_signed_type(typeof(ux)) ? \ + __signed_type_use(x, ux) : __unsigned_type_use(x, ux)) /* * To avoid warnings about casting pointers to integers @@ -74,15 +74,15 @@ #ifdef CONFIG_64BIT #define __signed_type(ux) long #else - #define __signed_type(ux) typeof(__builtin_choose_expr(sizeof(ux)>4,1LL,1L)) + #define __signed_type(ux) typeof(__builtin_choose_expr(sizeof(ux) > 4, 1LL, 1L)) #endif -#define __is_nonneg(x,ux) statically_true((__signed_type(ux))(x)>=0) +#define __is_nonneg(x, ux) statically_true((__signed_type(ux))(x) >= 0) -#define __types_ok(x,y,ux,uy) \ - (__sign_use(x,ux) & __sign_use(y,uy)) +#define __types_ok(x, y, ux, uy) \ + (__sign_use(x, ux) & __sign_use(y, uy)) -#define __types_ok3(x,y,z,ux,uy,uz) \ - (__sign_use(x,ux) & __sign_use(y,uy) & __sign_use(z,uz)) +#define __types_ok3(x, y, z, ux, uy, uz) \ + (__sign_use(x, ux) & __sign_use(y, uy) & __sign_use(z, uz)) #define __cmp_op_min < #define __cmp_op_max > @@ -97,7 +97,7 @@ #define __careful_cmp_once(op, x, y, ux, uy) ({ \ __auto_type ux = (x); __auto_type uy = (y); \ - BUILD_BUG_ON_MSG(!__types_ok(x,y,ux,uy), \ + BUILD_BUG_ON_MSG(!__types_ok(x, y, ux, uy), \ #op"("#x", "#y") signedness error"); \ __cmp(op, ux, uy); }) @@ -114,7 +114,7 @@ static_assert(__builtin_choose_expr(__is_constexpr((lo) > (hi)), \ (lo) <= (hi), true), \ "clamp() low limit " #lo " greater than high limit " #hi); \ - BUILD_BUG_ON_MSG(!__types_ok3(val,lo,hi,uval,ulo,uhi), \ + BUILD_BUG_ON_MSG(!__types_ok3(val, lo, hi, uval, ulo, uhi), \ "clamp("#val", "#lo", "#hi") signedness error"); \ __clamp(uval, ulo, uhi); }) @@ -154,7 +154,7 @@ #define __careful_op3(op, x, y, z, ux, uy, uz) ({ \ __auto_type ux = (x); __auto_type uy = (y);__auto_type uz = (z);\ - BUILD_BUG_ON_MSG(!__types_ok3(x,y,z,ux,uy,uz), \ + BUILD_BUG_ON_MSG(!__types_ok3(x, y, z, ux, uy, uz), \ #op"3("#x", "#y", "#z") signedness error"); \ __cmp(op, ux, __cmp(op, uy, uz)); }) @@ -326,9 +326,9 @@ static inline bool in_range32(u32 val, u32 start, u32 len) * Use these carefully: no type checking, and uses the arguments * multiple times. Use for obvious constants only. */ -#define MIN(a,b) __cmp(min,a,b) -#define MAX(a,b) __cmp(max,a,b) -#define MIN_T(type,a,b) __cmp(min,(type)(a),(type)(b)) -#define MAX_T(type,a,b) __cmp(max,(type)(a),(type)(b)) +#define MIN(a, b) __cmp(min, a, b) +#define MAX(a, b) __cmp(max, a, b) +#define MIN_T(type, a, b) __cmp(min, (type)(a), (type)(b)) +#define MAX_T(type, a, b) __cmp(max, (type)(a), (type)(b)) #endif /* _LINUX_MINMAX_H */