From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DBBD6CCD1A5 for ; Fri, 24 Oct 2025 12:48:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=7rI/yMDgYjHcfeP17fsZHgiix20oaj8DY0JDBoecpkw=; b=fVSIQGGwAqFNN7pMQ5EBZyi+Tt hZZ5l/HIyQBa1gRwmrhTZ/jE0tAutwn6+mQjFRYOrucQHZC3ivibbPRDZ9d8dhH5OMWzd6XxYRuv1 RNAo0mG74ZQFirky3t4EIHjKgFDIXhTto321Vm7dhdTa1qe266t97cN6uZq+EONK7ywj2aZzmojXy /pwlbnBnHyeT5eOer9ephT8g+rmdwgNHQMNeRe+qEFdilFcLyS9dRkRSL66v7QrIJecU6TXAVha+l b8Ss2tdfI21exhr3emlyskr887WLDMp2zMAF1Oy7mvc4rSAaZWSjNSzh1N0N1/ytAB6aZinyd5op6 L8ztXRcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vCHDe-00000009PLa-2SwE; Fri, 24 Oct 2025 12:48:34 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vCHDb-00000009PL3-1miY for linux-arm-kernel@lists.infradead.org; Fri, 24 Oct 2025 12:48:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:Content-Type:MIME-Version: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=7rI/yMDgYjHcfeP17fsZHgiix20oaj8DY0JDBoecpkw=; b=V8T8aUufyxQXItLMUZSGXT1m7I 59tlrsFjBVvLywhZh2W4BEZuFSdf7AUGix8wfqtHKiWsd2lRzRT++NCnw6E8ZOjJ488dAG9pyHJjw Prmv4QZR/yY+Txzbvf0XU3lhllYsh6bSWL3PeyFKDX75YcTYZKtw/SQ0QeqBzrcoIWGHgDSfkUAoT lIAe4NTe2rAU1O1HN/dNcEoEo9OSUqGqYfw7zMlBdlaUZ26N+IEWh/H2T72OorVkKGBaRjidaG7dv I9V8UWHYFBKPsY6b0QEaTiuSbNqcMGSWnU/rA1ca21buld+RzMzbXtg3Lhthoug9HdmJefXwV06Si v+hayfnA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:58000) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vCHDV-000000007ZR-3YUy; Fri, 24 Oct 2025 13:48:25 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.98.2) (envelope-from ) id 1vCHDT-000000002iT-3FcP; Fri, 24 Oct 2025 13:48:23 +0100 Date: Fri, 24 Oct 2025 13:48:23 +0100 From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni , Richard Cochran Subject: [PATCH net-next 0/8] net: stmmac: hwif.c cleanups Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251024_054831_461271_11BBDB8B X-CRM114-Status: UNSURE ( 9.51 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, This series cleans up hwif.c: - move the reading of the version information out of stmmac_hwif_init() into its own function, stmmac_get_version(), storing the result in a new struct. - simplify stmmac_get_version(). - read the version register once, passing it to stmmac_get_id() and stmmac_get_dev_id(). - move stmmac_get_id() and stmmac_get_dev_id() into stmmac_get_version() - define version register fields and use FIELD_GET() to decode - start tackling the big loop in stmmac_hwif_init() - provide a function, stmmac_hwif_find(), which looks up the hwif entry, thus making a much smaller loop, which improves readability of this code. - change the use of '^' to '!=' when comparing the dev_id, which is what is really meant here. - reorganise the test after calling stmmac_hwif_init() so that we handle the error case in the indented code, and the success case with no indent, which is the classical arrangement. --- v2: - fix "verison" typo, impacting patches 2, 3, and 4. - added reviewed-by / tested-bys drivers/net/ethernet/stmicro/stmmac/common.h | 3 + drivers/net/ethernet/stmicro/stmmac/hwif.c | 166 +++++++++++++++------------ 2 files changed, 98 insertions(+), 71 deletions(-) -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!