Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (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 71C483101B8 for ; Fri, 7 Nov 2025 08:29:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762504179; cv=none; b=W45PqBBcwB6VYzaKT71IMeWS5MWy0VscAXTxZ3z6eTq0QDQB18jjLJbUxArMSyizh8ZOfXL/1e+xXwH0QOtbN4/isZGF8w+qP9qBoAzq7KMAILLiFeDlDG0krpQ7QpsMC8xm32Oz3WII+lyale28IojlPWoVdDyEB/L+WceLtH4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762504179; c=relaxed/simple; bh=LoKsms1zSbOzPrrwFqiIKPUPSWzFdnaf5hSNV34iyyk=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=eSZQNsK6XVOMWECVZskWsENUXmkR0WPYCByUttlLHzyH+rl5T93/jQO2mwFGQr9THKNax5crMxD87SD7Z7fQErqlF3lusB4iwch/M7XRko/s1E2e+qDZiKVS9r4A54LuyRLajzb5iP3mUMnM2ToZ+oG5s9f5YIViXws0FhpCGeM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=N2EDNrYy; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="N2EDNrYy" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=6b2Jeag/15waNFP16mPLz7zFFYTMVqMxpfra85ewdwk=; b=N2EDNrYyhg0H3Yv2T5jPC1mMNh YAIeb+w4j06Kb0t1XN+W6BPwAc6NdgLITQjPiTDxj9rhKSs5u9BQWbAvcW+2E+ShCTkCTaZXoJyce ZYC8Jz+FEw2wqav8zHC4pjsPuosP7hVYvylRF4rMBBQfdwdJA2gvKIsoAykqkL2nFB8R7HRgUyqQC w40SPqg9HXXtCTFuApRdvcB1QKe5MIl6jqLRFmDMPJwP8DqqbnzkaSYYMpMSppTJ1ut+03ZLfG4Yn nSBm8mW+flfvZV7hAntpanIqYVAYmuBR1W5B/shu2sYO/Dqwol7z5aRCLoQFL3dz6PNrxqS7VeLZL JSUxWELg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:33948 helo=rmk-PC.armlinux.org.uk) 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 1vHHqa-000000006Bi-0VZP; Fri, 07 Nov 2025 08:29:28 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.98.2) (envelope-from ) id 1vHHqY-0000000Djrn-1D6H; Fri, 07 Nov 2025 08:29:26 +0000 In-Reply-To: References: 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 Subject: [PATCH net-next v3 11/11] net: stmmac: ingenic: use ->set_phy_intf_sel() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Fri, 07 Nov 2025 08:29:26 +0000 Rather than placing the phy_intf_sel() setup in the ->init() method, move it to the new ->set_phy_intf_sel() method. Signed-off-by: Russell King (Oracle) --- v3: fix Smatch warning: phy_intf_sel is unsigned and thus cannot be negative --- .../ethernet/stmicro/stmmac/dwmac-ingenic.c | 33 +++++++------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c index 41a2071262bc..8e4a30c11db0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c @@ -134,32 +134,21 @@ static int x2000_mac_set_mode(struct ingenic_mac *mac, u8 phy_intf_sel) return regmap_update_bits(mac->regmap, 0, mac->soc_info->mask, val); } -static int ingenic_mac_init(struct platform_device *pdev, void *bsp_priv) +static int ingenic_set_phy_intf_sel(void *bsp_priv, u8 phy_intf_sel) { struct ingenic_mac *mac = bsp_priv; - phy_interface_t interface; - int phy_intf_sel, ret; - - if (mac->soc_info->set_mode) { - interface = mac->plat_dat->phy_interface; - - phy_intf_sel = stmmac_get_phy_intf_sel(interface); - if (phy_intf_sel < 0 || phy_intf_sel >= BITS_PER_BYTE || - ~mac->soc_info->valid_phy_intf_sel & BIT(phy_intf_sel)) { - dev_err(mac->dev, "unsupported interface %s\n", - phy_modes(interface)); - return phy_intf_sel < 0 ? phy_intf_sel : -EINVAL; - } - dev_dbg(mac->dev, "MAC PHY control register: interface %s\n", - phy_modes(interface)); + if (!mac->soc_info->set_mode) + return 0; - ret = mac->soc_info->set_mode(mac, phy_intf_sel); - if (ret) - return ret; - } + if (phy_intf_sel >= BITS_PER_BYTE || + ~mac->soc_info->valid_phy_intf_sel & BIT(phy_intf_sel)) + return -EINVAL; + + dev_dbg(mac->dev, "MAC PHY control register: interface %s\n", + phy_modes(mac->plat_dat->phy_interface)); - return 0; + return mac->soc_info->set_mode(mac, phy_intf_sel); } static int ingenic_mac_probe(struct platform_device *pdev) @@ -221,7 +210,7 @@ static int ingenic_mac_probe(struct platform_device *pdev) mac->plat_dat = plat_dat; plat_dat->bsp_priv = mac; - plat_dat->init = ingenic_mac_init; + plat_dat->set_phy_intf_sel = ingenic_set_phy_intf_sel; return devm_stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res); } -- 2.47.3