Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1167741rdb; Fri, 1 Dec 2023 08:37:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGOi9T9ozI7UO9bh+DSHYZ9NT9gOvAqKErrj3FBYoDT10dG4VUJw0j1qb9ZubaZ0MX2qKSM X-Received: by 2002:a17:90b:3143:b0:285:ad29:409f with SMTP id ip3-20020a17090b314300b00285ad29409fmr19596260pjb.30.1701448648250; Fri, 01 Dec 2023 08:37:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701448648; cv=none; d=google.com; s=arc-20160816; b=1HZ89sm7up1wDBrClL0+1m5CfdUvvYPgUoVFAPZbUlh2wWzEc7TY3bKFG88JRanmLa kqSxhFvC2N7tmtrDnt0INYERn3W4134Kqo/4KFCpD9iAip9r2DwZ/fiYJxLNc0poCr3U ud1FzxySzdtql/8oC/NAVXjc9AlOR768pXPFLFYyHj9rE6vTZMUVzM3dyPp38GWU+QX+ 6MNaBOvADO8AaI229+5H3jq5MYc7cJ0ZImIih9r5SrR4VIL4kV439U1XPd/ENXVFta6b 8X1paexch3WhnYD0+REatM73TeJmsgLwcc4SWuh4p6zVZWE1SF/GcflGzkjvZ6qWMzHL rIRQ== 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=lHDZfNw32Cu/7HGNJf2PAJcLVsMIJGgKgWqUxlmjNrE=; fh=01/i7K9ues3Vkkz8uyECvnCPITXmGs/30yOh5FbyFgY=; b=XCaOZiFemIDxmF4R+Qs/IMYyImj6jRkgGtMb21fA3jYYXu9IMcxbXvG/p9EhNoYeLE uS9lkGRUiPGVV6Z3S+WuyQty0a/BTe7ea3sdZ81wos3KeaAFT4m5buBHJ4fYd8e22YtO QjsFyvUUShyBT4sY/p2wsq7Eq/S3KagzaHkA0TTP/Ny2A0m9OaD2Gf9M6+w+xSdwH2T8 pN3cPIZkXdF7NeYbRffneHV/wjDBrgBqSxqOox8dEAZu4JCZ9hrPe7r4djp80CP90+f6 0RAt0EaXTpWslU5WuE6NRgj/69wqJe2MSL9JmejXJqDtE721pXDyL5F+OYX4VQ1RK3dc z/oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ga6NHPE1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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. [23.128.96.37]) by mx.google.com with ESMTPS id lb12-20020a17090b4a4c00b002864ee5aadasi2415362pjb.186.2023.12.01.08.37.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 08:37:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ga6NHPE1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 9163F80E8790; Fri, 1 Dec 2023 08:37:24 -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 S1378444AbjLAQhM (ORCPT + 99 others); Fri, 1 Dec 2023 11:37:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230089AbjLAQhG (ORCPT ); Fri, 1 Dec 2023 11:37:06 -0500 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60924FF; Fri, 1 Dec 2023 08:37:12 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id B5BF8C0002; Fri, 1 Dec 2023 16:37:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1701448630; 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=lHDZfNw32Cu/7HGNJf2PAJcLVsMIJGgKgWqUxlmjNrE=; b=ga6NHPE151pjq/wQ80fA0OzrdmfwqdFlY10KdQw3Rsh1ijfwTHC6AhuLAqyJq9iXLFbYki P79rhs6HJ3NqqK67JcivWjQV0CNaMYOQ4eTboU8UY8dR0t8kwevdC8EnyjG5qZSQ11alcJ 1mOwTdP5puRKSObiE/VAhqumPSgJy5TEwigCDkfhVpqOuX+dx3ec6mc34wszrVJQuu7I1o j6t4tF58OuaXxqYy1ZqwZKmtEqwnk8yTEKanVpOfGCMX+NQaCOxABXCiAMxN0EeBzVE8gL Unh9Ss6+WNnJ7fqxKs/4QCFHNi5MS8mkkyn03Nt/QBIn7P5euNYl8NPeYAxCcQ== 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?= Subject: [RFC PATCH net-next v3 02/13] net: sfp: pass the phy_device when disconnecting an sfp module's PHY Date: Fri, 1 Dec 2023 17:36:52 +0100 Message-ID: <20231201163704.1306431-3-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231201163704.1306431-1-maxime.chevallier@bootlin.com> References: <20231201163704.1306431-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 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, 01 Dec 2023 08:37:24 -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 --- 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 c276f9482f78..788785335fca 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -3309,7 +3309,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 6fa679b36290..3a86c41e1235 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.42.0