From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) (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 F13E32F0C6F for ; Sat, 13 Dec 2025 10:01:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.66 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765620101; cv=none; b=WTCsvNG0YwWUBGmH7ZL3uVFi5W34Bx3lNgnNjzD7hHVc8+SrYPt3AEgcCeytfSjFXu5hdey7Ocgb9Uet4NP0kwMtZJPxoKaz3dT3bPJE5fOSUnp21gk9/Cwm+iMfWpcHYYcTqAzM3yywXw8g/L1FLpbPkqUAkEzdZWNzCnsWJsU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765620101; c=relaxed/simple; bh=ISTnauUgqtX3anx20hEwzWdxOhqzLzx2s9oiIgXjk6Y=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AAbRco+QthMplGzp5SKaOl/VwBHR9Mrivk1A7kyujA/uPnt93ZOHPJkdTAMG8KY4vV/c7odtFO0rDwQVsiXG5cQhQuqF43Za4cE6ihHKHejowzbvbDtXd7JUSS/7EUVM3dThhoYwXsm2XlSjTFp9ywwYQ9ZAm5W+idyGWZAhGd8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UTl4HWdZ; arc=none smtp.client-ip=209.85.221.66 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UTl4HWdZ" Received: by mail-wr1-f66.google.com with SMTP id ffacd0b85a97d-42e2e628f8aso886398f8f.1 for ; Sat, 13 Dec 2025 02:01:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765620098; x=1766224898; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=iuXEsI4o+Wa379m0TvRCtoXu9MdxgJfMN/rAoI/CIR0=; b=UTl4HWdZmSuPRYFLzXSNfDETXE//lIsGQsMLl6f4tcVdDorn1D3wK9X3YCvf//mtNF 88Q4DzO8oMMkdqi0NMBSZb2ADpm3vaL+BEXJeMzb4wN3AAVEEtUhjYkmrX6/elVnwKE0 LOzVkneOoMZn8W90D0Us1fTY/PqF1TwFycOYmrKsooCDls0q4dp85c17XEibIiSZf6RN Kxp8wRP2DqziBcRhbpjUOEgjXUlqZYjRIR014GAN2k5sI4c3dDxMci9WCjoaYZ+Baulu sdt2S6JxmKh9SFESGIEzt1ZkBpb87QyQofk/ZMFgS2avV2M+eLZepY0fyBMe9FRt4PWy t9ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765620098; x=1766224898; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=iuXEsI4o+Wa379m0TvRCtoXu9MdxgJfMN/rAoI/CIR0=; b=HMQJuWnzIofxfxxt5dNUbKpAqGAy6T8oDKZTDMPcC/nG3cUHYgxSIX8E3Af7sXqdlX 2Slbc9Vo4NGQKYOiNmDGFmwLTRYPNS1asI55PsAfnANWDNzkktDnphnDt6/vkwsZLFja SeQ4Toibd4WmLC04RgGh0TYi4uc5OC29UuInXdZCaOLKkT2yXlk4GMTxvP1f3uPi+hFK 5mTKQsw/Wv6eWfFSKsE3QCKelNjJkL9hsv+DaY4lGGAzvhip62YgxlxdqMCY7lUplBJC 9cXgEX23dUm1HUzBGdXbJI+jvnj0HK2sYRxbb7xkmDl6jN90w9RKSEWqALS5XzlSVxBK w7uQ== X-Forwarded-Encrypted: i=1; AJvYcCWyX6ISqHb7VjGU99/t/1btNMVoSIdla0/iepuEO5AySHvzYN1woferh+Smr8eRtFwmZuQMduAcJeleqCI=@vger.kernel.org X-Gm-Message-State: AOJu0YyJFgSa2BBwbs3IgNNxus0yBWGWWsNfBN6de9hLKyT2QT66uiCi /VY9Saog5MIyPpaLnT3QXkcuJg+wnyABRYGWwc2DStnJ1tsV3TodwWIu X-Gm-Gg: AY/fxX61vU5XXyD4AUUWT79CkhOfisupaV+CMn0MxxzSVrIKHlS5zjJfxoH7yxPP44O kiUu+iHbUzb7GX+rUC8wb5Ag26w1K18ACo2TF8yOaguTbjwk8MtEj3H5M5fYhKz3UXb6173eAU9 M2iLU9z29dzTVXKrC8kHI+xc0gltMzVOFrGj3ruIjhMO+i65tiD9PehDU0BUG+D6Y4muWAaEPMQ lE8HKi0vgIIz34yYVsNFdscmIZT1EnSoR6NFsgmPqKWBuRE6b2TWzMbNIBW2gg7NnrgbTYc3VGq pII8tq9y2mEPzdqniHWYZfuW92oF/UiNpMyUJYQlqJ7ib5BPSRi6vxb2W5R/YMliJJC1WeSHaIM HJESH0qjc/6T5d2xH6lLprXJVZgtloxZMEAk4SdhEsP3yKcRLuq63hanuiDLJBEO3e/8a/xv7hw YcnFsdyyKQwry+YtLq2Ob1jMyd8sB8T3SdWiqGP+Ps5Dah0eIqQ4y+ X-Google-Smtp-Source: AGHT+IE5jCmsnzEvOJCvLTCmPIB9nQFTexaypDGXRYykLDOoO4cf1BafRcQOIhwXKJ8zZAF1vBRyjA== X-Received: by 2002:a5d:464d:0:b0:42f:b707:56e6 with SMTP id ffacd0b85a97d-42fb7075cabmr3502696f8f.34.1765620097989; Sat, 13 Dec 2025 02:01:37 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42fa8b9b750sm16558826f8f.42.2025.12.13.02.01.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Dec 2025 02:01:37 -0800 (PST) Date: Sat, 13 Dec 2025 10:01:36 +0000 From: David Laight To: Yury Norov Cc: Rasmus Villemoes , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Geert Uytterhoeven , Alexandre Belloni , Jonathan Cameron , Crt Mori , Richard Genoud , Andy Shevchenko , Luo Jie , Peter Zijlstra , Jakub Kicinski , netdev@vger.kernel.org, "David S . Miller" , Mika Westerberg , Andreas Noever , Yehezkel Bernat , Nicolas Frattaroli Subject: Re: [PATCH v2 02/16] thunderbolt: Don't pass a bitfield to FIELD_GET Message-ID: <20251213100136.3d83a236@pumpkin> In-Reply-To: References: <20251212193721.740055-1-david.laight.linux@gmail.com> <20251212193721.740055-3-david.laight.linux@gmail.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) 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=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 12 Dec 2025 21:28:31 -0500 Yury Norov wrote: > On Fri, Dec 12, 2025 at 07:37:07PM +0000, david.laight.linux@gmail.com wrote: > > From: David Laight > > > > None of sizeof(), typeof() or __auto_type can be used with bitfields > > which makes it difficult to assign a #define parameter to a local > > without promoting char and short to int. > > > > Change: > > u32 thunderbolt_version:8; > > to the equivalent: > > u8 thunderbolt_version; > > (and the other three bytes of 'DWORD 4' to match). > > > > This is necessary so that FIELD_GET can use sizeof() to verify 'reg'. > > > > Signed-off-by: David Laight > > --- > > > > Changes for v2: > > - Change structure definition instead of call to FIELD_GET(). > > > > FIELD_GET currently uses _Generic() which behaves differently for > > gcc and clang (I suspect both are wrong!). > > gcc treats 'u32 foo:8' as 'u8', but will take the 'default' for other > > widths (which will generate an error in FIED_GET(). > > clang treats 'u32 foo:n' as 'u32'. > > FIELD_GET() works just well with bitfields, and whatever you do breaks > it. I pointed that in v1, but instead of fixing it, you do really well > hiding the problem. It doesn't, pass 'u32 foo:6' when using gcc. David > > I see no reasons to hack a random victim because of your rework. So > NAK for this. > > In v3, please add an explicit test to make sure that bitfields are not > broken with new implementation. > > Thanks, > Yury