From nobody Thu Oct 2 22:47:40 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 021D02550D0; Tue, 9 Sep 2025 21:08:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757452090; cv=none; b=i4jYPaB2s62daQi6m7KDkt1Z7SmgtpWvzGTEJSIZWbbHw3XQwLV3nu6qbFxiRoIQtjBjYMeRzCIEPdFX2nzLmsgWa0Pj2zmQhl55iLuqDOvi627Bx1XtfybtjxdSl2HqOzByEsTgy1915MHIuVNWPvQSeEajRfav3XKDV23qfsc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757452090; c=relaxed/simple; bh=QqTMGVrIbXpL32AsTTbWzre88o17tWgxD0nkKN9e7DM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=f3f8FoZ8g9VWDKpf+gwn0vo3OQrgPisV7MxurWHHzHspgkECQGXJQGYLTj+29WsquPzRcGcls9qXpoQYSr8XD9IdvwwZsU0uaKrb/I3g8gjjliOLc5engmgFhKCeqy8LV0IsVadC6oPrnoEfv23HgtkckKx3YFBkSiUtR+MTMBA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uBGrdNhq; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uBGrdNhq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFCAAC4CEF7; Tue, 9 Sep 2025 21:08:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757452089; bh=QqTMGVrIbXpL32AsTTbWzre88o17tWgxD0nkKN9e7DM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=uBGrdNhqWDj7eYDl9SuyxZRsDXGNqXfF2WoTo+K+dAyUInyPLPGO5++kk4wvGSH1O QsU+sfThfzU2CBH5++sWXiw00EftdAwXzgMlUycnqza/T7D8tjCLdAkxSE6VF08QUc c2XPw0Qvz07XkCNpygUV4zMkAnjgp3n1kPYRPRAB8DD+ugi4U/4NoV4LFB4Oa+/f8j E25fdYVlnSOAZy20LyZFdP/usODihEixBcM+4CZyFY11ygLwY/0MTqEbauO0FKpSI4 duaXxwxItV2W/PfTbH2a9rra8Xrsy1kMeb3m1j1vMPcaAhdwFzURrRg5un97JNjl1w iOOVV1XbyKM2w== From: "Matthieu Baerts (NGI0)" Date: Tue, 09 Sep 2025 23:07:47 +0200 Subject: [PATCH net-next 1/8] tools: ynl: fix undefined variable name 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 Message-Id: <20250909-net-next-ynl-ruff-v1-1-238c2bccdd99@kernel.org> References: <20250909-net-next-ynl-ruff-v1-0-238c2bccdd99@kernel.org> In-Reply-To: <20250909-net-next-ynl-ruff-v1-0-238c2bccdd99@kernel.org> To: Donald Hunter , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1488; i=matttbe@kernel.org; h=from:subject:message-id; bh=QqTMGVrIbXpL32AsTTbWzre88o17tWgxD0nkKN9e7DM=; b=kA0DAAoWfCLwwvNHCpcByyZiAGjAly7IggAfKf0faFuaT6tSXzJkg3kl+qjoz9J4fU+6bnjmZ 4h1BAAWCgAdFiEEG4ZZb5nneg10Sk44fCLwwvNHCpcFAmjAly4ACgkQfCLwwvNHCpfDiwD6Aotr c/EFqidOoGQb17En2iBEbRqa+m70/Z/cnYsmt9UA/RScO2MyqaV4UwTscsOtaAOWff9HTEma277 k9KO9czYA X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 This variable used in the error path was not defined according to Ruff. msg_format.attr_set is used instead, presumably the one that was supposed to be used originally. This is linked to Ruff error F821 [1]: An undefined name is likely to raise NameError at runtime. Fixes: 1769e2be4baa ("tools/net/ynl: Add 'sub-message' attribute decoding t= o ynl") Link: https://docs.astral.sh/ruff/rules/undefined-name/ [1] Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Asbj=C3=B8rn Sloth T=C3=B8nnesen Reviewed-by: Donald Hunter --- Notes: I don't know if such fix can be queued to 'net'. It is in the error path, it doesn't seem required to backport it. --- tools/net/ynl/pyynl/lib/ynl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/net/ynl/pyynl/lib/ynl.py b/tools/net/ynl/pyynl/lib/ynl.py index 8244a5f440b2be8f08f8424270a4dbd67a81a80d..15ddb0b1adb63f5853bf5857968= 7d160a9c46860 100644 --- a/tools/net/ynl/pyynl/lib/ynl.py +++ b/tools/net/ynl/pyynl/lib/ynl.py @@ -746,7 +746,7 @@ class YnlFamily(SpecFamily): subdict =3D self._decode(NlAttrs(attr.raw, offset), msg_fo= rmat.attr_set) decoded.update(subdict) else: - raise Exception(f"Unknown attribute-set '{attr_space}' whe= n decoding '{attr_spec.name}'") + raise Exception(f"Unknown attribute-set '{msg_format.attr_= set}' when decoding '{attr_spec.name}'") return decoded =20 def _decode(self, attrs, space, outer_attrs =3D None): --=20 2.51.0 From nobody Thu Oct 2 22:47:40 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 08DE324C692; Tue, 9 Sep 2025 21:08:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757452093; cv=none; b=ktMRSHnbCaF5j++QjLgfkPsmjv1TK0uutaaJZwgjZa8BKlJUUBuNz6sbvUeszcSxreZMitvXP+jqJYQ/ugw0L8uUJ5YiyyYgCqQiZ9+6bXMjU9JPl+krlPJ6GEn82i7iB36kYt3NpNZRY5YsMSKDp30ZAimiBM5DcC+fF4tfx+g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757452093; c=relaxed/simple; bh=hySgMDSj7EmJZ8nhTa5VYkOzwmN7VsefMu15/SIBkLg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AKudVZcX1xbFlfs6uXmvsRBOuRfgJetVcQVpYn6f6jZspL1z206TuZne1P3EWro4ei37KOnqNHXhM2mzWk51K8Q/LlsIIoJam0pzLbSwIb1KSfMl5PK8daluksql52adX1egh6ZV1Nm7bX0qzqf2BCWGRLpK1NtVc0eQxHYiD94= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YHKBZZ2L; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YHKBZZ2L" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0216CC4CEF8; Tue, 9 Sep 2025 21:08:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757452091; bh=hySgMDSj7EmJZ8nhTa5VYkOzwmN7VsefMu15/SIBkLg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=YHKBZZ2LqmDnGY+t7vmcIeuMxy8YkusbY4Ge/yLex4Kr4HQNzE5GRPco31fTKc+a5 ZsrcI9QM4inb5zoWP0i1ks1LqemgQCPmjswBdz/u2HGYI5Yn8hxDETGT5PIZeDPy9k IzBwKSAsGlniU2C54x8LqvnBuE6DKNXkIvYTiGpvYmRHd9lKCN3X+QSp/jeYkajsxP aAx3LsqbeUDxIBjEF/chMWRDg6wBML2LWHVjHFomhdIY9Jko+m3h+S5MvSAA9uyDGz OnJ5EWhG8qVtJ/qmt0ZFRQ1SJzp8zD0OCsFicZTvj748dIUlCbJ8VbrJECrZM5+Uja YIgekJv8f8Tpg== From: "Matthieu Baerts (NGI0)" Date: Tue, 09 Sep 2025 23:07:48 +0200 Subject: [PATCH net-next 2/8] tools: ynl: avoid bare except 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 Message-Id: <20250909-net-next-ynl-ruff-v1-2-238c2bccdd99@kernel.org> References: <20250909-net-next-ynl-ruff-v1-0-238c2bccdd99@kernel.org> In-Reply-To: <20250909-net-next-ynl-ruff-v1-0-238c2bccdd99@kernel.org> To: Donald Hunter , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1134; i=matttbe@kernel.org; h=from:subject:message-id; bh=hySgMDSj7EmJZ8nhTa5VYkOzwmN7VsefMu15/SIBkLg=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDIOTNe33fxm+Z9/9VoZDFEvL13zNXlw5/6pB41BkYtNP k3qniEo3FHKwiDGxSArpsgi3RaZP/N5FW+Jl58FzBxWJpAhDFycAjCRzt+MDOtdWXYZVqu++Ft8 o4xx0Z9txfeN5S/tSRNLDrhzo/jWvC+MDC1T8mNMDk7o7HpbJ7+8+q/2bVOuSo93qca9HlePvJx 2kR8A X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 This 'except' was used without specifying the exception class according to Ruff. Here, only the ValueError class is expected and handled. This is linked to Ruff error E722 [1]: A bare except catches BaseException which includes KeyboardInterrupt, SystemExit, Exception, and others. Catching BaseException can make it hard to interrupt the program (e.g., with Ctrl-C) and can disguise other problems. Link: https://docs.astral.sh/ruff/rules/bare-except/ [1] Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Asbj=C3=B8rn Sloth T=C3=B8nnesen Reviewed-by: Donald Hunter --- tools/net/ynl/pyynl/ethtool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/net/ynl/pyynl/ethtool.py b/tools/net/ynl/pyynl/ethtool.py index cab6b576c8762e0bb4e6ff730c7cf21cd9e1fa56..44440beab62f52f240e10f0678a= 6564f449d26d4 100755 --- a/tools/net/ynl/pyynl/ethtool.py +++ b/tools/net/ynl/pyynl/ethtool.py @@ -51,7 +51,7 @@ def print_field(reply, *desc): for spec in desc: try: field, name, tp =3D spec - except: + except ValueError: field, name =3D spec tp =3D 'int' =20 --=20 2.51.0 From nobody Thu Oct 2 22:47:40 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BEE98258CE5; Tue, 9 Sep 2025 21:08:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757452093; cv=none; b=H9GZV8/gqMJAWOAvGKfvbK85GxqfIo5eDHQm+Rcd2Y8vlagvmiOmRFDFJj335NpdHve9FvqpNVDZrUxjWvuDNxzGIoO3tX1JaYpdDKIKqLBUVO1yeBKF6tWdLxy4sY3p5HZLlDL/2Y7987D/N+rUQrodlOe/T/WTV6Vb/SXkXcg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757452093; c=relaxed/simple; bh=pxzpuyqnlW4OnsRKv8aNxFfdEU8dvfaFVpoBzcAkfXE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kNRDu/9bhriZUEex0do97JbWIGuMYc0SlS+Hf/0J3bqaGGuEBDSGF2cU0ZHN/4dY+seRARNzLCeO4+761QJLAIWtPcfb0cl7YemVzDgsqxV4Z24+FHtmcGmdCmJFNuA+4KJKTJeT+xEurfxx33dPCWcMFAaYVhzCNnLz68ONcM8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ToQFk8Ko; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ToQFk8Ko" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09B36C4CEF7; Tue, 9 Sep 2025 21:08:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757452093; bh=pxzpuyqnlW4OnsRKv8aNxFfdEU8dvfaFVpoBzcAkfXE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ToQFk8KoJ/uTHwTEdfRzBHXauI2eG89U1hG7B2G9deKlxv6ZT/rQPfmTPaMqpDEGt OSlbcmqUqLDIcbSsqvusAgvDfOtkI4QOP2hmoRPyYeIy6B1ArEJdhZz6Ygdn4JLTWB jeXWGD0v3zVWtUmLYiH81f2hPil5KBFD/OOfti1tXXQLfOz/jFxsADa5kZqLYAiCH6 CGytdHYsgr3/gXgR4e/5gUFlvWWsbE8ioGmD8G18Ydiw7HGBDNq598w3ENUGOYxy7u 8ST6RyAas4RDGNAPJDW2MG2U0QC2LDs5ECgFngYyEhOMtAtDzWaga1kRsG9RLhROnU CPqDkCJyqQFVg== From: "Matthieu Baerts (NGI0)" Date: Tue, 09 Sep 2025 23:07:49 +0200 Subject: [PATCH net-next 3/8] tools: ynl: remove assigned but never used variable 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 Message-Id: <20250909-net-next-ynl-ruff-v1-3-238c2bccdd99@kernel.org> References: <20250909-net-next-ynl-ruff-v1-0-238c2bccdd99@kernel.org> In-Reply-To: <20250909-net-next-ynl-ruff-v1-0-238c2bccdd99@kernel.org> To: Donald Hunter , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1826; i=matttbe@kernel.org; h=from:subject:message-id; bh=pxzpuyqnlW4OnsRKv8aNxFfdEU8dvfaFVpoBzcAkfXE=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDIOTDe4u3SpcPycadxXnT/bPfx8d9GVp/l7GC4cEWSaE db9VWJnT0cpC4MYF4OsmCKLdFtk/sznVbwlXn4WMHNYmUCGMHBxCsBEul8wMnSc2NkZdTVi+qw/ X22XCO2caXVmyg/jnJ0J8x70zfsmnyXC8D9s5i1fRtkt+rO0bP/lbV/7b9o1IekICauHgRu+C5p rzGYHAA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 These variables are assigned but never used according to Ruff. They can then be safely removed. This is linked to Ruff error F841 [1]: A variable that is defined but not used is likely a mistake, and should be removed to avoid confusion. Link: https://docs.astral.sh/ruff/rules/unused-variable/ [1] Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Asbj=C3=B8rn Sloth T=C3=B8nnesen Reviewed-by: Donald Hunter --- tools/net/ynl/pyynl/ethtool.py | 1 - tools/net/ynl/pyynl/ynl_gen_c.py | 2 -- 2 files changed, 3 deletions(-) diff --git a/tools/net/ynl/pyynl/ethtool.py b/tools/net/ynl/pyynl/ethtool.py index 44440beab62f52f240e10f0678a6564f449d26d4..ef2cbad41f9bdd4e22c1be95632= 6417c9ee23109 100755 --- a/tools/net/ynl/pyynl/ethtool.py +++ b/tools/net/ynl/pyynl/ethtool.py @@ -156,7 +156,6 @@ def main(): global args args =3D parser.parse_args() =20 - script_abs_dir =3D os.path.dirname(os.path.abspath(sys.argv[0])) spec =3D os.path.join(spec_dir(), 'ethtool.yaml') schema =3D os.path.join(schema_dir(), 'genetlink-legacy.yaml') =20 diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen= _c.py index fb7e03805a1130115ccf70d1e3fbdd6ac485374a..957fae8e27ede6fcd51fb2a98d3= 56a6d67d0352e 100755 --- a/tools/net/ynl/pyynl/ynl_gen_c.py +++ b/tools/net/ynl/pyynl/ynl_gen_c.py @@ -2803,8 +2803,6 @@ def print_kernel_policy_sparse_enum_validates(family,= cw): cw.p('/* Sparse enums validation callbacks */') first =3D False =20 - sign =3D '' if attr.type[0] =3D=3D 'u' else '_signed' - suffix =3D 'ULL' if attr.type[0] =3D=3D 'u' else 'LL' cw.write_func_prot('static int', f'{c_lower(attr.enum_name)}_v= alidate', ['const struct nlattr *attr', 'struct netli= nk_ext_ack *extack']) cw.block_start() --=20 2.51.0 From nobody Thu Oct 2 22:47:40 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 3AE60258CE5; Tue, 9 Sep 2025 21:08:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757452097; cv=none; b=PV8jAH5DAtxy7Zwk/ykxcfbxpWPOplq3b9gGl31gnHNEqU4izuw3qGGIanXh4e8aKJ0TuGzImQkVCAdx5f0GVazPxkGGRoDhrlZtgX49M/lY+WPUSSzemeP57GEgX9a+BbTJdeTmB3pJ0wt6V26ulD+dQyFlfUo5QSi/JsRLCeA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757452097; c=relaxed/simple; bh=OFKJuB4qhb72Tb7eguFu89zqSqIfei935QOv2NR1tqA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bVCEL/bHdUT2nRWNIR4zApl53lH6jSqtuJziHagS9Y8yq9HxREngpUOLVwxMZ3I2YUZXcfMoV7tezBx6PR/kRE02KcDqikwU2XYRhWHpqYmdsyK5h7F7FxEtn2rQarJlVfMA7mEE/OFHp+sOXv1tKAAnZXcniN/q0FrFpKbJspA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MjE/MaW/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MjE/MaW/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10C8EC4CEF8; Tue, 9 Sep 2025 21:08:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757452095; bh=OFKJuB4qhb72Tb7eguFu89zqSqIfei935QOv2NR1tqA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=MjE/MaW/EN968at9C91a0gw1HFvGMECjA8d3wCyPotQ3xrKenA+DWMue+uCRiz+7r JYABpjsEl9Be/vhjo6TLScQuCV+YBZ4HEEF5A/XvyThhZ38SZxnwUsX7HQaUoNUt6d jQDS1FOWkdVmKm5LciYJYRBnewQlqAV7a6BRkys4gozt0oSTW1XIz6gji5fu1AATXM BvMe2TLgE6dpcVHVmAz6fMf+y7w0/C2U9ppp+Kyp/NNcfGyBEy/3CXFuuRdaPtbTER 2zvWCZhnLAPqlUCF7CCXEYptYJeOgN/kJ6wz7gldLxXaeaQu9RqeftGgIbkACJQ/eH xk2lvoycBK4ig== From: "Matthieu Baerts (NGI0)" Date: Tue, 09 Sep 2025 23:07:50 +0200 Subject: [PATCH net-next 4/8] tools: ynl: remove f-string without any placeholders 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 Message-Id: <20250909-net-next-ynl-ruff-v1-4-238c2bccdd99@kernel.org> References: <20250909-net-next-ynl-ruff-v1-0-238c2bccdd99@kernel.org> In-Reply-To: <20250909-net-next-ynl-ruff-v1-0-238c2bccdd99@kernel.org> To: Donald Hunter , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=6713; i=matttbe@kernel.org; h=from:subject:message-id; bh=OFKJuB4qhb72Tb7eguFu89zqSqIfei935QOv2NR1tqA=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDIOTDc8NV3ZmvtCiXR++JnY7ItHSjmWiCx56ub0KiH1X 6nKytXRHaUsDGJcDLJiiizSbZH5M59X8ZZ4+VnAzGFlAhnCwMUpABMplWFkmDRzSkmP4L7KvfkX /0ZuNLDd0Ljd7pvQ0uPnC5dPfLty0wpGhrOL07R9RI1PCDLJKW2ZdeZDjbfbnsol4s9PqEUc2W7 zhwkA X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 'f-strings' without any placeholders don't need to be marked as such according to Ruff. This 'f' can be safely removed. This is linked to Ruff error F541 [1]: f-strings are a convenient way to format strings, but they are not necessary if there are no placeholder expressions to format. In this case, a regular string should be used instead, as an f-string without placeholders can be confusing for readers, who may expect such a placeholder to be present. Link: https://docs.astral.sh/ruff/rules/f-string-missing-placeholders/ [1] Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Asbj=C3=B8rn Sloth T=C3=B8nnesen Reviewed-by: Donald Hunter --- tools/net/ynl/pyynl/ethtool.py | 10 +++++----- tools/net/ynl/pyynl/ynl_gen_c.py | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tools/net/ynl/pyynl/ethtool.py b/tools/net/ynl/pyynl/ethtool.py index ef2cbad41f9bdd4e22c1be956326417c9ee23109..c1cd088c050cd52ee379ed4682f= ff856b9b3b3be 100755 --- a/tools/net/ynl/pyynl/ethtool.py +++ b/tools/net/ynl/pyynl/ethtool.py @@ -254,14 +254,14 @@ def main(): reply =3D dumpit(ynl, args, 'channels-get') print(f'Channel parameters for {args.device}:') =20 - print(f'Pre-set maximums:') + print('Pre-set maximums:') print_field(reply, ('rx-max', 'RX'), ('tx-max', 'TX'), ('other-max', 'Other'), ('combined-max', 'Combined')) =20 - print(f'Current hardware settings:') + print('Current hardware settings:') print_field(reply, ('rx-count', 'RX'), ('tx-count', 'TX'), @@ -275,14 +275,14 @@ def main(): =20 print(f'Ring parameters for {args.device}:') =20 - print(f'Pre-set maximums:') + print('Pre-set maximums:') print_field(reply, ('rx-max', 'RX'), ('rx-mini-max', 'RX Mini'), ('rx-jumbo-max', 'RX Jumbo'), ('tx-max', 'TX')) =20 - print(f'Current hardware settings:') + print('Current hardware settings:') print_field(reply, ('rx', 'RX'), ('rx-mini', 'RX Mini'), @@ -297,7 +297,7 @@ def main(): return =20 if args.statistics: - print(f'NIC statistics:') + print('NIC statistics:') =20 # TODO: pass id? strset =3D dumpit(ynl, args, 'strset-get') diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen= _c.py index 957fae8e27ede6fcd51fb2a98d356a6d67d0352e..8e95c5bb139921f38f374d2c652= 844c7f4e96a9b 100755 --- a/tools/net/ynl/pyynl/ynl_gen_c.py +++ b/tools/net/ynl/pyynl/ynl_gen_c.py @@ -485,7 +485,7 @@ class TypeString(Type): ri.cw.p(f"char *{self.c_name};") =20 def _attr_typol(self): - typol =3D f'.type =3D YNL_PT_NUL_STR, ' + typol =3D '.type =3D YNL_PT_NUL_STR, ' if self.is_selector: typol +=3D '.is_selector =3D 1, ' return typol @@ -539,7 +539,7 @@ class TypeBinary(Type): ri.cw.p(f"void *{self.c_name};") =20 def _attr_typol(self): - return f'.type =3D YNL_PT_BINARY,' + return '.type =3D YNL_PT_BINARY,' =20 def _attr_policy(self, policy): if len(self.checks) =3D=3D 0: @@ -636,7 +636,7 @@ class TypeBitfield32(Type): return "struct nla_bitfield32" =20 def _attr_typol(self): - return f'.type =3D YNL_PT_BITFIELD32, ' + return '.type =3D YNL_PT_BITFIELD32, ' =20 def _attr_policy(self, policy): if not 'enum' in self.attr: @@ -909,7 +909,7 @@ class TypeSubMessage(TypeNest): else: sel_var =3D f"{var}->{sel}" get_lines =3D [f'if (!{sel_var})', - f'return ynl_submsg_failed(yarg, "%s", "%s");' % + 'return ynl_submsg_failed(yarg, "%s", "%s");' % (self.name, self['selector']), f"if ({self.nested_render_name}_parse(&parg, {sel_var}= , attr))", "return YNL_PARSE_CB_ERROR;"] @@ -1563,7 +1563,7 @@ class RenderInfo: if family.is_classic(): self.fixed_hdr_len =3D f"sizeof(struct {c_lower(fixed_= hdr)})" else: - raise Exception(f"Per-op fixed header not supported, y= et") + raise Exception("Per-op fixed header not supported, ye= t") =20 =20 # 'do' and 'dump' response parsing is identical @@ -2099,7 +2099,7 @@ def _multi_parse(ri, struct, init_lines, local_vars): if ri.family.is_classic(): iter_line =3D f"ynl_attr_for_each(attr, nlh, sizeof({struc= t.fixed_header}))" else: - raise Exception(f"Per-op fixed header not supported, yet") + raise Exception("Per-op fixed header not supported, yet") =20 array_nests =3D set() multi_attrs =3D set() @@ -2502,7 +2502,7 @@ def print_free_prototype(ri, direction, suffix=3D';'): =20 def print_nlflags_set(ri, direction): name =3D op_prefix(ri, direction) - ri.cw.write_func_prot(f'static inline void', f"{name}_set_nlflags", + ri.cw.write_func_prot('static inline void', f"{name}_set_nlflags", [f"struct {name} *req", "__u16 nl_flags"]) ri.cw.block_start() ri.cw.p('req->_nlmsg_flags =3D nl_flags;') @@ -2533,7 +2533,7 @@ def _print_type(ri, direction, struct): line =3D attr.presence_member(ri.ku_space, type_filter) if line: if not meta_started: - ri.cw.block_start(line=3Df"struct") + ri.cw.block_start(line=3D"struct") meta_started =3D True ri.cw.p(line) if meta_started: @@ -2697,7 +2697,7 @@ def print_dump_type_free(ri): ri.cw.nl() =20 _free_type_members(ri, 'rsp', ri.struct['reply'], ref=3D'obj.') - ri.cw.p(f'free(rsp);') + ri.cw.p('free(rsp);') ri.cw.block_end() ri.cw.block_end() ri.cw.nl() @@ -2708,7 +2708,7 @@ def print_ntf_type_free(ri): ri.cw.block_start() _free_type_members_iter(ri, ri.struct['reply']) _free_type_members(ri, 'rsp', ri.struct['reply'], ref=3D'obj.') - ri.cw.p(f'free(rsp);') + ri.cw.p('free(rsp);') ri.cw.block_end() ri.cw.nl() =20 @@ -3322,7 +3322,7 @@ def render_user_family(family, cw, prototype): cw.block_start(f'{symbol} =3D ') cw.p(f'.name\t\t=3D "{family.c_name}",') if family.is_classic(): - cw.p(f'.is_classic\t=3D true,') + cw.p('.is_classic\t=3D true,') cw.p(f'.classic_id\t=3D {family.get("protonum")},') if family.is_classic(): if family.fixed_header: --=20 2.51.0 From nobody Thu Oct 2 22:47:40 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 42EEE25FA0A; Tue, 9 Sep 2025 21:08:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757452098; cv=none; b=k9PtPpUsWnaZbNpmBm8odgaYdBSJV3Nf60jJ/iKP1RCAuCAm4nQB4qWWKptuGBHJ6muC9/GFrqvze+4YaL4U8tgB5Yr6+30DxmhfTlaWSZWDX6zTVUCZ74z0sGjhG71GqEf3MBpuQVKJ28JWA8HV5Ovj7rEGKToIMydyB0KwPEc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757452098; c=relaxed/simple; bh=WCrbslA/wVt6AWsk9YPK/LBzEczDDuHyG75hWqD+ULk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RWlMIZ8eipqTaOfw8s9g0tGdw/emHKu2lfuUd7kVtTowfmiVQzJDg7BDAcHNCJN80XzbNfu/1GL+6bUXmq81FPyOMZiQ1ewGZ+A1QF9Jm8jN6RWKiqWpFUg/JGzqHOiXoJjDEHj4ZrfiV8BQtpetRzcjjgj+TzF4RUqZ1uStseQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sYmtqgfi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sYmtqgfi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17A72C4CEF7; Tue, 9 Sep 2025 21:08:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757452097; bh=WCrbslA/wVt6AWsk9YPK/LBzEczDDuHyG75hWqD+ULk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=sYmtqgfiDSOJo2Yh4DHQghjDWMuUvhhyCoOLxGuO3JRXd3vw2YuW962j28Uzduhec kIpLp5gznRcw/MyIaFCQ9bhTaQkjzhmNV5xfZ7xISN8pg458hKN2P+RjT7I7QVXqZi RNv11QJA1cz6B5IB2PQ532IPbvej2cSdkK/+e/twPB8mrlzpdLmazVphNtJUYhi4P2 qrKXPtPe53ssQ+tjOr5RGqnDGnQIy9IKYYaSXhDzlC2ot0IiJalJkxzghCZNAdZmTi 9RA7KpWlEQhNJL4Zkg8NBclBj6jMPSn5Ne1WHE71/TECveOiLIW/uIMGkpzYwQ33uv +oSUXevlAL+nw== From: "Matthieu Baerts (NGI0)" Date: Tue, 09 Sep 2025 23:07:51 +0200 Subject: [PATCH net-next 5/8] tools: ynl: remove unused imports 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 Message-Id: <20250909-net-next-ynl-ruff-v1-5-238c2bccdd99@kernel.org> References: <20250909-net-next-ynl-ruff-v1-0-238c2bccdd99@kernel.org> In-Reply-To: <20250909-net-next-ynl-ruff-v1-0-238c2bccdd99@kernel.org> To: Donald Hunter , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2923; i=matttbe@kernel.org; h=from:subject:message-id; bh=WCrbslA/wVt6AWsk9YPK/LBzEczDDuHyG75hWqD+ULk=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDIOTDfacdK2WVZqec2utw++W1rWtZmcfNZVFF4mv3HD3 jxvqfMHOkpZGMS4GGTFFFmk2yLzZz6v4i3x8rOAmcPKBDKEgYtTACZy7jDD/6Ilcq0yyfmmTg/n WM83OSui+mPyoYOro4841Fqd9tl5wZ6R4eUlcwnDmU8e182ZYfBx47/9z3bO+juz4GZ012YZmXO S93gA X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 These imports are not used according to Ruff, and can be safely removed. This is linked to Ruff error F401 [1]: Unused imports add a performance overhead at runtime, and risk creating import cycles. They also increase the cognitive load of reading the code. There is one exception with 'YnlDocGenerator' which is added in __all__: it is used by ynl_gen_rst.py. Link: https://docs.astral.sh/ruff/rules/unused-import/ [1] Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Asbj=C3=B8rn Sloth T=C3=B8nnesen Reviewed-by: Donald Hunter --- tools/net/ynl/pyynl/ethtool.py | 1 - tools/net/ynl/pyynl/lib/__init__.py | 2 +- tools/net/ynl/pyynl/lib/ynl.py | 1 - tools/net/ynl/pyynl/ynl_gen_c.py | 3 +-- 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/tools/net/ynl/pyynl/ethtool.py b/tools/net/ynl/pyynl/ethtool.py index c1cd088c050cd52ee379ed4682fff856b9b3b3be..9b523cbb3568cc2a62109ff7f83= 73e95fd16db42 100755 --- a/tools/net/ynl/pyynl/ethtool.py +++ b/tools/net/ynl/pyynl/ethtool.py @@ -2,7 +2,6 @@ # SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause =20 import argparse -import json import pathlib import pprint import sys diff --git a/tools/net/ynl/pyynl/lib/__init__.py b/tools/net/ynl/pyynl/lib/= __init__.py index 5f266ebe45266e4d8b577f6d0dcc91db6e710179..ec9ea00071be90ce025dbee91c1= c778a9170359f 100644 --- a/tools/net/ynl/pyynl/lib/__init__.py +++ b/tools/net/ynl/pyynl/lib/__init__.py @@ -8,4 +8,4 @@ from .doc_generator import YnlDocGenerator =20 __all__ =3D ["SpecAttr", "SpecAttrSet", "SpecEnumEntry", "SpecEnumSet", "SpecFamily", "SpecOperation", "SpecSubMessage", "SpecSubMessag= eFormat", - "YnlFamily", "Netlink", "NlError"] + "YnlFamily", "Netlink", "NlError", "YnlDocGenerator"] diff --git a/tools/net/ynl/pyynl/lib/ynl.py b/tools/net/ynl/pyynl/lib/ynl.py index 15ddb0b1adb63f5853bf58579687d160a9c46860..da307fd1e9b0f5c54f39412d6b5= 72557e83dbf86 100644 --- a/tools/net/ynl/pyynl/lib/ynl.py +++ b/tools/net/ynl/pyynl/lib/ynl.py @@ -9,7 +9,6 @@ import socket import struct from struct import Struct import sys -import yaml import ipaddress import uuid import queue diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen= _c.py index 8e95c5bb139921f38f374d2c652844c7f4e96a9b..5113cf1787f608125e23fa9033d= 9db81caf51f49 100755 --- a/tools/net/ynl/pyynl/ynl_gen_c.py +++ b/tools/net/ynl/pyynl/ynl_gen_c.py @@ -2,7 +2,6 @@ # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Cla= use) =20 import argparse -import collections import filecmp import pathlib import os @@ -14,7 +13,7 @@ import yaml =20 sys.path.append(pathlib.Path(__file__).resolve().parent.as_posix()) from lib import SpecFamily, SpecAttrSet, SpecAttr, SpecOperation, SpecEnum= Set, SpecEnumEntry -from lib import SpecSubMessage, SpecSubMessageFormat +from lib import SpecSubMessage =20 =20 def c_upper(name): --=20 2.51.0 From nobody Thu Oct 2 22:47:40 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D08EE262FD3; Tue, 9 Sep 2025 21:08:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757452099; cv=none; b=Oj+P6hGQmbHnt2bPOM/39yQelXs+NlKtxqyjhrPqIGMG53Ig5peZfiuJDjC9RiI2drHAyo0QXmNZu4DfJuEtgJjEhj2QyAU8uV4tGUkjvmkNWu7E5BG4KHfZ2VxfYTM2PkG9fJoSCChnAPI4MVpacqHRd4n0zBk0/CKkaMxlafo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757452099; c=relaxed/simple; bh=2Vs5XxdtdWnMR7InzqV/N/e/gSsw7PO7A03we7TMIEw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Q5jd/+5jrcn87UrMqVMLXdszmf+TSla3F/Nzv3L/LzT5O2wMS3s2vUnOeSXi6HFspjSZfYOSJ3T5kvJ2o1hKnv+WR9xJSTXCpCUqCu1xFZePxWkTN9l8/N4JhtxaBvlGtoXD03AqZjE5GwpMO3uyIhKJU4Z8Egficyfvriauam0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hrpOcJ4a; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hrpOcJ4a" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E326C4CEF4; Tue, 9 Sep 2025 21:08:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757452099; bh=2Vs5XxdtdWnMR7InzqV/N/e/gSsw7PO7A03we7TMIEw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=hrpOcJ4aBfT7rVMZrZmf0MSoqsAOK0TGkGtD+F/6xR4jo5iM7MolO8URPhwoqSc65 q2977Le6sRv18v5VkSjkDcOYqLsshsWnkUU1lXbkpSNxSC5JY7nHASslGCzXwtcSrb bxfBvUw9JbH5s7udr73Q3Vz3RqNr/8VRioAXeqZB6saXgxim7QT5jLnKlIkTLiQsrf Hkk5Xw4JnIvkmC40UTh9WxsVTYXfZ3lmZjtXVW3YLTI4uXP+HNXZqaDAR9mfEAewAT PI+J3IWjrKYphAoP2aRzHVXN18YLUC+ZXz+sQh6XqEtTsN7qGobaS37LnSmdWJoM1E PoA1JQQhuxAxQ== From: "Matthieu Baerts (NGI0)" Date: Tue, 09 Sep 2025 23:07:52 +0200 Subject: [PATCH net-next 6/8] tools: ynl: remove unnecessary semicolons 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 Message-Id: <20250909-net-next-ynl-ruff-v1-6-238c2bccdd99@kernel.org> References: <20250909-net-next-ynl-ruff-v1-0-238c2bccdd99@kernel.org> In-Reply-To: <20250909-net-next-ynl-ruff-v1-0-238c2bccdd99@kernel.org> To: Donald Hunter , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1780; i=matttbe@kernel.org; h=from:subject:message-id; bh=2Vs5XxdtdWnMR7InzqV/N/e/gSsw7PO7A03we7TMIEw=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDIOTDde9vNbaMXlBwtOJuds9gkS/CyX5MQVlZSpuDjo2 9LS7P5dHaUsDGJcDLJiiizSbZH5M59X8ZZ4+VnAzGFlAhnCwMUpABOZxsTIcLnm99viVPMXl/b9 UvB8fPPJv3ThfU9T7ogde6y0QfafnzQjw5u2HV4Np3f/qJ2o5/l1366JBklsnz5zH5112r/Kd+9 jL34A X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 These semicolons are not required according to Ruff. Simply remove them. This is linked to Ruff error E703 [1]: A trailing semicolon is unnecessary and should be removed. Link: https://docs.astral.sh/ruff/rules/useless-semicolon/ [1] Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Asbj=C3=B8rn Sloth T=C3=B8nnesen Reviewed-by: Donald Hunter --- tools/net/ynl/pyynl/lib/nlspec.py | 2 +- tools/net/ynl/pyynl/lib/ynl.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/net/ynl/pyynl/lib/nlspec.py b/tools/net/ynl/pyynl/lib/nl= spec.py index 314ec80074964ecfa34a226de5700b42d4dbfad4..85c17fe01e35aa4b4f5d6cc2bc6= 87621def90575 100644 --- a/tools/net/ynl/pyynl/lib/nlspec.py +++ b/tools/net/ynl/pyynl/lib/nlspec.py @@ -501,7 +501,7 @@ class SpecFamily(SpecElement): return SpecStruct(self, elem) =20 def new_sub_message(self, elem): - return SpecSubMessage(self, elem); + return SpecSubMessage(self, elem) =20 def new_operation(self, elem, req_val, rsp_val): return SpecOperation(self, elem, req_val, rsp_val) diff --git a/tools/net/ynl/pyynl/lib/ynl.py b/tools/net/ynl/pyynl/lib/ynl.py index da307fd1e9b0f5c54f39412d6b572557e83dbf86..1e06f79beb573d2c3ccbcf13743= 8ae2f208f56ec 100644 --- a/tools/net/ynl/pyynl/lib/ynl.py +++ b/tools/net/ynl/pyynl/lib/ynl.py @@ -738,7 +738,7 @@ class YnlFamily(SpecFamily): decoded =3D {} offset =3D 0 if msg_format.fixed_header: - decoded.update(self._decode_struct(attr.raw, msg_format.fixed_= header)); + decoded.update(self._decode_struct(attr.raw, msg_format.fixed_= header)) offset =3D self._struct_size(msg_format.fixed_header) if msg_format.attr_set: if msg_format.attr_set in self.attr_sets: --=20 2.51.0 From nobody Thu Oct 2 22:47:40 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 33CAA255F3F; Tue, 9 Sep 2025 21:08:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757452102; cv=none; b=k4RNhh8gm135hQDWESuKBRNBl9EetUxv8Vucq93f9d6cgMBIQNmd/ENpBSFYEjYf5nmF3zQWci0gMAc2rchRngdvc1MMDr6FbcZh8Fu0FOlj8cFFz0Ijq3OyECejDXRzw/hWEx+uPhOFH7PdErXGC8LaQcjsyK9Dp5aelBp0oss= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757452102; c=relaxed/simple; bh=z57LfTaJGDPpioooEKgwgM5UMk8JeKI+exkwjuNDgCI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aVID47b4KZfmxX+oZlEB2rbax9HhRLiHOTtq85CbIp7UmC7SjHXjaBzNlOgkj8w0f5t28n5S9+LteHTv7o1/+4RJ1Nf5xbShMg/A7rZwjuQtXWUeb+o5OFtaux43cj9+9GG3yhG72nx88hGSxwLnOEOkVQC/wVl4QBNOGg93sSs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JO8bf5ym; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JO8bf5ym" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24776C4CEFB; Tue, 9 Sep 2025 21:08:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757452101; bh=z57LfTaJGDPpioooEKgwgM5UMk8JeKI+exkwjuNDgCI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=JO8bf5ymXKpRtG3CWjSEaf1jhQqlIGcYoMVM7hMkYRDtYO115m+jA23V7fWUrgxuq pjWtlcllWsQpy3LyGHMZKkffYyhWItD67KPzwltXOKA6JXoDya34X/M9kJ0f+N/5cY Nb4y4Z1TdYDHd4128Kf2/G7lI4srrzZvdQWmzPNx9kGb8CeItzKblb8vQmfCR1PMd0 ze8VcchJqtFwzRN01jbw4cOoE4jOLcJeQFBsKo6Z8Pn5Nj1yRnxSF7B+UcY+SQlcz9 OCrvqv9CiJNdi1FnRY+RDgOJBV5wkCH/q/LFZeBaGDt7tHcZE8cy8/RKe3LtlrKYFH aB6xhdIEF68Ag== From: "Matthieu Baerts (NGI0)" Date: Tue, 09 Sep 2025 23:07:53 +0200 Subject: [PATCH net-next 7/8] tools: ynl: use 'cond is None' 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 Message-Id: <20250909-net-next-ynl-ruff-v1-7-238c2bccdd99@kernel.org> References: <20250909-net-next-ynl-ruff-v1-0-238c2bccdd99@kernel.org> In-Reply-To: <20250909-net-next-ynl-ruff-v1-0-238c2bccdd99@kernel.org> To: Donald Hunter , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1792; i=matttbe@kernel.org; h=from:subject:message-id; bh=z57LfTaJGDPpioooEKgwgM5UMk8JeKI+exkwjuNDgCI=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDIOTDeZ/fKg1M4fvst+z/ZmOX86NO/UwpLcOTN1A8s6q xWPVLWmdJSyMIhxMciKKbJIt0Xmz3xexVvi5WcBM4eVCWQIAxenAExEy4eR4acar5ZK+Z3CG3fv 8WjvCj5bNfXBNu5gMftPy6ILTr7PU2NkuLRFtUPpywyxh797meou12k+u3FbfxrDlOLF1bMDZyc lcQEA X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 It is better to use the 'is' keyword instead of comparing to None according to Ruff. This is linked to Ruff error E711 [1]: According to PEP 8, "Comparisons to singletons like None should always be done with is or is not, never the equality operators." Link: https://docs.astral.sh/ruff/rules/none-comparison/ [1] Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Asbj=C3=B8rn Sloth T=C3=B8nnesen Reviewed-by: Donald Hunter --- tools/net/ynl/pyynl/lib/ynl.py | 2 +- tools/net/ynl/pyynl/ynl_gen_c.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/net/ynl/pyynl/lib/ynl.py b/tools/net/ynl/pyynl/lib/ynl.py index 1e06f79beb573d2c3ccbcf137438ae2f208f56ec..50805e05020aa65edf86fa6ac51= 56f1c87244a08 100644 --- a/tools/net/ynl/pyynl/lib/ynl.py +++ b/tools/net/ynl/pyynl/lib/ynl.py @@ -705,7 +705,7 @@ class YnlFamily(SpecFamily): return attr.as_bin() =20 def _rsp_add(self, rsp, name, is_multi, decoded): - if is_multi =3D=3D None: + if is_multi is None: if name in rsp and type(rsp[name]) is not list: rsp[name] =3D [rsp[name]] is_multi =3D True diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen= _c.py index 5113cf1787f608125e23fa9033d9db81caf51f49..c7fb8abfd65e5d7bdd0ee705aed= 65f9262431880 100755 --- a/tools/net/ynl/pyynl/ynl_gen_c.py +++ b/tools/net/ynl/pyynl/ynl_gen_c.py @@ -397,7 +397,7 @@ class TypeScalar(Type): if 'enum' in self.attr: enum =3D self.family.consts[self.attr['enum']] low, high =3D enum.value_range() - if low =3D=3D None and high =3D=3D None: + if low is None and high is None: self.checks['sparse'] =3D True else: if 'min' not in self.checks: --=20 2.51.0 From nobody Thu Oct 2 22:47:40 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DF77826B74A; Tue, 9 Sep 2025 21:08:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757452104; cv=none; b=VS1Opdm4KIT2w7wbsjrEfBAWghx3RKUqnWDZYyOLtiwxq+whH3QPEzfQ8CqbkuyFzgzQbQt3qBhkUYTOW5dh4LhGUFKy4ThZNnKxJcn9F37HjwGTU3MuHSbbulniDyR3r0qMU/5ZmhunDrDT3CE0KMRiCm5ybDWs/UrbZkdLVUg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757452104; c=relaxed/simple; bh=+UF2hEJZlCV3Cmwte4Uwt5PvK9ma8IrlSYMqyWNTRpQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lyUe1lSNSHxM5WPgcvboqukIuuj0+xR/g0CHDTIEhxy5VeuKUjRHXNkFQhyAWBHH5o/FYglz5cD90btCCar1QiZfZV8TbbHiRj16pG1OCmeuPSQyCk4sSLFViiFve8ZMpe1uFNLlsPFBpc5wzZ2wLET+xh7zHqpH+7LvrKCb6WI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cJdcKiIT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cJdcKiIT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A772C4CEF4; Tue, 9 Sep 2025 21:08:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757452103; bh=+UF2hEJZlCV3Cmwte4Uwt5PvK9ma8IrlSYMqyWNTRpQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=cJdcKiITFLYq4x8IzV0ZjYQ0m02oZ2V0pho417gTwqRgoXra939ZbGuygc6f0HYP0 M1dYGSaCVb6LVypa1W5fDNzSTc5c3tIQvvXbRG91JG482+GJOcnjcIP7h5csznrWU5 u/kpozkuT/5Y9/y8VuCS+o25LYlJ44TNhbp0MVqYqYGZlne0j9TVAvsdEvjWF9jh7X 1tAPRCGSbywX5vKffJqeb/CkVSNXOnxO3zgfvFJkmFh1FdX7SXxux8kuINja6Ueqxv 3tH79rRqkf4NV630u7RfXYq3czOx0N3iXHTd13GalfU2Lj4f4TuZi1FjSThv/a2l4a Utyw0M9C6XFzA== From: "Matthieu Baerts (NGI0)" Date: Tue, 09 Sep 2025 23:07:54 +0200 Subject: [PATCH net-next 8/8] tools: ynl: check for membership with 'not in' 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 Message-Id: <20250909-net-next-ynl-ruff-v1-8-238c2bccdd99@kernel.org> References: <20250909-net-next-ynl-ruff-v1-0-238c2bccdd99@kernel.org> In-Reply-To: <20250909-net-next-ynl-ruff-v1-0-238c2bccdd99@kernel.org> To: Donald Hunter , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1084; i=matttbe@kernel.org; h=from:subject:message-id; bh=+UF2hEJZlCV3Cmwte4Uwt5PvK9ma8IrlSYMqyWNTRpQ=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDIOTDd9sfND2tsPZyJmHdSZ67Ii9Hi3j0RO8X1376/TO 088lu9f0lHKwiDGxSArpsgi3RaZP/N5FW+Jl58FzBxWJpAhDFycAjCRqGmMDBc2LfL4HVNZtp/1 +/ZbMW48k3bvvO7rVlGu8Nw+pvbqa2GG/74qWzfuFxHvadsRfT9uRkdHhMODe7O70vbaW6706d3 LxQUA X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 It is better to use 'not in' instead of 'not {element} in {collection}' according to Ruff. This is linked to Ruff error E713 [1]: Testing membership with {element} not in {collection} is more readable. Link: https://docs.astral.sh/ruff/rules/not-in-test/ [1] Signed-off-by: Matthieu Baerts (NGI0) Reviewed-by: Asbj=C3=B8rn Sloth T=C3=B8nnesen Reviewed-by: Donald Hunter --- tools/net/ynl/pyynl/ynl_gen_c.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen= _c.py index c7fb8abfd65e5d7bdd0ee705aed65f9262431880..101d8ba9626f238a82cddd0bbc1= 0bb4399e2ab22 100755 --- a/tools/net/ynl/pyynl/ynl_gen_c.py +++ b/tools/net/ynl/pyynl/ynl_gen_c.py @@ -638,7 +638,7 @@ class TypeBitfield32(Type): return '.type =3D YNL_PT_BITFIELD32, ' =20 def _attr_policy(self, policy): - if not 'enum' in self.attr: + if 'enum' not in self.attr: raise Exception('Enum required for bitfield32 attr') enum =3D self.family.consts[self.attr['enum']] mask =3D enum.get_mask(as_flags=3DTrue) --=20 2.51.0