Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7742442rdb; Thu, 4 Jan 2024 06:26:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IE3DPR35GhfhVnHbmloIS6nUOtkTA8TqKYgORCRDQE29aV7lRPoHbXwYqNRKfiWh+vbD9VX X-Received: by 2002:a17:903:2343:b0:1d4:1d9a:14ff with SMTP id c3-20020a170903234300b001d41d9a14ffmr645652plh.95.1704378372037; Thu, 04 Jan 2024 06:26:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704378372; cv=none; d=google.com; s=arc-20160816; b=jT2Lf8Et8xz8ziJCRyrJJT4KpBFqkCJ+lUNwgtvhUSeM8AxgHrd2TeX0/QZkkyCUIV rdzjExWIwDV+N2LlwOXSPELxhZEj7Uzn8ZbpbhXatizNjsm24tGzhjbIKxmVArJ3Xp42 tLcUiakLCuxYbW3lcLwwzovIuDVCb6F3q5yjKD2WAjPTBk0sRbIY9bsNCdFtaR2wHXOD +/XyVFcNhZgGXbQbTHQNVjQannC27Jxc2Q9JsGQv5i37ZoVwCn61hNYUQHbj7vrRa5SF tNbofdf00dqJTkHzD/w1EW54IfBkEpBx/kvuISPArIDQvrBf2UQ+813IaL+c9iE7ONVE 1Pbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=YyXkGaIn4n8uR5zY2tnEwMlymDvJhftWg9/2ZNakfUM=; fh=KX8EOe44VxRQ8rcLsN2QoJfsTCwdGr49gXn0rzhUGfA=; b=UJptw91q5pA8acyfryax1sJCfPtjl7Y5Z+HA5y3rcOA/BTyAG+guyXCAkzTBcmBaXv tfb+qHUbmsrggeUpE2IPQlAXZOGk6676UkcAxLmvgWZmzvx51ZQrqxwAeaIAaGVkMtya evyJlbKzgo4qaUPo8jHD9/Z1rZpOtbZPOsr2kramvgkP/ok8dFmuWgZ0BIJ+gmCExVYz DLZBV708GhRuVEDr+C7U4h4wvvZ0/9xlYd4k+ZU9CjK9RfbD4sRwwJjsLNnUflP4DNrT 4obNUWu5TKoTQBN4/3y+rXJh+vWEQulfHMWuV35fCZMEzzs00VCV0ztkYNUZmCCLTO0t hwwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lSQ9j7ug; spf=pass (google.com: domain of linux-kernel+bounces-16776-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16776-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id u1-20020a170902e5c100b001d3b2366adasi23430903plf.35.2024.01.04.06.26.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 06:26:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16776-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lSQ9j7ug; spf=pass (google.com: domain of linux-kernel+bounces-16776-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16776-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 0B8E9B25C1E for ; Thu, 4 Jan 2024 14:21:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F0C5D24207; Thu, 4 Jan 2024 14:19:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lSQ9j7ug" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6AE2241F5; Thu, 4 Jan 2024 14:19:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-6dc02ab3cc9so334249a34.3; Thu, 04 Jan 2024 06:19:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704377980; x=1704982780; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=YyXkGaIn4n8uR5zY2tnEwMlymDvJhftWg9/2ZNakfUM=; b=lSQ9j7ugW2q4+YomZQK0Nm/vDby01tvZ6YeOQO869+C6fGdQP/Dm9QlN0iZAoRwvBO KqXhdVMAYoELxMB3uuXQDj9xDZyU89jFbxO29DjR8op0dRvMQS0E+NUee+4fjx1ZPx2H mhS6TXRvrWW9Z9K/Qh4DeWOTz4+Oouf8JEqhdG7puOG0FLsi59XBLL1yEyCyiJrmwvWT SBTlRCFbybjiQmbDdZt8wL8WdXVo2hBuRkQIc/cweKEIByFEEMrI7//ImwRzhRWY7wuB dezpuMqXwwvNUXFdiV/dJET+k0hePSkgRy3cSDvG/H+A3B70yPNbxuENLEpvGKD5sLVE gZmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704377980; x=1704982780; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YyXkGaIn4n8uR5zY2tnEwMlymDvJhftWg9/2ZNakfUM=; b=Hz2HNEoIfIGRKrNZXmAkRcT7K5HXCX9WJL/uZCAtohzIqtd3Cw+GQXN+fwMaL+hvqM sauqO7pHZk7KL3DaPMEKuASRFoyhtYXRZlFM1/wQPYD5c8FRKcQxxeWqgz3ocO2hfrrX uxdpsUSt23E8jmzFBhlOdsftLUS5N8p+b4WyGy8uiYoNrcAad3vW6MLOtdp7J9ZLvDFl ZtXworSu7LH/38ResD7UQNl4l4yA9nXJa1a3ZiE5VxuFPhMV5RvMtb37IoH9trbGJYRo aaN48x1i9xXcZceRfZPnJVuwNHQvncEccwu9UOFiV2vwdM4wdP0lIM1bS4+lVSjJmc9u wUcQ== X-Gm-Message-State: AOJu0YwX4n3vfe1OGnhOF5YUzAtv3RiJI+l+MFE6Z4iegMFzdIb9q0Ki T+qekMNmaXxLrIE/4PMNPFg= X-Received: by 2002:a05:6358:2826:b0:175:4915:ebf5 with SMTP id k38-20020a056358282600b001754915ebf5mr667732rwb.43.1704377979784; Thu, 04 Jan 2024 06:19:39 -0800 (PST) Received: from [192.168.54.105] (static.220.238.itcsa.net. [190.15.220.238]) by smtp.gmail.com with ESMTPSA id d25-20020aa78e59000000b006d945660076sm24634123pfr.59.2024.01.04.06.19.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Jan 2024 06:19:39 -0800 (PST) Message-ID: <3d6d8098-f303-4767-9ba2-e7a80433a4c2@gmail.com> Date: Thu, 4 Jan 2024 11:19:34 -0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 4/4] rust: sync: update integer types in CondVar To: Alice Ryhl , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Tiago Lam , Thomas Gleixner Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240104-rb-new-condvar-methods-v3-0-70b514fcbe52@google.com> <20240104-rb-new-condvar-methods-v3-4-70b514fcbe52@google.com> Content-Language: en-US From: Martin Rodriguez Reboredo In-Reply-To: <20240104-rb-new-condvar-methods-v3-4-70b514fcbe52@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 1/4/24 11:02, Alice Ryhl wrote: > Reduce the chances of compilation failures due to integer type > mismatches in `CondVar`. > > 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. > > 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 != u32`. > > I wrote this patch at the suggestion of Benno in [1]. > > Link: https://lore.kernel.org/all/nAEg-6vbtX72ZY3oirDhrSEf06TBWmMiTt73EklMzEAzN4FD4mF3TPEyAOxBZgZtjzoiaBYtYr3s8sa9wp1uYH9vEWRf2M-Lf4I0BY9rAgk=@proton.me/ [1] > Suggested-by: Benno Lossin > Reviewed-by: Tiago Lam > Reviewed-by: Boqun Feng > Reviewed-by: Benno Lossin > Signed-off-by: Alice Ryhl > --- > [...] Reviewed-by: Martin Rodriguez Reboredo