From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) (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 C6FE926C38C for ; Wed, 10 Dec 2025 09:34:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.68 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765359249; cv=none; b=US+W+1e5jDaw91m7sb4z0UK+4rX5Hj3QWtaoNT7Go7lQW/0jLwtTa+qltRP8s6ByRAnbFhQ/+UZxA8kg0sLiq0vnIfLKfhq1Y3hkGqHQT1gIXP34gDBNiCUsCeOLHRobsvW65Eg2GxSjmFCSv45aeDkqiBglGhcKplIOJzZL4AA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765359249; c=relaxed/simple; bh=M3M9okF8InGndq8/V81yatcnsCbWgobmk2l0EWs/1+g=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=i0BzvD9ByAbEO3KvQeSyeG5hKBgkVCafrFlKg5KZKplruJkPp/UNdwLCKVf4/0mfMO9Oaj1Y9fY0vpVH+BibGIaTD4hq0IITKvhhu+RDaURT3NXpQFMgFeNu+L6FII8UfzSn5UV+aikmscpxMRkfm+uOrWAP1klwjEBHf+dXfiA= 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=lsSAxWfh; arc=none smtp.client-ip=209.85.128.68 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="lsSAxWfh" Received: by mail-wm1-f68.google.com with SMTP id 5b1f17b1804b1-4779a4fc95aso3811755e9.1 for ; Wed, 10 Dec 2025 01:34:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765359246; x=1765964046; 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=OhQYB4KwC3z/GZcHsZYxbavJNnVI8WynGF/8rShdEFo=; b=lsSAxWfhj63h4fO6V8pXNUm0Yz6mM5aj6eLI4Lp+vKEj52eoKFVL8O36lv0EqgOjyt GzF+SmyJFmBfqwNERymLyEXfpFDu7Fb51LYl7lXkGps75rOyvI0h88PfaXBrh9vBlDyQ OjKUb5BMvV+elWtbhLYzQQdnwlUUeCIDOcrNiGF7fKbM2EVitO3j2WuNR0Dk28UeuJJV loX/jLhuCYRVSE/UHRVEGMJkuAig99Nrn/haghhvuHyatpGvUWyc1BXepPaYeW3Xvghu CgpDHUlLw97zkXs6IzxjJgis2vfUziBGNyPO5bVW5c/O98CKaBp+fr+mG3cgJXytwz6m XIWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765359246; x=1765964046; 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=OhQYB4KwC3z/GZcHsZYxbavJNnVI8WynGF/8rShdEFo=; b=Xs29tNKF24cluWjH9vPi0qdLDKY59jgrSHd6ROsPgp2THTytuuX9pTzE18M8vemz2F k/zC7ezmbGZEWSUUJG1AQOHDL+hSjnd/vG1/mJSgr/4GbiBcyBr2Ff6X+UqMhDQi1D50 WGe7s+AP4/q1/lRhdmfWag26MtlMEQqaC+gZCtl6EbmbrrIvNTTzB0fvuJHCGAh5X53N VuKwFH57j1ViSbio4r17WgPEX1ZaaJp0yRa6GaxLeK73QNnawfhOso7OnkIPwGEew7/Q AmiMcxW0TrZChUz8eRlSHTDBVTpEPPMGWFVSkXQHo2N2rNZbreaF3vK3uslotiUTVD3+ DhzQ== X-Forwarded-Encrypted: i=1; AJvYcCVufLAKtOmsDSqzMpQySbTUTbtf1P4AakG2t2nWJVB/R/XeIt8vvgAxrgPjgIOW5Pv0AblHirTsAKUVTu4=@vger.kernel.org X-Gm-Message-State: AOJu0YyEsRs6clECE4gfQ18DDPO3ra+EihkVc3ZPOwBx3RUvipSlNMXo 4Pa2u3C2lPVUSU5zvQAvpJ+Gixb/K1QUXB5FQac8oXU67zadNZMqpVZ+ X-Gm-Gg: AY/fxX4519nK2m2bs/HAfOzk1uoWkCHoDmvgUJ+gUjpM8tX/4vFQ6EQNmlBtuIvDt49 TGfdIxyJbA1UCIC+duipVhzQT3dfao6KJ2aolKMgR5W2A7gDj9/X3JKfY7sESUSBf55Ulql8KfM HoKUPLXkPLIOvma/VJ8e10+UOMASzuGqEPWJmW1b08U6SCTBoBSjl9hAjj3GfRVKr2+Rw5t61sm BeJw4i7gsxrSSrRy/UhjrqNS7boDmUqLphcgyoXzsfNj3ajGOM+Sa3Hs9JwiH6xueVZpWYRYJkV 9Gygnc/4LBcSVSgsuOGlGz7eWxpbDYsPUb0b1vZgHU+OL5piWPQLX5FcDt7G7YNmsAoBudDb/wL sE431zGLemul9NKvrbfZIcMC3IXj3LMzUpUQjRjfSVTfulAkljG97FdeUagevaS99IyFUNPtRHO 76wPzLiizjD1xo83y1xH/GqkdzLqjPmEDubg3k2Z5QeDRtnD0JiXVE X-Google-Smtp-Source: AGHT+IE7rYejhRbyl0DO+pkIwWD46QEKa2tZgut7YIWRTjFqNP11BsWUZQcBOZystZ2OE7SoB+Sumg== X-Received: by 2002:a5d:584a:0:b0:42f:8817:7ed with SMTP id ffacd0b85a97d-42fa08697aemr5623626f8f.30.1765359245754; Wed, 10 Dec 2025 01:34:05 -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-42f7cbe8f85sm37665903f8f.5.2025.12.10.01.34.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Dec 2025 01:34:05 -0800 (PST) Date: Wed, 10 Dec 2025 09:34:03 +0000 From: David Laight To: Mika Westerberg Cc: Yury Norov , 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" , Simon Horman , Andreas Noever , Yehezkel Bernat , Nicolas Frattaroli Subject: Re: [PATCH 2/9] thunderblot: Don't pass a bitfield to FIELD_GET Message-ID: <20251210093403.5b0f440e@pumpkin> In-Reply-To: <20251210055617.GD2275908@black.igk.intel.com> References: <20251209100313.2867-1-david.laight.linux@gmail.com> <20251209100313.2867-3-david.laight.linux@gmail.com> <20251210055617.GD2275908@black.igk.intel.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 Wed, 10 Dec 2025 06:56:17 +0100 Mika Westerberg wrote: > $subject has typo: thunderblot -> thunderbolt ;-) > > On Tue, Dec 09, 2025 at 10:03:06AM +0000, david.laight.linux@gmail.com wrote: > > From: David Laight > > > > FIELD_GET needs to use __auto_type to get the value of the 'reg' > > parameter, this can't be used with bifields. > > > > FIELD_GET also want to verify the size of 'reg' so can't add zero > > to force the type to int. > > > > So add a zero here. > > > > Signed-off-by: David Laight > > --- > > drivers/thunderbolt/tb.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h > > index e96474f17067..7ca2b5a0f01e 100644 > > --- a/drivers/thunderbolt/tb.h > > +++ b/drivers/thunderbolt/tb.h > > @@ -1307,7 +1307,7 @@ static inline struct tb_retimer *tb_to_retimer(struct device *dev) > > */ > > static inline unsigned int usb4_switch_version(const struct tb_switch *sw) > > { > > - return FIELD_GET(USB4_VERSION_MAJOR_MASK, sw->config.thunderbolt_version); > > + return FIELD_GET(USB4_VERSION_MAJOR_MASK, sw->config.thunderbolt_version + 0); > > Can't this use a cast instead? If not then can you also add a comment here > because next someone will send a patch "fixing" the unnecessary addition. A cast can do other (possibly incorrect) conversions, adding zero is never going to so any 'damage' - even if it looks a bit odd. Actually, I suspect the best thing here is to delete USB4_VERSION_MAJOR_MASK and just do: /* The major version is in the top 3 bits */ return sw->config.thunderbolt_version > 5; The only other uses of thunderbolt_version are debug prints (in decimal). David > > > } > > > > /** > > -- > > 2.39.5