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 BE68118A921 for ; Wed, 5 Nov 2025 13:27:14 +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=1762349236; cv=none; b=fHy0yICSoPiqO+OlxvaOn5/kb4MXH6JqgxCH0F2D2UI5MhoeCNs1u1+8Vq2LopANPkGf83BrJn/1IQFpyN0R53jlnKbWcl6dPtjRuT2+WF1H/Sp69Fe1zGY8WLagMuCfXEpffI/K1UsIRhWInZyBljxxnjjTYPIJY5qbwB5VK9k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762349236; c=relaxed/simple; bh=noTv7YGohQ+XncmnFRmPc6Ga5Egyfd6iP5ixfbUNiTs=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=AjTjY9twXZXXU224zkYrZFIVL610YmaHoDZXmjg1Ux+67satImpPjHlgaWYMpm40/N1Nhl36Zvd10kSkDj1V0JpPUNDJMqRakPaqeoGeqKk2+izwtJ2iE1qpvQukFWwXb1x6HpGPQHlzdoqJ1f3KH/FYVIFEjBRRQXAyZXsGdRs= 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=S60fujAc; 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="S60fujAc" 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=xj/bA4YiE91gjTI/ZRKfRaV6kuiSzvsAX6um4VA4U2I=; b=S60fujAcZUB3o8B/3JwWbng5Ac OGMmz2mA+igVyVhFGhhcZDjeaxMaHqXf208AEWWpglvfZISB/jZRephM8/7akCPceFFXQgP7pdps1 17Jq7xrsaAHwmXpEYfSviyQCC7MvaNN1nr/au4QKW6oPPhazHeLQ3lGnIvG8sxTqGVEwbesm3nf+J S3SL0CDSAqzxisQ1smA8Br2Snx14lqHePg4WU/z/9WMn9Qpub3iURDpxT5zDEcYdLqK2OdMFUV3ti NPAyeZTbhviYg5yOc2Zm+8t5RNx9oKvmiCeBf77dW+0UtaYsZfANCvpGVhYiT3hD9vQvhA26FLmYQ Mxp7FE+g==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:50744 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 1vGdXV-000000003Ui-1Gpg; Wed, 05 Nov 2025 13:27:05 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.98.2) (envelope-from ) id 1vGdXU-0000000CloN-0lOu; Wed, 05 Nov 2025 13:27:04 +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 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: Wed, 05 Nov 2025 13:27:04 +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) --- .../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 5ea26ee8e9d8..28548d0000ae 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 phy_intf_sel < 0 ? phy_intf_sel : -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