From patchwork Wed Feb 28 11:47:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Chevallier X-Patchwork-Id: 207808 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3297376dyb; Wed, 28 Feb 2024 04:03:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWymX7CU8d9/MrnLiRO7t16TfLORYUtrxXhDUD6Eti29X568ucDF2aA1PHA8kyBoNkVk+v1Sculf/TL8PmGFyQjChmNZw== X-Google-Smtp-Source: AGHT+IGnD1XbAsqCuVBOYkQZRjD15vJSg1WaJERAIrV1dCrFHpvKoJ5IOGJub8NsKSlgDfKoR8OE X-Received: by 2002:aa7:8113:0:b0:6e3:b1b3:139f with SMTP id b19-20020aa78113000000b006e3b1b3139fmr10154807pfi.17.1709121803365; Wed, 28 Feb 2024 04:03:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709121803; cv=pass; d=google.com; s=arc-20160816; b=dPRb2cXp6+bQPNV9dWHdcgNo7EuCa6DiT1gY30FhSxPMtkTVbOdR2XavHZyBBJCY+P kbS4DkLGQO8CFP3srvAWMs6rs4uSCeKF+6+mpTagEOPif8kTuN6+SuEgYI60mHJsUcCO jrODY7eULdtAdvcLy+VET/KWHTEnImxvC1MDbUqNVS8JQVn6HyiUhDby9jHFFk8YBst6 ceLDwY+fY6tXRc5MNcnFxtdTz9AJ9AVsEdqESvp3wQnhpeBGdTSWmhM1hTmRshlnnujQ IZdaQAqOywALakzfMiIu1uMwRhXOOhVISBQOKV11O82T8fG0gO3G2hY7wH+mH4aaPPNb DStw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=jkKrHjLGj556pMw+p/8b4qL6uL86vAHDuHQrvW67AWQ=; fh=1vUu/d1GTjraph6G+ET+Z0z13QVrf6oL/IrrK9zaTF8=; b=xOpt1FfoDb7a+K+xQa88P79Dvce+dN2ctKkljpa9LqA0Rz/o+uZXQRM227Jz0wPV6C 0BDXbj5Jf39ERFpOU8gLGUzf2m56Gp6zFOyBhSv5kV9Yf5F5wnbMXjj5KY4RrxRRbEDw wVVhRG7ErShBactt4LFVySln1BgGMqNVb4N8tnxuo9dtCZoBzm2HwBxq8X6CPKNRg0sk Z9mcWue9m06gQpUkzAVD51f4lDoQgNWOEhMVyy9AFKHxiksbNHQoeIgRu3t4bN8U6mr5 PqSNe5SlUOyoOlQzCuBdHHrd5q+34O5j9RvX1zgsQHAyVniB+qpAyccjS+dD5+CG4b5a uHrg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=auDRhvWN; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-84946-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84946-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id bz30-20020a056a02061e00b005e43cb270e3si7475108pgb.610.2024.02.28.04.03.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 04:03:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84946-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=auDRhvWN; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-84946-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84946-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 451E8B24182 for ; Wed, 28 Feb 2024 11:50:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4BFDD13AA3D; Wed, 28 Feb 2024 11:47:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="auDRhvWN" Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (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 A867C73518; Wed, 28 Feb 2024 11:47:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709120866; cv=none; b=tVCfpp2M7zQ/WIAOqyzQtXt7Ejw+NQINupoJn5XEbxkacesWeUQdaNkEpMGMWjRu7i/M7l6NYCMg8eWyRVMV61MNn2UgstMWkavQUBwzlYzeD8fHImj9uzQOuMf4Z7jNlhwsD+8WVjmfIpF8knqZUmVlAHBDeRUHXOn7Mk2w4c0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709120866; c=relaxed/simple; bh=5SvRPw8yxzP88j6AEfOOKyWIHEfayCZCtRKV7tXmAfQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NoNtl3WWJu7C7zEzQF28AHFy9XYqe6otX7cKvE7M6MvyCghi6RUKFLmrQUrq00UH59MBvBpPTzGn97+vm8c2Qjz/grmf3YSSrimHxhUXf66+OKXvsjoKtlX/+mdSmSclMA55HXIMOZNKTx019xXpZhqJ9qpDYHPX9UbHn8nuCGM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=auDRhvWN; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 9119B1C000B; Wed, 28 Feb 2024 11:47:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709120856; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jkKrHjLGj556pMw+p/8b4qL6uL86vAHDuHQrvW67AWQ=; b=auDRhvWNNYJ2Yoj3HzAhycOTkxE/3hky+daxEmBqwmg/NE0SGKyyoVt0HQxfEQghXSBe+r IUr07iWesa1c7DFdMEUo0qUH5YdDGWj+3jVQP1IB0+pGtu2FYfervDAVuxH/3GuC3GqU2g OZzi96Oq2i2sPgs9L1AQskeO4h+V3Yij4jPi1TyYtsbU0ADUruraLZsI4PDb92EIzwqZ4Q /sTHj+L4FyBoDtm/o1Av7vkfjFjbFLpkCYWHKTVQ8jqmgizrwroPfC88g74qv5ZgdW8DaB jwx3TguXD/tN/K5fM9jfq0fWkjsQFmq785PSpsuxkS/EYQtCBq9wBQzVRHiuEA== From: Maxime Chevallier To: davem@davemloft.net Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Russell King , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Herve Codina , Florian Fainelli , Heiner Kallweit , Vladimir Oltean , =?utf-8?q?K=C3=B6ry_Maincent?= , Jesse Brandeburg , Jonathan Corbet , =?utf-8?q?Marek_Beh=C3=BAn?= , Piergiorgio Beruto , Oleksij Rempel , =?utf-8?q?Nicol=C3=B2_Veronese?= , Simon Horman , mwojtas@chromium.org Subject: [PATCH net-next v9 02/13] net: sfp: pass the phy_device when disconnecting an sfp module's PHY Date: Wed, 28 Feb 2024 12:47:16 +0100 Message-ID: <20240228114728.51861-3-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240228114728.51861-1-maxime.chevallier@bootlin.com> References: <20240228114728.51861-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-GND-Sasl: maxime.chevallier@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792144104080351212 X-GMAIL-MSGID: 1792144104080351212 Pass the phy_device as a parameter to the sfp upstream .disconnect_phy operation. This is preparatory work to help track phy devices across a net_device's link. Signed-off-by: Maxime Chevallier --- V9: No changes V8: No changes V7: No changes V6: Moved an incorrectly added hunk from the previous series to patch 0003 V5: No changes V4: No changes V3: No changes drivers/net/phy/phylink.c | 3 ++- drivers/net/phy/sfp-bus.c | 4 ++-- include/linux/sfp.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 503fd7c40523..8a34883eb99b 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -3385,7 +3385,8 @@ static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy) return ret; } -static void phylink_sfp_disconnect_phy(void *upstream) +static void phylink_sfp_disconnect_phy(void *upstream, + struct phy_device *phydev) { phylink_disconnect_phy(upstream); } diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c index db39dec7f247..e05013aeecc3 100644 --- a/drivers/net/phy/sfp-bus.c +++ b/drivers/net/phy/sfp-bus.c @@ -486,7 +486,7 @@ static void sfp_unregister_bus(struct sfp_bus *bus) bus->socket_ops->stop(bus->sfp); bus->socket_ops->detach(bus->sfp); if (bus->phydev && ops && ops->disconnect_phy) - ops->disconnect_phy(bus->upstream); + ops->disconnect_phy(bus->upstream, bus->phydev); } bus->registered = false; } @@ -742,7 +742,7 @@ void sfp_remove_phy(struct sfp_bus *bus) const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(bus); if (ops && ops->disconnect_phy) - ops->disconnect_phy(bus->upstream); + ops->disconnect_phy(bus->upstream, bus->phydev); bus->phydev = NULL; } EXPORT_SYMBOL_GPL(sfp_remove_phy); diff --git a/include/linux/sfp.h b/include/linux/sfp.h index 9346cd44814d..0573e53b0c11 100644 --- a/include/linux/sfp.h +++ b/include/linux/sfp.h @@ -544,7 +544,7 @@ struct sfp_upstream_ops { void (*link_down)(void *priv); void (*link_up)(void *priv); int (*connect_phy)(void *priv, struct phy_device *); - void (*disconnect_phy)(void *priv); + void (*disconnect_phy)(void *priv, struct phy_device *); }; #if IS_ENABLED(CONFIG_SFP)