From nobody Wed Dec 17 21:27:36 2025 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 5496620468C for ; Mon, 16 Dec 2024 12:09:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734350998; cv=none; b=eyQoVETKf7a5ZXGVmvFkdO2ZzjFvaaoR5DFZrknQ1opgDdsaLWpiSNF4gPpHwvibK1T1wgqgnlsHSaeMXkL+03Ia1YBVN5LlHwERDGqMoD1QzC9xynI8DhDPULF+7n9ntExy7DgX819+b1vUn8Php6ELvCyZQ06AWYCzhbhhw+0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734350998; c=relaxed/simple; bh=RzI4qsAHPERBhbBj0HS3GCFXD9+RssdnOGbClkUytIc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iHWE9Rl1MIRlJ0a1aB5qmf1xDkHV9T1DUg6Zhsiwx85IscDeZRpXJ1YQ1FV3A+/xWUmEHMXrig9LpstlGzsyRR1PuIcof1o27GB2sU2DAkySxDVMk0X5+8QP6gD/EzPHc4ZLUqTYHq5W4oiniftFzcoY8Q9y4Ozi8xxcD1cSAAc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tN9v1-0001C6-9G; Mon, 16 Dec 2024 13:09:47 +0100 Received: from dude04.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::ac]) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tN9uw-003h1l-2N; Mon, 16 Dec 2024 13:09:43 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1tN9ux-0075uK-1N; Mon, 16 Dec 2024 13:09:43 +0100 From: Oleksij Rempel To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Woojung Huh , Andrew Lunn Cc: Oleksij Rempel , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, UNGLinuxDriver@microchip.com, Phil Elwell Subject: [PATCH net-next v1 5/6] net: usb: lan78xx: remove PHY register access from ethtool get_regs Date: Mon, 16 Dec 2024 13:09:40 +0100 Message-Id: <20241216120941.1690908-6-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241216120941.1690908-1-o.rempel@pengutronix.de> References: <20241216120941.1690908-1-o.rempel@pengutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Remove PHY register handling from `lan78xx_get_regs` and `lan78xx_get_regs_len`. Since the controller can have different PHYs attached, the first 32 registers are not universally relevant or the most interesting. Simplify the implementation to focus on MAC and device registers. Signed-off-by: Oleksij Rempel --- drivers/net/usb/lan78xx.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index 78c75599b8f1..6c9dab290f3f 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -2096,10 +2096,7 @@ static int lan78xx_set_pause(struct net_device *net, =20 static int lan78xx_get_regs_len(struct net_device *netdev) { - if (!netdev->phydev) - return (sizeof(lan78xx_regs)); - else - return (sizeof(lan78xx_regs) + PHY_REG_SIZE); + return sizeof(lan78xx_regs); } =20 static void @@ -2109,7 +2106,7 @@ lan78xx_get_regs(struct net_device *netdev, struct et= htool_regs *regs, struct lan78xx_net *dev =3D netdev_priv(netdev); unsigned int data_count =3D 0; u32 *data =3D buf; - int i, j, ret; + int i, ret; =20 /* Read Device/MAC registers */ for (i =3D 0; i < ARRAY_SIZE(lan78xx_regs); i++) { @@ -2124,22 +2121,6 @@ lan78xx_get_regs(struct net_device *netdev, struct e= thtool_regs *regs, data_count++; } =20 - if (!netdev->phydev) - return; - - /* Read PHY registers */ - for (j =3D 0; j < 32; i++, j++) { - ret =3D phy_read(netdev->phydev, j); - if (ret < 0) { - netdev_warn(dev->net, - "failed to read PHY register 0x%02x\n", j); - goto clean_data; - } - - data[i] =3D ret; - data_count++; - } - return; =20 clean_data: --=20 2.39.5