netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sean Anderson <sean.anderson@linux.dev>
To: netdev@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Russell King <linux@armlinux.org.uk>
Cc: upstream@airoha.com, Christian Marangi <ansuelsmth@gmail.com>,
	linux-kernel@vger.kernel.org,
	Kory Maincent <kory.maincent@bootlin.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Sean Anderson <sean.anderson@linux.dev>
Subject: [net-next PATCH v3 06/11] net: phy: Export some functions
Date: Tue, 15 Apr 2025 15:33:18 -0400	[thread overview]
Message-ID: <20250415193323.2794214-7-sean.anderson@linux.dev> (raw)
In-Reply-To: <20250415193323.2794214-1-sean.anderson@linux.dev>

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 <sean.anderson@linux.dev>
---

(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);
-- 
2.35.1.1320.gc452695387.dirty


  parent reply	other threads:[~2025-04-15 19:33 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-15 19:33 [net-next PATCH v3 00/11] Add PCS core support Sean Anderson
2025-04-15 19:33 ` [net-next PATCH v3 01/11] dt-bindings: net: Add Xilinx PCS Sean Anderson
2025-04-15 19:33 ` [net-next PATCH v3 02/11] net: phylink: Support setting PCS link change callbacks Sean Anderson
2025-04-15 19:33 ` [net-next PATCH v3 03/11] net: pcs: Add subsystem Sean Anderson
2025-04-15 20:02   ` Sean Anderson
2025-04-17  8:35   ` Simon Horman
2025-04-17 14:56     ` Sean Anderson
2025-04-17  9:19   ` Simon Horman
2025-04-17 15:05     ` Sean Anderson
2025-04-18  9:47       ` Simon Horman
2025-04-15 19:33 ` [net-next PATCH v3 04/11] net: dsa: ocelot: suppress PHY device scanning on the internal MDIO bus Sean Anderson
2025-04-15 19:33 ` [net-next PATCH v3 05/11] net: pcs: lynx: Convert to an MDIO driver Sean Anderson
2025-05-06 21:58   ` Vladimir Oltean
2025-05-06 22:03     ` Sean Anderson
2025-05-06 22:18       ` Vladimir Oltean
2025-05-06 22:20         ` Sean Anderson
2025-05-06 22:29           ` Vladimir Oltean
2025-05-06 22:39             ` Sean Anderson
2025-05-07  0:19               ` Andrew Lunn
2025-05-08 15:57                 ` Sean Anderson
2025-05-07 15:04               ` Vladimir Oltean
2025-05-06 23:56         ` Daniel Golle
2025-05-07 14:02           ` Vladimir Oltean
2025-04-15 19:33 ` Sean Anderson [this message]
2025-04-15 19:33 ` [net-next PATCH v3 07/11] net: pcs: Add Xilinx PCS driver Sean Anderson
2025-04-15 19:33 ` [net-next PATCH v3 08/11] net: axienet: Convert to use PCS subsystem Sean Anderson
2025-04-18  9:04   ` Gupta, Suraj
2025-04-15 19:33 ` [net-next PATCH v3 09/11] net: macb: Move most of mac_config to mac_prepare Sean Anderson
2025-04-15 19:35 ` [net-next PATCH v3 10/11] net: macb: Support external PCSs Sean Anderson
2025-04-15 19:35   ` [net-next PATCH v3 11/11] of: property: Add device link support for PCS Sean Anderson
2025-04-17 12:25 ` [net-next PATCH v3 00/11] Add PCS core support Russell King (Oracle)
2025-04-17 14:22   ` Sean Anderson
2025-04-17 15:24     ` Russell King (Oracle)
2025-04-17 15:29       ` Sean Anderson
2025-05-02 17:41         ` Sean Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250415193323.2794214-7-sean.anderson@linux.dev \
    --to=sean.anderson@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=ansuelsmth@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kory.maincent@bootlin.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=upstream@airoha.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).