Received: by 2002:ac8:6d01:0:b0:423:7e07:f8e4 with SMTP id o1csp6903498qtt; Mon, 18 Dec 2023 09:50:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDMhFlw897F/86j8eED+cLJAijl37T4Ecf60GU4iWBDFzyot9tiNOiiKdbKSz6aL5Gdr03 X-Received: by 2002:a05:622a:4ce:b0:423:8b3d:dd27 with SMTP id q14-20020a05622a04ce00b004238b3ddd27mr16768494qtx.10.1702921835187; Mon, 18 Dec 2023 09:50:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702921835; cv=none; d=google.com; s=arc-20160816; b=X01WEmPmyXGSKlqWjI0mAEQtjR8aCYUhlckfMMuVwPUmKBcj64/KJS9dtHs4ZbFku/ 0JW60PHo8nFQUSQKOJ1brYuwY5bDHgTOAYzYQbjAvflsCIJAha5YdRuJkPETKTEkJPcg e6nAuhGpLb44YmSrAT6Ajsb2hKWX2b0uVWmMGy1C1WTgz59WmOyHYOjxiMvmIMFM5psn 48ON1DgHX2BV2YSkvnLVDLxLjiyA8nq2nQ4A05MyBaVr/Mt/DJfFyDZDc3idAdGrsPco eKzueEQYtwaGGmYlkLJM7WfmvaCLmDO16q9p6VSQGLa2wO5I47AFYmW6BetDr5TbjGYt fCXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:feedback-id:references :in-reply-to:message-id:subject:cc:from:to:date:dkim-signature; bh=l74qLactwzIVrq/B9kOv8F974+1rgtU+2NAFHFv2u0Q=; fh=CsWGf/Awp6f0EAdsmy2FNMWdLtyOQt3rLrP7qNIXUTE=; b=iCXAMUekCck7vzk+xquCFvgitqWYyZEAR1i4LSHDUX89gGj3P4M6Jf9ttXcJorC3qW TDBCguKpEL3UOu+3aInN3d4njHZlxVUjuCw++cCGT6I6jAbWBTwrgqK21itIPZ8DZyC7 oTgEXzF946kPtxG90PhOsj7/CnO2FeVCpz5cCcew46SblWMGUU+AVn057cNcigDFkwRh jHnOUlWjkRfaoXdIR/+yn1qGX3Dh72a2LfkfVRsUkAE15DKpvaMDxV7pETlXVTqDRfhS xTflqshXnommmJJndYgzwiqIeYY7a0hpHYRYiqzFld8lMZ29gfN4p9+PAZr7y8WH7SkT EZgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@proton.me header.s=protonmail header.b=PrBOoSbt; spf=pass (google.com: domain of linux-kernel+bounces-4211-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4211-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v21-20020ac87495000000b004236dba99a9si22973221qtq.11.2023.12.18.09.50.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 09:50:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4211-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@proton.me header.s=protonmail header.b=PrBOoSbt; spf=pass (google.com: domain of linux-kernel+bounces-4211-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4211-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0C0A01C25BB3 for ; Mon, 18 Dec 2023 17:50:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 688EF740B2; Mon, 18 Dec 2023 17:46:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=proton.me header.i=@proton.me header.b="PrBOoSbt" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-4322.protonmail.ch (mail-4322.protonmail.ch [185.70.43.22]) (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 413CA5D75F; Mon, 18 Dec 2023 17:46:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proton.me DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1702921565; x=1703180765; bh=l74qLactwzIVrq/B9kOv8F974+1rgtU+2NAFHFv2u0Q=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=PrBOoSbtVidBr8qVRqgwiiF2kZM4qxQbG9UHEVLk8gHXz+JVsd+Wkf4QqajFU5RDB dD9K8l1kUDM1+bpiYSlxHjIsIp0e/Um5RsiSh7al6eD6mNYyMtPzK1ok0322hIvG5I wthGfuHsSKVl/M6m+tuWDGAa08jVtAqhS0dwTira6waYvwwkzU8ETWvwssU13r7YW7 2bZHAYXaEAMSPpUJRjb94r7BvT5Xs9juVySw5SgtHzFR/mgIndVaW/rfXbfxQIGOfo t/UNj4BgZiWX4I9cocLZeGdTadH6rffqrksn82qx+7OJxC2RoSM2D/Sdo3z8vqQKNw lHnEqMigNubDQ== Date: Mon, 18 Dec 2023 17:45:54 +0000 To: Alice Ryhl , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Tiago Lam , Thomas Gleixner From: Benno Lossin Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 4/4] rust: sync: update integer types in CondVar Message-ID: In-Reply-To: <20231216-rb-new-condvar-methods-v2-4-b05ab61e6d5b@google.com> References: <20231216-rb-new-condvar-methods-v2-0-b05ab61e6d5b@google.com> <20231216-rb-new-condvar-methods-v2-4-b05ab61e6d5b@google.com> Feedback-ID: 71780778:user:proton Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 12/16/23 16:31, Alice Ryhl wrote: > Reduce the chances of compilation failures due to integer type > mismatches in `CondVar`. >=20 > When an integer is defined using a #define in C, bindgen doesn't know > which integer type it is supposed to be, so it will just use `u32` by > default (if it fits in an u32). Whenever the right type is something > else, we insert a cast in Rust. However, this means that the code has a > lot of extra casts, and sometimes the code will be missing casts if u32 > happens to be correct on the developer's machine, even though the type > might be something else on a different platform. >=20 > This patch updates all uses of such constants in > `rust/kernel/sync/condvar.rs` to use constants defined with the right > type. This allows us to remove various unnecessary casts, while also > future-proofing for the case where `unsigned int !=3D u32`. >=20 > I wrote this patch at the suggestion of Benno in [1]. >=20 > Link: https://lore.kernel.org/all/nAEg-6vbtX72ZY3oirDhrSEf06TBWmMiTt73Ekl= MzEAzN4FD4mF3TPEyAOxBZgZtjzoiaBYtYr3s8sa9wp1uYH9vEWRf2M-Lf4I0BY9rAgk=3D@pro= ton.me/ [1] > Suggested-by: Benno Lossin > Signed-off-by: Alice Ryhl > --- Reviewed-by: Benno Lossin --=20 Cheers, Benno