Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2494197rbb; Wed, 28 Feb 2024 03:49:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVOA2o590NDA4kCwOI8IAey7a2nky6vibRZXteyO3scePa2Xj9JPGluJT4IH35Sj8uesMKgocYg7Es6df7+gOZFnY7YMYiE6KYPItvPfg== X-Google-Smtp-Source: AGHT+IElPVVyyj1glGiA/zcNwL1VBDpKOhXPP/C+EJJQWLYZibaxmGd/PdpHIy7+jmoGwNj1cHon X-Received: by 2002:a17:906:378b:b0:a44:55d:e7f7 with SMTP id n11-20020a170906378b00b00a44055de7f7mr951166ejc.24.1709120941392; Wed, 28 Feb 2024 03:49:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709120941; cv=pass; d=google.com; s=arc-20160816; b=uoo4AUGnozO/gZ+PG+p+Wg2Oi0fmBOOCc9RzeGUedLvk8aH3ouKpb9OUBu3bDxV1q7 mo21s8sGAkeKj+wHJNdribwaEqTVEf7+QzUDuk9bk5weThk1lM348mQWasH5IkBZItNb Qu4MjVAoG9YKbTk9a3zk16UyAHHvb/dwY7IsmcDVfxL8B7XL54iX8lvv0WLNbZvSf7q7 FJoWqClV2Fr9rgGZo1wMrvUtjINqp2Oj/QQAmM9KcFAOY5p1Akp4+KkzMNnJIEajjCsh jaozm7KQrV4gKojOjIQEoPCt02LI0gGSkcilpAMUsi8sgXbrsk6zNbU3FYV63Pvr7ubv ecxg== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84946-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id y19-20020a1709063a9300b00a3f84e8ba8bsi1670563ejd.213.2024.02.28.03.49.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:49:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84946-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84946-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 2B54A1F2146B for ; Wed, 28 Feb 2024 11:49:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A81D36CDDB; Wed, 28 Feb 2024 11:47:47 +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=20Maincent?= , Jesse Brandeburg , Jonathan Corbet , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Piergiorgio Beruto , Oleksij Rempel , =?UTF-8?q?Nicol=C3=B2=20Veronese?= , 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 Content-Transfer-Encoding: 8bit X-GND-Sasl: maxime.chevallier@bootlin.com 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) -- 2.43.2