From patchwork Tue Apr 15 19:33:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 14052634 X-Patchwork-Delegate: kuba@kernel.org Received: from out-189.mta0.migadu.com (out-189.mta0.migadu.com [91.218.175.189]) (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 8AC2B1E7C24 for ; Tue, 15 Apr 2025 19:33:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.189 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744745640; cv=none; b=QcYlmJXcXIX7tMle4Igy9GTYneOup8zzmo+8jGJF3WV9JMfsKwkr8s9nVg6Ag7Ve5cjqSiPw5rba8NUXJ5EqFPtOdPaTXwcXik6g6pyC8eQBip8dNoai8198NAGw4hnEZ4v6aKm+8Mi+U2SkEeCHLQi6e6v1H2n4fhPnhm27yfc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744745640; c=relaxed/simple; bh=AYs9sb2jpRkrqVSUaYHZtZtG17g+crrhBSqnGzQ0jiA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fqLRqfPgfsanMFaNJvYzswnyuCDQVLGxAK2IXg0sJloe8Eyx9r21yt6q5TaKXWSaffMa8AH/8fwEj//xvJcI2Vj/UFWFw5PSk5Tsw8Wvao6hldIAzHYKgUkKsHkR+Tt+/08LiztgHAH9/vcVBwXeLUagXEVkvpnmcgowWunKyMo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=lIR40FMN; arc=none smtp.client-ip=91.218.175.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="lIR40FMN" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1744745634; 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=BxMwV7M7yCVNxDE74IL+lkfkBhZWomk4wxk+8wLGLZE=; b=lIR40FMNTGyBOiCOIZ23VekZaD0/WG0uWw2BQG67dq3+aTs3jyzZ/dyXuPolUdSfpeX37K s8CUHMDRzBuNrNQGGKtxW1RUHuRZovT+b1nHxk0wVIVI9OwoDeI0HJJdTC1v16sAP1/Lay 2NFR3Zccdp+SI60fEvzt3n3pkK2tipY= From: Sean Anderson To: netdev@vger.kernel.org, Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King Cc: upstream@airoha.com, Christian Marangi , linux-kernel@vger.kernel.org, Kory Maincent , Heiner Kallweit , Sean Anderson Subject: [net-next PATCH v3 06/11] net: phy: Export some functions Date: Tue, 15 Apr 2025 15:33:18 -0400 Message-Id: <20250415193323.2794214-7-sean.anderson@linux.dev> In-Reply-To: <20250415193323.2794214-1-sean.anderson@linux.dev> References: <20250415193323.2794214-1-sean.anderson@linux.dev> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Patchwork-Delegate: kuba@kernel.org Export a few functions so they can be used outside the phy subsystem: get_phy_c22_id is useful when probing MDIO devices which present a phy-like interface despite not using the Linux ethernet phy subsystem. mdio_device_bus_match is useful when creating MDIO devices manually (e.g. on non-devicetree platforms). At the moment the only (future) user of these functions selects PHYLIB, so we do not need fallbacks for when CONFIG_PHYLIB=n. Signed-off-by: Sean Anderson --- (no changes since v1) drivers/net/phy/mdio_device.c | 1 + drivers/net/phy/phy_device.c | 3 ++- include/linux/phy.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/mdio_device.c b/drivers/net/phy/mdio_device.c index e747ee63c665..cce3f405d1a4 100644 --- a/drivers/net/phy/mdio_device.c +++ b/drivers/net/phy/mdio_device.c @@ -45,6 +45,7 @@ int mdio_device_bus_match(struct device *dev, const struct device_driver *drv) return strcmp(mdiodev->modalias, drv->name) == 0; } +EXPORT_SYMBOL_GPL(mdio_device_bus_match); struct mdio_device *mdio_device_create(struct mii_bus *bus, int addr) { diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index cc6c209fe702..7548a274bcdb 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -899,7 +899,7 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr, * valid, %-EIO on bus access error, or %-ENODEV if no device responds * or invalid ID. */ -static int get_phy_c22_id(struct mii_bus *bus, int addr, u32 *phy_id) +int get_phy_c22_id(struct mii_bus *bus, int addr, u32 *phy_id) { int phy_reg; @@ -927,6 +927,7 @@ static int get_phy_c22_id(struct mii_bus *bus, int addr, u32 *phy_id) return 0; } +EXPORT_SYMBOL_GPL(get_phy_c22_id); /* Extract the phy ID from the compatible string of the form * ethernet-phy-idAAAA.BBBB. diff --git a/include/linux/phy.h b/include/linux/phy.h index fb755358d965..512ed1be4ec1 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1754,6 +1754,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, bool is_c45, struct phy_c45_device_ids *c45_ids); #if IS_ENABLED(CONFIG_PHYLIB) +int get_phy_c22_id(struct mii_bus *bus, int addr, u32 *phy_id); int fwnode_get_phy_id(struct fwnode_handle *fwnode, u32 *phy_id); struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode); struct phy_device *fwnode_phy_find_device(struct fwnode_handle *phy_fwnode);