Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp603507rdb; Fri, 17 Nov 2023 07:40:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IG4Xh5851EyX18X/dgILJHgdqUiC0MVw65CbNClE+qUuVEe5w2msyirBAzeJlmgSrMTerln X-Received: by 2002:a05:6a21:328e:b0:187:a4df:4e4e with SMTP id yt14-20020a056a21328e00b00187a4df4e4emr6849645pzb.28.1700235633899; Fri, 17 Nov 2023 07:40:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700235633; cv=none; d=google.com; s=arc-20160816; b=yZ8Iie6SX4uVQibGBq5IXj8jxGGrTlP1Eg1gLxOFJhFLrJK8ZjMe0vD42ne8Itq6zN LybmgA4kfbnE0U1OOHI6fGFy9vF0Fv45Jy1m4YFCBoCsuHjlh8cvPJ5mm+cnz/SZC1Hp nxpiTffXmZy18Uk/MKlSRq55M+lLdvrhxwsScz/hvGpwLIZa+q7AFtRX18XGxpueUINi mq2qwCfsM+Rac3vtATXB0XR+nu5sqonjsfN/HOTUDCSkaIMcYatgYOF3fG1LYoh3e1eZ Z0NSAKCg4/Ass1Da7noSdOeHCditHDt6/t9YlD42uSeNRBzw4+MGTp+n+21psYdlQkoU iiTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cc5FJffdyRYgh63tOCyG9vrWU+jsbhy/LpYTiz7ix4o=; fh=1WRQxG55ASsvt/9NxVDhUbJ1aQecLyVglFoTAx66NyA=; b=LSjydvmXIicOfWG7prBnjkfReFp8ioz7hg+xZs+YrqFS2xdpGeOEk515p8oFgqIRnI OVw/gQYRdWTz5HuZgUzlUOeQWLI9U01pE7sAMD19IrEVYRMvy8cGKS5h4Dm4YqvKPwLG hhDvwhWh4q8LcnAVKEFJ5u8J7q8wq5ScEaoRFIItIdbLTuCv6gUshxhZSjfAKaBB0/PT sR/b/r0b8Ps8IAR3gmu4llgF+Lqc84sc0TR3Dv2sChPoLgjPP7Qq1Q/SI+AAzTC5BLXV OXhWhFrQHY3pb/q1QVRW+dUw0m/VmR3NBGB4ENEbGMoE3x5LmomSbxVyvhgXNyPOtIkp W5Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="NpnZ7o/U"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id j4-20020a63cf04000000b005be10674e53si2066216pgg.479.2023.11.17.07.40.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 07:40:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="NpnZ7o/U"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B6BD68274AD2; Fri, 17 Nov 2023 07:40:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345993AbjKQPk3 (ORCPT + 99 others); Fri, 17 Nov 2023 10:40:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231392AbjKQPkY (ORCPT ); Fri, 17 Nov 2023 10:40:24 -0500 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7674D6D; Fri, 17 Nov 2023 07:40:20 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 6ECE51BF20B; Fri, 17 Nov 2023 15:40:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1700235619; 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=cc5FJffdyRYgh63tOCyG9vrWU+jsbhy/LpYTiz7ix4o=; b=NpnZ7o/Ue4VbtiufsHK0X3dEfoRl59knm2x54B97u2rGVDKgtTgPY7Wj7embBpZnXkqsuM HO0CBfjez7iAFGgFjpFtGPeE0SR9goVufQSdwGUPFA6gArTMhKOAIt48VNqV0ZjDGq07IP JeQPZ0KvxWVB1pvbkjvYPOm287kDzYPDkJ/ujTZDm+o32KzXJyxqIDl4PXftNfgNhsKCjo 8YIWjB39v2V+68j8UoV0IE/t4KflUGO5xNUbDTaGq4u7OImeAhEkqo9Oj1iYEIl4cehHQV yKRhZzwyYvlfg5+YjgFYVrYIKpTxi75rT/Je68CvusWFmcrZy+w4tUy+lH2iZA== 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 Subject: [RFC PATCH net-next v2 02/10] net: sfp: pass the phy_device when disconnecting an sfp module's PHY Date: Fri, 17 Nov 2023 17:23:13 +0100 Message-ID: <20231117162323.626979-3-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231117162323.626979-1-maxime.chevallier@bootlin.com> References: <20231117162323.626979-1-maxime.chevallier@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: maxime.chevallier@bootlin.com X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 17 Nov 2023 07:40:32 -0800 (PST) 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 --- 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 6712883498bb..2abb56c3bff0 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -3310,7 +3310,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 208a9393c2df..f42e9a082935 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.41.0