AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/09/14 23:06 flow patch-triage
4m Args:
null

Results:
{
  "EnableConfigs": [
    "PHYLIB",
    "USB_NET_DRIVERS",
    "USB_USBNET",
    "USB_NET_AX8817X",
    "USB_NET_SMSC95XX"
  ],
  "FocusSymbols": [
    "phy_attach_direct",
    "phy_connect_direct",
    "phy_connect",
    "phy_probe",
    "phy_remove"
  ],
  "KMSANReasoning": "The patch adds a validation check `else if (!phydev-\u003edrv)` in `phy_attach_direct()` to prevent attaching to a PHY device whose underlying device driver (`d-\u003edriver`) is set but whose PHY driver pointer (`phydev-\u003edrv`) is NULL (which occurs during transient bind or unbind operations). Without this check, callers could attach to a PHY in an incomplete state and subsequently trigger NULL pointer dereferences when invoking driver callbacks via `phydev-\u003edrv`.\n\nThis change is purely control-flow and state-validation logic addressing race conditions and potential NULL pointer dereferences. It does not introduce, modify, or read any uninitialized stack or heap memory, nor does it affect buffers copied to user space. Therefore, KMSAN is not applicable, and standard bug detectors and KASAN are sufficient.",
  "NeedsKMSAN": false,
  "Reasoning": "The patch adds a defensive check in phy_attach_direct() returning -EBUSY when the device has a driver bound (or in progress) but phydev-\u003edrv is NULL (e.g. during bind/unbind transitions), preventing potential NULL pointer dereferences later in the function. The PHY subsystem is reachable in standard virtualized fuzzing environments via emulated USB Ethernet drivers such as smsc95xx or ax88172a (asix) as well as sysfs bind/unbind and device operations. Hence, the changes touch reachable executable code and warrant fuzzing.",
  "WorthFuzzing": true
}

1/1 2026/09/14 23:06 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit 0ca6eb7183eedad1bd175ed3055e7e6f810559cb\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Mon Sep 14 23:06:27 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c\nindex 94b2e85e00a37..044cefd9840bb 100644\n--- a/drivers/net/phy/phy_device.c\n+++ b/drivers/net/phy/phy_device.c\n@@ -1781,6 +1781,10 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,\n \t\t\td-\u003edriver = \u0026genphy_driver.mdiodrv.driver;\n \n \t\tphydev-\u003eis_genphy_driven = 1;\n+\t} else if (!phydev-\u003edrv) {\n+\t\t/* d-\u003edriver outlives phydev-\u003edrv on unbind, precedes it on bind */\n+\t\terr = -EBUSY;\n+\t\tgoto error_put_device;\n \t}\n \n \tif (!try_module_get(d-\u003edriver-\u003eowner)) {\n"
}

2/1 2026/09/14 23:06 agent patch-evaluator
3m Model:
core

Args:
null

Results:
{
  "EnableConfigs": [
    "PHYLIB",
    "USB_NET_DRIVERS",
    "USB_USBNET",
    "USB_NET_AX8817X",
    "USB_NET_SMSC95XX"
  ],
  "FocusSymbols": [
    "phy_attach_direct",
    "phy_connect_direct",
    "phy_connect",
    "phy_probe",
    "phy_remove"
  ],
  "Reasoning": "The patch adds a defensive check in phy_attach_direct() returning -EBUSY when the device has a driver bound (or in progress) but phydev-\u003edrv is NULL (e.g. during bind/unbind transitions), preventing potential NULL pointer dereferences later in the function. The PHY subsystem is reachable in standard virtualized fuzzing environments via emulated USB Ethernet drivers such as smsc95xx or ax88172a (asix) as well as sysfs bind/unbind and device operations. Hence, the changes touch reachable executable code and warrant fuzzing.",
  "WorthFuzzing": true
}

Instruction:
You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.

IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.

================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.

- REACHABILITY IS THE PRIMARY GATE:
  Fuzzing can only discover bugs in code that can actually execute in standard virtualized
  environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
  If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
  regardless of whether it adds assertions or complex logic.

- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
  Patch authors routinely label changes as "cleanups", "refactorings", or state
  "No functional change intended". Do NOT take these claims at face value.
  Code refactorings that rearrange logic, introduce helper functions, or alter state management
  in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
  If reachable executable code is modified or refactored, it MUST be fuzzed.

- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
  When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
  BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
  Even if the author believes the invariant always holds, fuzzing is essential to verify whether
  an unusual sequence of operations can violate it.

================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:

- Non-kernel and non-executable changes:
  * Modifications to Documentation/, comments, or spelling fixes.
  * User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
    that do not affect the compiled kernel image (vmlinux) or kernel modules.
  * Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
    that do not alter control flow or data structures.
  * Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
  * Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
    ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
  * Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
    physical PCI hot-unplug or manual sysfs driver unbinding.
  * Code paths exclusive to architectures other than the target architecture.

================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
  * Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
    BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
  * Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
  * Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
  * Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).

================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:

- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
  Do NOT list generic, ubiquitous functions called by almost every program in the corpus
  (including, but not limited to: general memory allocators and deallocators, page fault
  and trap handlers, or core synchronization primitives; this is not an exhaustive list).
  Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
  which severely dilutes fuzzing effort away from the actual changes.

- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
  List functions that specifically implement the logic being added or altered, or direct API entrypoints
  for the subsystem feature under review.

- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
  Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
  distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
  If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
  functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).

================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.


Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.

Prompt:
Target architecture: amd64

For your convenience, here is the diff of the changes:
commit 0ca6eb7183eedad1bd175ed3055e7e6f810559cb
Author: syz-cluster <triage@syzkaller.com>
Date:   Mon Sep 14 23:06:27 2026 +0000

    syz-cluster: applied patch under review

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 94b2e85e00a37..044cefd9840bb 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1781,6 +1781,10 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
 			d->driver = &genphy_driver.mdiodrv.driver;
 
 		phydev->is_genphy_driven = 1;
+	} else if (!phydev->drv) {
+		/* d->driver outlives phydev->drv on unbind, precedes it on bind */
+		err = -EBUSY;
+		goto error_put_device;
 	}
 
 	if (!try_module_get(d->driver->owner)) {

3/2 2026/09/14 23:06 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 2908
							output: 40
							thoughts: 308
						

Thoughts:
**Analyzing a Kernel Patch**

Okay, so I've been asked to review a patch for the kernel, specifically targeting `drivers/net/phy/phy_device.c`. My first instinct is to dive straight into the diff. Let's see... it looks like they're introducing a new check around line 1781. The code previously handled a situation where `d->driver` was assigned to `genphy_driver.mdiodrv.driver` when the PHY device was a generic PHY.  Now, the added `else if (!phydev->drv)` block is the new point of interest.

Hmm, this `!phydev->drv` check is interesting. It seems like the intention is to prevent a potential race condition or resource conflict. Let me interpret...If `phydev->drv` isn't assigned, there's a problem, and the code now returns an `EBUSY` error. So, basically, if there's no driver associated with the PHY device when we reach this point, that's considered an error. The comment hints at unbinding/binding of drivers – making sure `d->driver` doesn't outlive `phydev->drv`. Let's get a bigger picture of the context around this area by using `read-file` around line 1781 in the specified file. I need to understand what's happening just before and after this point. I'll need to confirm that this added error handling is correct, and doesn't introduce any new regressions. I'll also check to see if there is any discussion on the mailing lists. I am also checking to see if there is any mention of this patch in the relevant changelogs.



4/2 2026/09/14 23:06 tool read-file
0m Args:
{
  "File": "drivers/net/phy/phy_device.c",
  "FirstLine": 1760,
  "LineCount": 50
}

Results:
{
  "Contents": "1760:\t\t/* For Ethernet device drivers that register their own MDIO bus, we\n1761:\t\t * will have bus-\u003eowner match ndev_mod, so we do not want to increment\n1762:\t\t * our own module-\u003erefcnt here, otherwise we would not be able to\n1763:\t\t * unload later on.\n1764:\t\t */\n1765:\t\tif (dev)\n1766:\t\t\tndev_owner = dev-\u003edev.parent-\u003edriver-\u003eowner;\n1767:\t\tif (ndev_owner != bus-\u003eowner \u0026\u0026 !try_module_get(bus-\u003eowner)) {\n1768:\t\t\tphydev_err(phydev, \"failed to get the bus module\\n\");\n1769:\t\t\treturn -EIO;\n1770:\t\t}\n1771:\t\n1772:\t\tget_device(d);\n1773:\t\n1774:\t\t/* Assume that if there is no driver, that it doesn't\n1775:\t\t * exist, and we should use the genphy driver.\n1776:\t\t */\n1777:\t\tif (!d-\u003edriver) {\n1778:\t\t\tif (phydev-\u003eis_c45)\n1779:\t\t\t\td-\u003edriver = \u0026genphy_c45_driver.mdiodrv.driver;\n1780:\t\t\telse\n1781:\t\t\t\td-\u003edriver = \u0026genphy_driver.mdiodrv.driver;\n1782:\t\n1783:\t\t\tphydev-\u003eis_genphy_driven = 1;\n1784:\t\t} else if (!phydev-\u003edrv) {\n1785:\t\t\t/* d-\u003edriver outlives phydev-\u003edrv on unbind, precedes it on bind */\n1786:\t\t\terr = -EBUSY;\n1787:\t\t\tgoto error_put_device;\n1788:\t\t}\n1789:\t\n1790:\t\tif (!try_module_get(d-\u003edriver-\u003eowner)) {\n1791:\t\t\tphydev_err(phydev, \"failed to get the device driver module\\n\");\n1792:\t\t\terr = -EIO;\n1793:\t\t\tgoto error_put_device;\n1794:\t\t}\n1795:\t\n1796:\t\tif (phydev-\u003eis_genphy_driven) {\n1797:\t\t\terr = d-\u003edriver-\u003eprobe(d);\n1798:\t\t\tif (err \u003e= 0)\n1799:\t\t\t\terr = device_bind_driver(d);\n1800:\t\n1801:\t\t\tif (err)\n1802:\t\t\t\tgoto error_module_put;\n1803:\t\t}\n1804:\t\n1805:\t\tif (phydev-\u003eattached_dev) {\n1806:\t\t\tdev_err(\u0026dev-\u003edev, \"PHY already attached\\n\");\n1807:\t\t\terr = -EBUSY;\n1808:\t\t\tgoto error;\n1809:\t\t}\n"
}

5/2 2026/09/14 23:06 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 4383
							output: 20
							thoughts: 22
						

Thoughts:
Here's my attempt at summarizing the thought process, tailored for an expert audience:

**Analyzing the Patch's Origins**

Okay, so I'm looking at this patch, and my first instinct is to dive straight into the git history. I want to understand the *why* behind this change. Specifically, I'm thinking, "Show me the git log. What commit does this patch relate to? What was the original issue this is trying to fix? Understanding the broader context of the changes will save time in reviewing. Knowing the surrounding changes helps to spot other unexpected changes in the patch. I need to understand this patch within its historical context before digging into the code itself.



6/2 2026/09/14 23:06 tool grepper
0m Args:
{
  "Expression": "outlives phydev-\u003edrv"
}

Results:
{
  "Output": "drivers/net/phy/phy_device.c=1752=int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,\n--\ndrivers/net/phy/phy_device.c-1784-\t} else if (!phydev-\u003edrv) {\ndrivers/net/phy/phy_device.c:1785:\t\t/* d-\u003edriver outlives phydev-\u003edrv on unbind, precedes it on bind */\ndrivers/net/phy/phy_device.c-1786-\t\terr = -EBUSY;\n"
}

7/2 2026/09/14 23:06 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 4713
							output: 19
							thoughts: 42
						

Thoughts:
**Tracing the Attachment Calls**

Okay, let's dive into this. My initial thought is to trace the callers of the `phy_attach_direct`, `phy_attach`, and `phy_connect` functions. I want to see the various points in the driver or networking stack where physical layer (PHY) devices are being attached and connected. Knowing these call paths is crucial for understanding the overall device initialization and management process. I'm particularly interested in the `phy_attach_direct` calls, so I'll prioritize checking where that one's being invoked first. This should illuminate any unique scenarios in how the PHY is being integrated.



8/2 2026/09/14 23:07 tool grepper
0m Args:
{
  "Expression": "phy_attach_direct"
}

Results:
{
  "Output": "Documentation/networking/phy-link-topology.rst=85=These function are already hooked into the phylib subsystem, so all PHYs that\nDocumentation/networking/phy-link-topology.rst:86:are linked to a net_device through :c:func:`phy_attach_direct` will automatically\nDocumentation/networking/phy-link-topology.rst-87-join the netdev's topology.\n--\nDocumentation/networking/sfp-phylink.rst=74=this documentation.\n--\nDocumentation/networking/sfp-phylink.rst-165-   For the most part, ``flags`` can be zero; these flags are passed to\nDocumentation/networking/sfp-phylink.rst:166:   the phy_attach_direct() inside this function call if a PHY is specified\nDocumentation/networking/sfp-phylink.rst-167-   in the DT node ``node``.\n--\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c=931=static int xgbe_phy_find_phy_device(struct xgbe_prv_data *pdata)\n--\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c-982-\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:983:\tret = phy_attach_direct(pdata-\u003enetdev, phydev, phydev-\u003edev_flags,\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c-984-\t\t\t\tPHY_INTERFACE_MODE_SGMII);\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c-985-\tif (ret) {\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:986:\t\tnetdev_err(pdata-\u003enetdev, \"phy_attach_direct failed\\n\");\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c-987-\t\tphy_device_remove(phydev);\n--\ndrivers/net/ethernet/hisilicon/hns/hns_enet.c=1159=int hns_nic_init_phy(struct net_device *ndev, struct hnae_handle *h)\n--\ndrivers/net/ethernet/hisilicon/hns/hns_enet.c-1180-\t} else {\ndrivers/net/ethernet/hisilicon/hns/hns_enet.c:1181:\t\tret = phy_attach_direct(ndev, phy_dev, 0, h-\u003ephy_if);\ndrivers/net/ethernet/hisilicon/hns/hns_enet.c-1182-\t}\n--\ndrivers/net/phy/phy_device.c=1225=int phy_connect_direct(struct net_device *dev, struct phy_device *phydev,\n--\ndrivers/net/phy/phy_device.c-1233-\ndrivers/net/phy/phy_device.c:1234:\trc = phy_attach_direct(dev, phydev, phydev-\u003edev_flags, interface);\ndrivers/net/phy/phy_device.c-1235-\tif (rc)\n--\ndrivers/net/phy/phy_device.c=1732=static bool phy_drv_supports_irq(const struct phy_driver *phydrv)\n--\ndrivers/net/phy/phy_device.c-1737-/**\ndrivers/net/phy/phy_device.c:1738: * phy_attach_direct - attach a network device to a given PHY device pointer\ndrivers/net/phy/phy_device.c-1739- * @dev: network device to attach\n--\ndrivers/net/phy/phy_device.c-1751- */\ndrivers/net/phy/phy_device.c:1752:int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,\ndrivers/net/phy/phy_device.c-1753-\t\t      u32 flags, phy_interface_t interface)\n--\ndrivers/net/phy/phy_device.c-1910-}\ndrivers/net/phy/phy_device.c:1911:EXPORT_SYMBOL(phy_attach_direct);\ndrivers/net/phy/phy_device.c-1912-\n--\ndrivers/net/phy/phy_device.c-1917- * This detaches the phy device from its network device and the phy\ndrivers/net/phy/phy_device.c:1918: * driver, and drops the reference count taken in phy_attach_direct().\ndrivers/net/phy/phy_device.c-1919- */\n--\ndrivers/net/phy/phylink.c=2205=static int phylink_attach_phy(struct phylink *pl, struct phy_device *phy,\n--\ndrivers/net/phy/phylink.c-2218-\ndrivers/net/phy/phylink.c:2219:\treturn phy_attach_direct(pl-\u003enetdev, phy, flags, interface);\ndrivers/net/phy/phylink.c-2220-}\n--\ndrivers/net/phy/phylink.c-2227- * Connect @phy to the phylink instance specified by @pl by calling\ndrivers/net/phy/phylink.c:2228: * phy_attach_direct(). Configure the @phy according to the MAC driver's\ndrivers/net/phy/phylink.c-2229- * capabilities, start the PHYLIB state machine and enable any interrupts\n--\ndrivers/net/phy/phylink.c=2289=int phylink_fwnode_phy_connect(struct phylink *pl,\n--\ndrivers/net/phy/phylink.c-2322-\ndrivers/net/phy/phylink.c:2323:\tret = phy_attach_direct(pl-\u003enetdev, phy_dev, flags,\ndrivers/net/phy/phylink.c-2324-\t\t\t\tpl-\u003elink_interface);\n--\ninclude/linux/phy.h=2169=struct phy_device *phy_find_next(struct mii_bus *bus, struct phy_device *pos);\ninclude/linux/phy.h:2170:int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,\ninclude/linux/phy.h-2171-\t\t      u32 flags, phy_interface_t interface);\n"
}

9/2 2026/09/14 23:07 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 6523
							output: 30
							thoughts: 134
						

Thoughts:
**My Investigation Begins**

Okay, here's what I'm thinking. I need to understand the path to `phy_attach_direct`. First, I know it resides in `drivers/net/phy/phy_device.c`. But how does a driver actually get to that point? I need to trace the call chain.

My initial approach will be to examine the callers. Specifically, I need to look for any instances of `phy_connect_direct`, `phy_connect`, or `phylink_connect_phy` being called. Those functions are the logical entry points, so they should reveal the upstream connections to the `phy_attach_direct` function.

Now, let's broaden the scope. I also need to consider virtual or emulated network devices. Are there any drivers interacting with phylib in that context, especially those using mechanisms other than direct hardware access? Think QEMU, virtio, maybe even USB. I'll need to expand my search to cover these possibilities.

So, I'll extend my search to any instances of `phy_connect`, `phy_attach`, and `phylink` across all drivers, including those related to virtual hardware. This should give me a complete picture of the potential routes that eventually lead to `phy_attach_direct`.



10/2 2026/09/14 23:07 tool grepper
0m Args:
{
  "Expression": "phy_connect\\(|phy_attach\\(|phy_connect_direct\\("
}

Results:
{
  "Output": "\nFull output is too long, showing 500 out of 1044 lines.\nUse more precise expression if possible.\n\nDocumentation/networking/device_drivers/ethernet/freescale/dpaa2/mac-phy-support.rst=80=will do the following:\n--\nDocumentation/networking/device_drivers/ethernet/freescale/dpaa2/mac-phy-support.rst-83- - will create a PHYLINK instance associated with the received net_device\nDocumentation/networking/device_drivers/ethernet/freescale/dpaa2/mac-phy-support.rst:84: - connect to the PHY using phylink_of_phy_connect()\nDocumentation/networking/device_drivers/ethernet/freescale/dpaa2/mac-phy-support.rst-85-\n--\nDocumentation/networking/dsa/dsa.rst=453=logic basically looks like this:\n--\nDocumentation/networking/dsa/dsa.rst-456-  \"phy-handle\" property, if found, this PHY device is created and registered\nDocumentation/networking/dsa/dsa.rst:457:  using ``of_phy_connect()``\nDocumentation/networking/dsa/dsa.rst-458-\n--\nDocumentation/networking/dsa/dsa.rst=511=DSA features a standardized binding which is documented in\nDocumentation/networking/dsa/dsa.rst-512-``Documentation/devicetree/bindings/net/dsa/dsa.yaml``. PHY/MDIO library helper\nDocumentation/networking/dsa/dsa.rst:513:functions such as ``of_get_phy_mode()``, ``of_phy_connect()`` are also used to query\nDocumentation/networking/dsa/dsa.rst-514-per-port PHY specific details: interface connection, MDIO bus location, etc.\n--\nDocumentation/networking/phy.rst=185=Now, to connect, just call this function::\nDocumentation/networking/phy.rst-186-\nDocumentation/networking/phy.rst:187:\tphydev = phy_connect(dev, phy_name, \u0026adjust_link, interface);\nDocumentation/networking/phy.rst-188-\n--\nDocumentation/networking/phy.rst=197=PHY-specific flags should be set in phydev-\u003edev_flags prior to the call\nDocumentation/networking/phy.rst:198:to phy_connect() such that the underlying PHY driver can check for flags\nDocumentation/networking/phy.rst-199-and perform specific operations based on them.\n--\nDocumentation/networking/phy.rst=229=PHY interface modes\n--\nDocumentation/networking/phy.rst-231-\nDocumentation/networking/phy.rst:232:The PHY interface mode supplied in the phy_connect() family of functions\nDocumentation/networking/phy.rst-233-defines the initial operating mode of the PHY interface.  This is not\n--\nDocumentation/networking/phy.rst=352=the SUPPORTED_Pause and SUPPORTED_AsymPause bits accordingly. This can be done\nDocumentation/networking/phy.rst:353:either before or after phy_connect() and/or as a result of implementing the\nDocumentation/networking/phy.rst-354-ethtool::set_pauseparam feature.\n--\nDocumentation/networking/phy.rst=363=every second before the state machine reacts to any changes.  To do this, you\nDocumentation/networking/phy.rst:364:need to manually call phy_attach() and phy_prepare_link(), and then call\nDocumentation/networking/phy.rst-365-phy_start_machine() with the second argument set to point to your special\n--\nDocumentation/networking/phy.rst=376=the complex interactions between the PHY and your network device.  If this is\nDocumentation/networking/phy.rst:377:so, you can simply call phy_attach(), and not call phy_start_machine or\nDocumentation/networking/phy.rst-378-phy_prepare_link().  This will mean that phydev-\u003estate is entirely yours to\n--\nDocumentation/networking/phy.rst=404=Requests the IRQ for the PHY interrupts.\n--\nDocumentation/networking/phy.rst-406-\nDocumentation/networking/phy.rst:407: struct phy_device * phy_attach(struct net_device *dev, const char *phy_id,\nDocumentation/networking/phy.rst-408-\t\t                phy_interface_t interface);\n--\nDocumentation/networking/sfp-phylink.rst=74=this documentation.\n--\nDocumentation/networking/sfp-phylink.rst-158-\nDocumentation/networking/sfp-phylink.rst:159:\tphy_dev = of_phy_connect(dev, node, link_func, flags, phy_interface);\nDocumentation/networking/sfp-phylink.rst-160-\n--\nDocumentation/networking/sfp-phylink.rst-162-\nDocumentation/networking/sfp-phylink.rst:163:\terr = phylink_of_phy_connect(priv-\u003ephylink, node, flags);\nDocumentation/networking/sfp-phylink.rst-164-\n--\nDocumentation/networking/sfp-phylink.rst-174-\nDocumentation/networking/sfp-phylink.rst:175:   of_phy_connect() was also passed a function pointer for link updates.\nDocumentation/networking/sfp-phylink.rst-176-   This function is replaced by a different form of MAC updates\n--\ndrivers/gpu/drm/i915/display/intel_tc.c=652=static bool tc_phy_verify_legacy_or_dp_alt_mode(struct intel_tc_port *tc,\n--\ndrivers/gpu/drm/i915/display/intel_tc.c-687-\ndrivers/gpu/drm/i915/display/intel_tc.c:688:static bool icl_tc_phy_connect(struct intel_tc_port *tc,\ndrivers/gpu/drm/i915/display/intel_tc.c-689-\t\t\t       int required_lanes)\n--\ndrivers/gpu/drm/i915/display/intel_tc.c=889=static void adlp_tc_phy_get_hw_state(struct intel_tc_port *tc)\n--\ndrivers/gpu/drm/i915/display/intel_tc.c-907-\ndrivers/gpu/drm/i915/display/intel_tc.c:908:static bool adlp_tc_phy_connect(struct intel_tc_port *tc, int required_lanes)\ndrivers/gpu/drm/i915/display/intel_tc.c-909-{\n--\ndrivers/gpu/drm/i915/display/intel_tc.c=1168=static void xelpdp_tc_phy_get_hw_state(struct intel_tc_port *tc)\n--\ndrivers/gpu/drm/i915/display/intel_tc.c-1195-\ndrivers/gpu/drm/i915/display/intel_tc.c:1196:static bool xelpdp_tc_phy_connect(struct intel_tc_port *tc, int required_lanes)\ndrivers/gpu/drm/i915/display/intel_tc.c-1197-{\n--\ndrivers/gpu/drm/i915/display/intel_tc.c=1467=tc_phy_get_target_mode(struct intel_tc_port *tc)\n--\ndrivers/gpu/drm/i915/display/intel_tc.c-1473-\ndrivers/gpu/drm/i915/display/intel_tc.c:1474:static void tc_phy_connect(struct intel_tc_port *tc, int required_lanes)\ndrivers/gpu/drm/i915/display/intel_tc.c-1475-{\n--\ndrivers/gpu/drm/i915/display/intel_tc.c=1508=static void intel_tc_port_reset_mode(struct intel_tc_port *tc,\n--\ndrivers/gpu/drm/i915/display/intel_tc.c-1526-\tif (!force_disconnect)\ndrivers/gpu/drm/i915/display/intel_tc.c:1527:\t\ttc_phy_connect(tc, required_lanes);\ndrivers/gpu/drm/i915/display/intel_tc.c-1528-\n--\ndrivers/gpu/drm/i915/display/intel_tc.c=1699=void intel_tc_info(struct drm_printer *p,  struct intel_digital_port *dig_port)\n--\ndrivers/gpu/drm/i915/display/intel_tc.c-1714- * not be available/usable by the graphics driver: see the comment on\ndrivers/gpu/drm/i915/display/intel_tc.c:1715: * icl_tc_phy_connect(). So in our driver instead of adding the additional\ndrivers/gpu/drm/i915/display/intel_tc.c-1716- * concept of \"usable\" and make everything check for \"connected and usable\" we\n--\ndrivers/net/dsa/bcm_sf2.c=607=static int bcm_sf2_mdio_register(struct dsa_switch *ds)\n--\ndrivers/net/dsa/bcm_sf2.c-656-\ndrivers/net/dsa/bcm_sf2.c:657:\t/* We need to make sure that of_phy_connect() will not work by\ndrivers/net/dsa/bcm_sf2.c-658-\t * removing the 'phandle' and 'linux,phandle' properties and\n--\ndrivers/net/dsa/netc/netc_main.c=968=static bool netc_port_is_emdio_consumer(struct device_node *node)\n--\ndrivers/net/dsa/netc/netc_main.c-984-\ndrivers/net/dsa/netc/netc_main.c:985:/* Currently, phylink_of_phy_connect() is called by dsa_user_create(),\ndrivers/net/dsa/netc/netc_main.c-986- * so if the switch uses the external MDIO controller (like the EMDIO\ndrivers/net/dsa/netc/netc_main.c-987- * function) to manage the external PHYs. The MDIO bus may not be\ndrivers/net/dsa/netc/netc_main.c:988: * created when phylink_of_phy_connect() is called, so it will return\ndrivers/net/dsa/netc/netc_main.c-989- * an error and cause the switch driver to fail to probe.\ndrivers/net/dsa/netc/netc_main.c:990: * This workaround can be removed when DSA phylink_of_phy_connect()\ndrivers/net/dsa/netc/netc_main.c-991- * calls are moved from probe() to ndo_open().\n--\ndrivers/net/ethernet/8390/ax88796.c=364=static int ax_mii_probe(struct net_device *dev)\n--\ndrivers/net/ethernet/8390/ax88796.c-376-\ndrivers/net/ethernet/8390/ax88796.c:377:\tret = phy_connect_direct(dev, phy_dev, ax_handle_link_change,\ndrivers/net/ethernet/8390/ax88796.c-378-\t\t\t\t PHY_INTERFACE_MODE_MII);\n--\ndrivers/net/ethernet/adi/adin1110.c=1569=static int adin1110_probe_netdevs(struct adin1110_priv *priv)\n--\ndrivers/net/ethernet/adi/adin1110.c-1612-\ndrivers/net/ethernet/adi/adin1110.c:1613:\t\tport_priv-\u003ephydev = phy_connect(netdev,\ndrivers/net/ethernet/adi/adin1110.c-1614-\t\t\t\t\t\tphydev_name(port_priv-\u003ephydev),\n--\ndrivers/net/ethernet/adi/adin1140.c=650=static int adin1140_phy_init(struct adin1140_priv *priv,\n--\ndrivers/net/ethernet/adi/adin1140.c-663-\tpriv-\u003ephydev-\u003eis_internal = true;\ndrivers/net/ethernet/adi/adin1140.c:664:\tret = phy_connect_direct(priv-\u003enetdev, priv-\u003ephydev,\ndrivers/net/ethernet/adi/adin1140.c-665-\t\t\t\t \u0026adin1140_handle_link_change,\n--\ndrivers/net/ethernet/aeroflex/greth.c=1253=static int greth_mdio_probe(struct net_device *dev)\n--\ndrivers/net/ethernet/aeroflex/greth.c-1267-\ndrivers/net/ethernet/aeroflex/greth.c:1268:\tret = phy_connect_direct(dev, phy, \u0026greth_link_change,\ndrivers/net/ethernet/aeroflex/greth.c-1269-\t\t\t\t greth-\u003egbit_mac ? PHY_INTERFACE_MODE_GMII : PHY_INTERFACE_MODE_MII);\n--\ndrivers/net/ethernet/agere/et131x.c=3273=static int et131x_mii_probe(struct net_device *netdev)\n--\ndrivers/net/ethernet/agere/et131x.c-3283-\ndrivers/net/ethernet/agere/et131x.c:3284:\tphydev = phy_connect(netdev, phydev_name(phydev),\ndrivers/net/ethernet/agere/et131x.c-3285-\t\t\t     \u0026et131x_adjust_link, PHY_INTERFACE_MODE_MII);\n--\ndrivers/net/ethernet/allwinner/sun4i-emac.c=167=static int emac_mdio_probe(struct net_device *dev)\n--\ndrivers/net/ethernet/allwinner/sun4i-emac.c-174-\t/* attach the mac to the phy */\ndrivers/net/ethernet/allwinner/sun4i-emac.c:175:\tphydev = of_phy_connect(db-\u003endev, db-\u003ephy_node,\ndrivers/net/ethernet/allwinner/sun4i-emac.c-176-\t\t\t\t\u0026emac_handle_link_change, 0,\n--\ndrivers/net/ethernet/altera/altera_tse_main.c=876=static int tse_open(struct net_device *dev)\n--\ndrivers/net/ethernet/altera/altera_tse_main.c-951-\ndrivers/net/ethernet/altera/altera_tse_main.c:952:\tret = phylink_of_phy_connect(priv-\u003ephylink, priv-\u003edevice-\u003eof_node, 0);\ndrivers/net/ethernet/altera/altera_tse_main.c-953-\tif (ret) {\n--\ndrivers/net/ethernet/amd/au1000_eth.c=472=static int au1000_mii_probe(struct net_device *dev)\n--\ndrivers/net/ethernet/amd/au1000_eth.c-538-\ndrivers/net/ethernet/amd/au1000_eth.c:539:\tphydev = phy_connect(dev, phydev_name(phydev),\ndrivers/net/ethernet/amd/au1000_eth.c-540-\t\t\t     \u0026au1000_adjust_link, PHY_INTERFACE_MODE_MII);\n--\ndrivers/net/ethernet/apm/xgene-v2/mdio.c=98=int xge_mdio_config(struct net_device *ndev)\n--\ndrivers/net/ethernet/apm/xgene-v2/mdio.c-128-\t}\ndrivers/net/ethernet/apm/xgene-v2/mdio.c:129:\tphydev = phy_connect(ndev, phydev_name(phydev),\ndrivers/net/ethernet/apm/xgene-v2/mdio.c-130-\t\t\t     \u0026xge_adjust_link,\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c=819=static struct acpi_device *acpi_phy_find_device(struct device *dev)\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-836-\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c:837:int xgene_enet_phy_connect(struct net_device *ndev)\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-838-{\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-847-\t\t\tnp = of_parse_phandle(dev-\u003eof_node, \"phy-handle\", i);\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c:848:\t\t\tphy_dev = of_phy_connect(ndev, np,\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-849-\t\t\t\t\t\t \u0026xgene_enet_adjust_link,\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-868-\t\tif (!phy_dev ||\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c:869:\t\t    phy_connect_direct(ndev, phy_dev, \u0026xgene_enet_adjust_link,\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-870-\t\t\t\t       pdata-\u003ephy_mode)) {\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c=939=int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata)\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-965-\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c:966:\tret = xgene_enet_phy_connect(ndev);\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-967-\tif (ret)\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.h=426=bool xgene_ring_mgr_init(struct xgene_enet_pdata *p);\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.h:427:int xgene_enet_phy_connect(struct net_device *ndev);\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.h-428-void xgene_enet_phy_disconnect(struct xgene_enet_pdata *pdata);\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_main.c=1651=static void xgene_enet_check_phy_handle(struct xgene_enet_pdata *pdata)\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_main.c-1660-\ndrivers/net/ethernet/apm/xgene/xgene_enet_main.c:1661:\tret = xgene_enet_phy_connect(pdata-\u003endev);\ndrivers/net/ethernet/apm/xgene/xgene_enet_main.c-1662-\tif (!ret)\n--\ndrivers/net/ethernet/arc/emac_main.c=858=int arc_emac_probe(struct net_device *ndev, int interface)\n--\ndrivers/net/ethernet/arc/emac_main.c-988-\ndrivers/net/ethernet/arc/emac_main.c:989:\tphydev = of_phy_connect(ndev, phy_node, arc_emac_adjust_link, 0,\ndrivers/net/ethernet/arc/emac_main.c-990-\t\t\t\tinterface);\ndrivers/net/ethernet/arc/emac_main.c-991-\tif (!phydev) {\ndrivers/net/ethernet/arc/emac_main.c:992:\t\tdev_err(dev, \"of_phy_connect() failed\\n\");\ndrivers/net/ethernet/arc/emac_main.c-993-\t\terr = -ENODEV;\n--\ndrivers/net/ethernet/asix/ax88796c_main.c=966=static int ax88796c_probe(struct spi_device *spi)\n--\ndrivers/net/ethernet/asix/ax88796c_main.c-1076-\t\t ax_local-\u003emdiobus-\u003eid, AX88796C_PHY_ID);\ndrivers/net/ethernet/asix/ax88796c_main.c:1077:\tax_local-\u003ephydev = phy_connect(ax_local-\u003endev, phy_id,\ndrivers/net/ethernet/asix/ax88796c_main.c-1078-\t\t\t\t       ax88796c_handle_link_change,\n--\ndrivers/net/ethernet/atheros/ag71xx.c=1404=static int ag71xx_open(struct net_device *ndev)\n--\ndrivers/net/ethernet/atheros/ag71xx.c-1409-\ndrivers/net/ethernet/atheros/ag71xx.c:1410:\tret = phylink_of_phy_connect(ag-\u003ephylink, ag-\u003epdev-\u003edev.of_node, 0);\ndrivers/net/ethernet/atheros/ag71xx.c-1411-\tif (ret) {\n--\ndrivers/net/ethernet/broadcom/asp2/bcmasp_intf.c=1039=static phy_interface_t bcmasp_phy_iface_for_connect(phy_interface_t mode)\n--\ndrivers/net/ethernet/broadcom/asp2/bcmasp_intf.c-1075-\ndrivers/net/ethernet/broadcom/asp2/bcmasp_intf.c:1076:static int bcmasp_phy_attach(struct bcmasp_intf *intf)\ndrivers/net/ethernet/broadcom/asp2/bcmasp_intf.c-1077-{\n--\ndrivers/net/ethernet/broadcom/asp2/bcmasp_intf.c-1084-\tphy_iface = bcmasp_phy_iface_for_connect(intf-\u003ephy_interface);\ndrivers/net/ethernet/broadcom/asp2/bcmasp_intf.c:1085:\tphydev = of_phy_connect(intf-\u003endev, intf-\u003ephy_dn,\ndrivers/net/ethernet/broadcom/asp2/bcmasp_intf.c-1086-\t\t\t\tbcmasp_adj_link, phy_flags,\n--\ndrivers/net/ethernet/broadcom/asp2/bcmasp_intf.c=1123=static int bcmasp_open(struct net_device *dev)\n--\ndrivers/net/ethernet/broadcom/asp2/bcmasp_intf.c-1141-\ndrivers/net/ethernet/broadcom/asp2/bcmasp_intf.c:1142:\tret = bcmasp_phy_attach(intf);\ndrivers/net/ethernet/broadcom/asp2/bcmasp_intf.c-1143-\tif (ret)\n--\ndrivers/net/ethernet/broadcom/b44.c=2234=static int b44_register_phy_one(struct b44 *bp)\n--\ndrivers/net/ethernet/broadcom/b44.c-2280-\telse\ndrivers/net/ethernet/broadcom/b44.c:2281:\t\terr = phy_connect_direct(bp-\u003edev, phydev, \u0026b44_adjust_link,\ndrivers/net/ethernet/broadcom/b44.c-2282-\t\t\t\t\t PHY_INTERFACE_MODE_MII);\n--\ndrivers/net/ethernet/broadcom/bcm63xx_enet.c=890=static int bcm_enet_open(struct net_device *dev)\n--\ndrivers/net/ethernet/broadcom/bcm63xx_enet.c-909-\ndrivers/net/ethernet/broadcom/bcm63xx_enet.c:910:\t\tphydev = phy_connect(dev, phy_id, bcm_enet_adjust_phy_link,\ndrivers/net/ethernet/broadcom/bcm63xx_enet.c-911-\t\t\t\t     PHY_INTERFACE_MODE_MII);\n--\ndrivers/net/ethernet/broadcom/bcmsysport.c=1928=static int bcm_sysport_open(struct net_device *dev)\n--\ndrivers/net/ethernet/broadcom/bcmsysport.c-1966-\ndrivers/net/ethernet/broadcom/bcmsysport.c:1967:\tphydev = of_phy_connect(dev, priv-\u003ephy_dn, bcm_sysport_adj_link,\ndrivers/net/ethernet/broadcom/bcmsysport.c-1968-\t\t\t\t0, priv-\u003ephy_interface);\n--\ndrivers/net/ethernet/broadcom/bgmac-bcma.c=79=static void bcma_bgmac_cmn_maskset32(struct bgmac *bgmac, u16 offset, u32 mask,\n--\ndrivers/net/ethernet/broadcom/bgmac-bcma.c-84-\ndrivers/net/ethernet/broadcom/bgmac-bcma.c:85:static int bcma_phy_connect(struct bgmac *bgmac)\ndrivers/net/ethernet/broadcom/bgmac-bcma.c-86-{\n--\ndrivers/net/ethernet/broadcom/bgmac-bcma.c-99-\t\t\t bgmac-\u003ephyaddr);\ndrivers/net/ethernet/broadcom/bgmac-bcma.c:100:\t\tphy_dev = phy_connect(bgmac-\u003enet_dev, bus_id, bgmac_adjust_link,\ndrivers/net/ethernet/broadcom/bgmac-bcma.c-101-\t\t\t\t      PHY_INTERFACE_MODE_MII);\n--\ndrivers/net/ethernet/broadcom/bgmac-bcma.c-110-\t/* Assume a fixed link to the switch port */\ndrivers/net/ethernet/broadcom/bgmac-bcma.c:111:\treturn bgmac_phy_connect_direct(bgmac);\ndrivers/net/ethernet/broadcom/bgmac-bcma.c-112-}\n--\ndrivers/net/ethernet/broadcom/bgmac-platform.c=118=static void bgmac_nicpm_speed_set(struct net_device *net_dev)\n--\ndrivers/net/ethernet/broadcom/bgmac-platform.c-150-\ndrivers/net/ethernet/broadcom/bgmac-platform.c:151:static int platform_phy_connect(struct bgmac *bgmac)\ndrivers/net/ethernet/broadcom/bgmac-platform.c-152-{\n--\ndrivers/net/ethernet/broadcom/bgmac.c=1437=EXPORT_SYMBOL_GPL(bgmac_adjust_link);\ndrivers/net/ethernet/broadcom/bgmac.c-1438-\ndrivers/net/ethernet/broadcom/bgmac.c:1439:int bgmac_phy_connect_direct(struct bgmac *bgmac)\ndrivers/net/ethernet/broadcom/bgmac.c-1440-{\n--\ndrivers/net/ethernet/broadcom/bgmac.c-1454-\ndrivers/net/ethernet/broadcom/bgmac.c:1455:\terr = phy_connect_direct(bgmac-\u003enet_dev, phy_dev, bgmac_adjust_link,\ndrivers/net/ethernet/broadcom/bgmac.c-1456-\t\t\t\t PHY_INTERFACE_MODE_MII);\n--\ndrivers/net/ethernet/broadcom/bgmac.c=1487=int bgmac_enet_probe(struct bgmac *bgmac)\n--\ndrivers/net/ethernet/broadcom/bgmac.c-1532-\ndrivers/net/ethernet/broadcom/bgmac.c:1533:\terr = bgmac_phy_connect(bgmac);\ndrivers/net/ethernet/broadcom/bgmac.c-1534-\tif (err) {\n--\ndrivers/net/ethernet/broadcom/bgmac.h=502=void bgmac_adjust_link(struct net_device *net_dev);\ndrivers/net/ethernet/broadcom/bgmac.h:503:int bgmac_phy_connect_direct(struct bgmac *bgmac);\ndrivers/net/ethernet/broadcom/bgmac.h-504-int bgmac_enet_suspend(struct bgmac *bgmac);\n--\ndrivers/net/ethernet/broadcom/bgmac.h=583=static inline void bgmac_umac_maskset(struct bgmac *bgmac, u16 offset, u32 mask, u32 set)\n--\ndrivers/net/ethernet/broadcom/bgmac.h-587-\ndrivers/net/ethernet/broadcom/bgmac.h:588:static inline int bgmac_phy_connect(struct bgmac *bgmac)\ndrivers/net/ethernet/broadcom/bgmac.h-589-{\ndrivers/net/ethernet/broadcom/bgmac.h:590:\treturn bgmac-\u003ephy_connect(bgmac);\ndrivers/net/ethernet/broadcom/bgmac.h-591-}\n--\ndrivers/net/ethernet/broadcom/genet/bcmmii.c=301=int bcmgenet_mii_probe(struct net_device *dev)\n--\ndrivers/net/ethernet/broadcom/genet/bcmmii.c-350-\tif (dn) {\ndrivers/net/ethernet/broadcom/genet/bcmmii.c:351:\t\tphydev = of_phy_connect(dev, priv-\u003ephy_dn, bcmgenet_mii_setup,\ndrivers/net/ethernet/broadcom/genet/bcmmii.c-352-\t\t\t\t\tphy_flags, phy_iface);\n--\ndrivers/net/ethernet/broadcom/genet/bcmmii.c-380-\ndrivers/net/ethernet/broadcom/genet/bcmmii.c:381:\t\tret = phy_connect_direct(dev, phydev, bcmgenet_mii_setup,\ndrivers/net/ethernet/broadcom/genet/bcmmii.c-382-\t\t\t\t\t phy_iface);\n--\ndrivers/net/ethernet/broadcom/sb1250-mac.c=2324=static int sbmac_mii_probe(struct net_device *dev)\n--\ndrivers/net/ethernet/broadcom/sb1250-mac.c-2334-\ndrivers/net/ethernet/broadcom/sb1250-mac.c:2335:\tphy_dev = phy_connect(dev, dev_name(\u0026phy_dev-\u003emdio.dev),\ndrivers/net/ethernet/broadcom/sb1250-mac.c-2336-\t\t\t      \u0026sbmac_mii_poll, PHY_INTERFACE_MODE_GMII);\n--\ndrivers/net/ethernet/broadcom/tg3.c=2084=static int tg3_phy_init(struct tg3 *tp)\n--\ndrivers/net/ethernet/broadcom/tg3.c-2096-\t/* Attach the MAC to the PHY. */\ndrivers/net/ethernet/broadcom/tg3.c:2097:\tphydev = phy_connect(tp-\u003edev, phydev_name(phydev),\ndrivers/net/ethernet/broadcom/tg3.c-2098-\t\t\t     tg3_adjust_link, phydev-\u003einterface);\n--\ndrivers/net/ethernet/cadence/macb_main.c=982=static int macb_phylink_connect(struct macb *bp)\n--\ndrivers/net/ethernet/cadence/macb_main.c-989-\tif (dn)\ndrivers/net/ethernet/cadence/macb_main.c:990:\t\tret = phylink_of_phy_connect(bp-\u003ephylink, dn, 0);\ndrivers/net/ethernet/cadence/macb_main.c-991-\n--\ndrivers/net/ethernet/cavium/octeon/octeon_mgmt.c=945=static int octeon_mgmt_init_phy(struct net_device *netdev)\n--\ndrivers/net/ethernet/cavium/octeon/octeon_mgmt.c-955-\ndrivers/net/ethernet/cavium/octeon/octeon_mgmt.c:956:\tphydev = of_phy_connect(netdev, p-\u003ephy_np,\ndrivers/net/ethernet/cavium/octeon/octeon_mgmt.c-957-\t\t\t\tocteon_mgmt_adjust_link, 0,\n--\ndrivers/net/ethernet/cavium/thunder/thunder_bgx.c=1055=static int bgx_lmac_enable(struct bgx *bgx, u8 lmacid)\n--\ndrivers/net/ethernet/cavium/thunder/thunder_bgx.c-1119-\ndrivers/net/ethernet/cavium/thunder/thunder_bgx.c:1120:\t\tif (phy_connect_direct(lmac-\u003enetdev, lmac-\u003ephydev,\ndrivers/net/ethernet/cavium/thunder/thunder_bgx.c-1121-\t\t\t\t       bgx_lmac_handler,\n--\ndrivers/net/ethernet/davicom/dm9051.c=1132=static void dm9051_handle_link_change(struct net_device *ndev)\n--\ndrivers/net/ethernet/davicom/dm9051.c-1151- */\ndrivers/net/ethernet/davicom/dm9051.c:1152:static int dm9051_phy_connect(struct board_info *db)\ndrivers/net/ethernet/davicom/dm9051.c-1153-{\n--\ndrivers/net/ethernet/davicom/dm9051.c-1158-\ndrivers/net/ethernet/davicom/dm9051.c:1159:\tdb-\u003ephydev = phy_connect(db-\u003endev, phy_id, dm9051_handle_link_change,\ndrivers/net/ethernet/davicom/dm9051.c-1160-\t\t\t\t PHY_INTERFACE_MODE_MII);\n--\ndrivers/net/ethernet/davicom/dm9051.c=1164=static int dm9051_probe(struct spi_device *spi)\n--\ndrivers/net/ethernet/davicom/dm9051.c-1208-\ndrivers/net/ethernet/davicom/dm9051.c:1209:\tret = dm9051_phy_connect(db);\ndrivers/net/ethernet/davicom/dm9051.c-1210-\tif (ret)\n--\ndrivers/net/ethernet/engleder/tsnep_main.c=241=static int tsnep_phy_open(struct tsnep_adapter *adapter)\n--\ndrivers/net/ethernet/engleder/tsnep_main.c-246-\ndrivers/net/ethernet/engleder/tsnep_main.c:247:\tretval = phy_connect_direct(adapter-\u003enetdev, adapter-\u003ephydev,\ndrivers/net/ethernet/engleder/tsnep_main.c-248-\t\t\t\t    tsnep_phy_link_status_change,\n--\ndrivers/net/ethernet/ethoc.c=699=static int ethoc_mdio_probe(struct net_device *dev)\n--\ndrivers/net/ethernet/ethoc.c-715-\ndrivers/net/ethernet/ethoc.c:716:\terr = phy_connect_direct(dev, phy, ethoc_mdio_poll,\ndrivers/net/ethernet/ethoc.c-717-\t\t\t\t PHY_INTERFACE_MODE_GMII);\n--\ndrivers/net/ethernet/faraday/ftgmac100.c=1497=static int ftgmac100_mii_probe(struct net_device *netdev)\n--\ndrivers/net/ethernet/faraday/ftgmac100.c-1541-\ndrivers/net/ethernet/faraday/ftgmac100.c:1542:\tphydev = phy_connect(netdev, phydev_name(phydev),\ndrivers/net/ethernet/faraday/ftgmac100.c-1543-\t\t\t     \u0026ftgmac100_adjust_link, phy_intf);\n--\ndrivers/net/ethernet/faraday/ftgmac100.c=1848=static int ftgmac100_probe_ncsi(struct net_device *netdev,\n--\ndrivers/net/ethernet/faraday/ftgmac100.c-1872-\t}\ndrivers/net/ethernet/faraday/ftgmac100.c:1873:\terr = phy_connect_direct(netdev, phydev, ftgmac100_adjust_link,\ndrivers/net/ethernet/faraday/ftgmac100.c-1874-\t\t\t\t PHY_INTERFACE_MODE_RMII);\n--\ndrivers/net/ethernet/freescale/dpaa/dpaa_eth.c=2941=static int dpaa_open(struct net_device *net_dev)\n--\ndrivers/net/ethernet/freescale/dpaa/dpaa_eth.c-2950-\ndrivers/net/ethernet/freescale/dpaa/dpaa_eth.c:2951:\terr = phylink_of_phy_connect(mac_dev-\u003ephylink,\ndrivers/net/ethernet/freescale/dpaa/dpaa_eth.c-2952-\t\t\t\t     mac_dev-\u003edev-\u003eof_node, 0);\n--\ndrivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c=560=int dpaa2_mac_connect(struct dpaa2_mac *mac)\n--\ndrivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c-634-\trtnl_lock();\ndrivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c:635:\terr = phylink_fwnode_phy_connect(mac-\u003ephylink, dpmac_node, 0);\ndrivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c-636-\trtnl_unlock();\ndrivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c-637-\tif (err) {\ndrivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c:638:\t\tnetdev_err(net_dev, \"phylink_fwnode_phy_connect() = %d\\n\", err);\ndrivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c-639-\t\tgoto err_phylink_destroy;\n--\ndrivers/net/ethernet/freescale/enetc/enetc.c=2935=static int enetc_phylink_connect(struct net_device *ndev)\n--\ndrivers/net/ethernet/freescale/enetc/enetc.c-2946-\ndrivers/net/ethernet/freescale/enetc/enetc.c:2947:\terr = phylink_of_phy_connect(priv-\u003ephylink, priv-\u003edev-\u003eof_node, 0);\ndrivers/net/ethernet/freescale/enetc/enetc.c-2948-\tif (err) {\n--\ndrivers/net/ethernet/freescale/fec_main.c=2981=static int fec_enet_mii_probe(struct net_device *ndev)\n--\ndrivers/net/ethernet/freescale/fec_main.c-2987-\tif (fep-\u003ephy_node) {\ndrivers/net/ethernet/freescale/fec_main.c:2988:\t\tphy_dev = of_phy_connect(ndev, fep-\u003ephy_node,\ndrivers/net/ethernet/freescale/fec_main.c-2989-\t\t\t\t\t \u0026fec_enet_adjust_link, 0,\n--\ndrivers/net/ethernet/freescale/fec_main.c-3009-\ndrivers/net/ethernet/freescale/fec_main.c:3010:\t\tret = phy_connect_direct(ndev, phy_dev, \u0026fec_enet_adjust_link,\ndrivers/net/ethernet/freescale/fec_main.c-3011-\t\t\t\t\t fep-\u003ephy_interface);\n--\ndrivers/net/ethernet/freescale/fec_mpc52xx.c=216=static int mpc52xx_fec_open(struct net_device *dev)\n--\ndrivers/net/ethernet/freescale/fec_mpc52xx.c-222-\tif (priv-\u003ephy_node) {\ndrivers/net/ethernet/freescale/fec_mpc52xx.c:223:\t\tphydev = of_phy_connect(priv-\u003endev, priv-\u003ephy_node,\ndrivers/net/ethernet/freescale/fec_mpc52xx.c-224-\t\t\t\t\tmpc52xx_fec_adjust_link, 0, 0);\n--\ndrivers/net/ethernet/freescale/fs_enet/fs_enet-main.c=656=static int fs_enet_open(struct net_device *dev)\n--\ndrivers/net/ethernet/freescale/fs_enet/fs_enet-main.c-677-\ndrivers/net/ethernet/freescale/fs_enet/fs_enet-main.c:678:\terr = phylink_of_phy_connect(fep-\u003ephylink, fep-\u003edev-\u003eof_node, 0);\ndrivers/net/ethernet/freescale/fs_enet/fs_enet-main.c-679-\tif (err) {\n--\ndrivers/net/ethernet/freescale/gianfar.c=1640=static int init_phy(struct net_device *dev)\n--\ndrivers/net/ethernet/freescale/gianfar.c-1650-\ndrivers/net/ethernet/freescale/gianfar.c:1651:\tphydev = of_phy_connect(dev, priv-\u003ephy_node, \u0026adjust_link, 0,\ndrivers/net/ethernet/freescale/gianfar.c-1652-\t\t\t\tinterface);\n--\ndrivers/net/ethernet/freescale/ucc_geth.c=3167=static int ucc_geth_open(struct net_device *dev)\n--\ndrivers/net/ethernet/freescale/ucc_geth.c-3180-\ndrivers/net/ethernet/freescale/ucc_geth.c:3181:\terr = phylink_of_phy_connect(ugeth-\u003ephylink, ugeth-\u003edev-\u003eof_node, 0);\ndrivers/net/ethernet/freescale/ucc_geth.c-3182-\tif (err) {\n--\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c=196=static void hbg_phy_disconnect(void *data)\n--\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c-200-\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c:201:static int hbg_phy_connect(struct hbg_priv *priv)\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c-202-{\n--\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c-206-\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c:207:\tret = phy_connect_direct(priv-\u003enetdev, phydev, hbg_phy_adjust_link,\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c-208-\t\t\t\t PHY_INTERFACE_MODE_SGMII);\n--\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c=238=static int hbg_fixed_phy_init(struct hbg_priv *priv)\n--\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c-262-\tpriv-\u003emac.phydev = phydev;\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c:263:\treturn hbg_phy_connect(priv);\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c-264-}\n--\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c=266=int hbg_mdio_init(struct hbg_priv *priv)\n--\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c-302-\thbg_mdio_init_hw(priv);\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c:303:\treturn hbg_phy_connect(priv);\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c-304-}\n--\ndrivers/net/ethernet/hisilicon/hip04_eth.c=898=static int hip04_mac_probe(struct platform_device *pdev)\n--\ndrivers/net/ethernet/hisilicon/hip04_eth.c-980-\tif (priv-\u003ephy_node) {\ndrivers/net/ethernet/hisilicon/hip04_eth.c:981:\t\tpriv-\u003ephy = of_phy_connect(ndev, priv-\u003ephy_node,\ndrivers/net/ethernet/hisilicon/hip04_eth.c-982-\t\t\t\t\t   \u0026hip04_adjust_link,\n--\ndrivers/net/ethernet/hisilicon/hix5hd2_gmac.c=826=static int hix5hd2_net_open(struct net_device *dev)\n--\ndrivers/net/ethernet/hisilicon/hix5hd2_gmac.c-844-\ndrivers/net/ethernet/hisilicon/hix5hd2_gmac.c:845:\tphy = of_phy_connect(dev, priv-\u003ephy_node,\ndrivers/net/ethernet/hisilicon/hix5hd2_gmac.c-846-\t\t\t     \u0026hix5hd2_adjust_link, 0, priv-\u003ephy_mode);\n--\ndrivers/net/ethernet/hisilicon/hns/hns_enet.c=1159=int hns_nic_init_phy(struct net_device *ndev, struct hnae_handle *h)\n--\ndrivers/net/ethernet/hisilicon/hns/hns_enet.c-1177-\ndrivers/net/ethernet/hisilicon/hns/hns_enet.c:1178:\t\tret = phy_connect_direct(ndev, phy_dev, hns_nic_adjust_link,\ndrivers/net/ethernet/hisilicon/hns/hns_enet.c-1179-\t\t\t\t\t h-\u003ephy_if);\n--\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c=202=int hclge_mac_connect_phy(struct hnae3_handle *handle)\n--\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c-217-\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c:218:\tret = phy_connect_direct(netdev, phydev,\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c-219-\t\t\t\t hclge_mac_adjust_link,\n--\ndrivers/net/ethernet/ibm/emac/core.c=2560=static int emac_dt_mdio_probe(struct emac_instance *dev)\n--\ndrivers/net/ethernet/ibm/emac/core.c-2595-\ndrivers/net/ethernet/ibm/emac/core.c:2596:static int emac_dt_phy_connect(struct emac_instance *dev,\ndrivers/net/ethernet/ibm/emac/core.c-2597-\t\t\t       struct device_node *phy_handle)\n--\ndrivers/net/ethernet/ibm/emac/core.c-2605-\ndrivers/net/ethernet/ibm/emac/core.c:2606:\tphy_dev = of_phy_connect(dev-\u003endev, phy_handle, \u0026emac_adjust_link, 0,\ndrivers/net/ethernet/ibm/emac/core.c-2607-\t\t\t\t dev-\u003ephy_mode);\n--\ndrivers/net/ethernet/ibm/emac/core.c=2624=static int emac_dt_phy_probe(struct emac_instance *dev)\n--\ndrivers/net/ethernet/ibm/emac/core.c-2634-\t\tif (!res) {\ndrivers/net/ethernet/ibm/emac/core.c:2635:\t\t\tres = emac_dt_phy_connect(dev, phy_handle);\ndrivers/net/ethernet/ibm/emac/core.c-2636-\t\t}\n--\n\n"
}

11/2 2026/09/14 23:07 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 19782
							output: 27
							thoughts: 80
						

Thoughts:
**Investigating Syzkaller's Interaction with PHY Devices**

Okay, hold on a second. Can Syzkaller actually get to `phy_attach_direct`? That's the key question here. I need to understand how Syzkaller is even going about the process of attaching or connecting a PHY device within the kernel. My immediate thought is to focus on potential avenues. Given how versatile Syzkaller is, it's not immediately obvious.

My initial line of investigation will be to identify possible device types. Let's see... USB ethernet devices come to mind, and perhaps we should also consider virtual MDIO or PHY devices. These seem like good starting points for understanding the connection process from a generic, and likely, vulnerable angle.

Now, let's get down to the practical. I'm going to start by grepping the `drivers/net/usb/` directory. The search terms I'll use are `phy_connect`, `phy_attach`, and specifically, `phy_attach_direct`. This should give me a clearer picture of how these functions are used within the context of USB ethernet drivers. Hopefully, this will lead me to the entry point and, more importantly, a potential fuzzer target.



12/2 2026/09/14 23:07 tool grepper
0m Args:
{
  "Expression": "phy_",
  "PathPrefix": "drivers/net/usb"
}

Results:
{
  "Output": "\nFull output is too long, showing 500 out of 2013 lines.\nUse more precise expression if possible.\n\ndrivers/net/usb/aqc111.c=266=static int aqc111_get_link_ksettings(struct net_device *net,\n--\ndrivers/net/usb/aqc111.c-320-\ndrivers/net/usb/aqc111.c:321:static void aqc111_set_phy_speed(struct usbnet *dev, u8 autoneg, u16 speed)\ndrivers/net/usb/aqc111.c-322-{\n--\ndrivers/net/usb/aqc111.c-324-\ndrivers/net/usb/aqc111.c:325:\taqc111_data-\u003ephy_cfg \u0026= ~AQ_ADV_MASK;\ndrivers/net/usb/aqc111.c:326:\taqc111_data-\u003ephy_cfg |= AQ_PAUSE;\ndrivers/net/usb/aqc111.c:327:\taqc111_data-\u003ephy_cfg |= AQ_ASYM_PAUSE;\ndrivers/net/usb/aqc111.c:328:\taqc111_data-\u003ephy_cfg |= AQ_DOWNSHIFT;\ndrivers/net/usb/aqc111.c:329:\taqc111_data-\u003ephy_cfg \u0026= ~AQ_DSH_RETRIES_MASK;\ndrivers/net/usb/aqc111.c:330:\taqc111_data-\u003ephy_cfg |= (3 \u003c\u003c AQ_DSH_RETRIES_SHIFT) \u0026\ndrivers/net/usb/aqc111.c-331-\t\t\t\tAQ_DSH_RETRIES_MASK;\n--\ndrivers/net/usb/aqc111.c-335-\t\tcase SPEED_5000:\ndrivers/net/usb/aqc111.c:336:\t\t\taqc111_data-\u003ephy_cfg |= AQ_ADV_5G;\ndrivers/net/usb/aqc111.c-337-\t\t\tfallthrough;\ndrivers/net/usb/aqc111.c-338-\t\tcase SPEED_2500:\ndrivers/net/usb/aqc111.c:339:\t\t\taqc111_data-\u003ephy_cfg |= AQ_ADV_2G5;\ndrivers/net/usb/aqc111.c-340-\t\t\tfallthrough;\ndrivers/net/usb/aqc111.c-341-\t\tcase SPEED_1000:\ndrivers/net/usb/aqc111.c:342:\t\t\taqc111_data-\u003ephy_cfg |= AQ_ADV_1G;\ndrivers/net/usb/aqc111.c-343-\t\t\tfallthrough;\ndrivers/net/usb/aqc111.c-344-\t\tcase SPEED_100:\ndrivers/net/usb/aqc111.c:345:\t\t\taqc111_data-\u003ephy_cfg |= AQ_ADV_100M;\ndrivers/net/usb/aqc111.c-346-\t\t\t/* fall-through */\n--\ndrivers/net/usb/aqc111.c-350-\t\tcase SPEED_5000:\ndrivers/net/usb/aqc111.c:351:\t\t\taqc111_data-\u003ephy_cfg |= AQ_ADV_5G;\ndrivers/net/usb/aqc111.c-352-\t\t\tbreak;\ndrivers/net/usb/aqc111.c-353-\t\tcase SPEED_2500:\ndrivers/net/usb/aqc111.c:354:\t\t\taqc111_data-\u003ephy_cfg |= AQ_ADV_2G5;\ndrivers/net/usb/aqc111.c-355-\t\t\tbreak;\ndrivers/net/usb/aqc111.c-356-\t\tcase SPEED_1000:\ndrivers/net/usb/aqc111.c:357:\t\t\taqc111_data-\u003ephy_cfg |= AQ_ADV_1G;\ndrivers/net/usb/aqc111.c-358-\t\t\tbreak;\ndrivers/net/usb/aqc111.c-359-\t\tcase SPEED_100:\ndrivers/net/usb/aqc111.c:360:\t\t\taqc111_data-\u003ephy_cfg |= AQ_ADV_100M;\ndrivers/net/usb/aqc111.c-361-\t\t\tbreak;\n--\ndrivers/net/usb/aqc111.c-364-\ndrivers/net/usb/aqc111.c:365:\taqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, \u0026aqc111_data-\u003ephy_cfg);\ndrivers/net/usb/aqc111.c-366-}\n--\ndrivers/net/usb/aqc111.c=368=static int aqc111_set_link_ksettings(struct net_device *net,\n--\ndrivers/net/usb/aqc111.c-382-\t\t\t\t\t SPEED_5000 : SPEED_1000;\ndrivers/net/usb/aqc111.c:383:\t\t\taqc111_set_phy_speed(dev, aqc111_data-\u003eautoneg,\ndrivers/net/usb/aqc111.c-384-\t\t\t\t\t     aqc111_data-\u003eadvertised_speed);\n--\ndrivers/net/usb/aqc111.c-403-\ndrivers/net/usb/aqc111.c:404:\t\taqc111_set_phy_speed(dev, aqc111_data-\u003eautoneg,\ndrivers/net/usb/aqc111.c-405-\t\t\t\t     aqc111_data-\u003eadvertised_speed);\n--\ndrivers/net/usb/aqc111.c=753=static void aqc111_unbind(struct usbnet *dev, struct usb_interface *intf)\n--\ndrivers/net/usb/aqc111.c-766-\t/* Power down ethernet PHY */\ndrivers/net/usb/aqc111.c:767:\taqc111_data-\u003ephy_cfg \u0026= ~AQ_ADV_MASK;\ndrivers/net/usb/aqc111.c:768:\taqc111_data-\u003ephy_cfg |= AQ_LOW_POWER;\ndrivers/net/usb/aqc111.c:769:\taqc111_data-\u003ephy_cfg \u0026= ~AQ_PHY_POWER_EN;\ndrivers/net/usb/aqc111.c-770-\taqc111_write32_cmd_nopm(dev, AQ_PHY_OPS, 0, 0,\ndrivers/net/usb/aqc111.c:771:\t\t\t\t\u0026aqc111_data-\u003ephy_cfg);\ndrivers/net/usb/aqc111.c-772-\n--\ndrivers/net/usb/aqc111.c=990=static int aqc111_reset(struct usbnet *dev)\n--\ndrivers/net/usb/aqc111.c-1004-\t/* Power up ethernet PHY */\ndrivers/net/usb/aqc111.c:1005:\taqc111_data-\u003ephy_cfg = AQ_PHY_POWER_EN;\ndrivers/net/usb/aqc111.c-1006-\taqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0,\ndrivers/net/usb/aqc111.c:1007:\t\t\t   \u0026aqc111_data-\u003ephy_cfg);\ndrivers/net/usb/aqc111.c-1008-\n--\ndrivers/net/usb/aqc111.c-1027-\t/* Phy advertise */\ndrivers/net/usb/aqc111.c:1028:\taqc111_set_phy_speed(dev, aqc111_data-\u003eautoneg,\ndrivers/net/usb/aqc111.c-1029-\t\t\t     aqc111_data-\u003eadvertised_speed);\n--\ndrivers/net/usb/aqc111.c=1034=static int aqc111_stop(struct usbnet *dev)\n--\ndrivers/net/usb/aqc111.c-1047-\t/* Put PHY to low power*/\ndrivers/net/usb/aqc111.c:1048:\taqc111_data-\u003ephy_cfg |= AQ_LOW_POWER;\ndrivers/net/usb/aqc111.c-1049-\taqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0,\ndrivers/net/usb/aqc111.c:1050:\t\t\t   \u0026aqc111_data-\u003ephy_cfg);\ndrivers/net/usb/aqc111.c-1051-\n--\ndrivers/net/usb/aqc111.c=1322=static int aqc111_suspend(struct usb_interface *intf, pm_message_t message)\n--\ndrivers/net/usb/aqc111.c-1361-\ndrivers/net/usb/aqc111.c:1362:\t\taqc111_data-\u003ephy_cfg |= AQ_WOL;\ndrivers/net/usb/aqc111.c-1363-\t\tether_addr_copy(wol_cfg.hw_addr, dev-\u003enet-\u003edev_addr);\n--\ndrivers/net/usb/aqc111.c-1400-\t\taqc111_write32_cmd_nopm(dev, AQ_PHY_OPS, 0, 0,\ndrivers/net/usb/aqc111.c:1401:\t\t\t\t\t\u0026aqc111_data-\u003ephy_cfg);\ndrivers/net/usb/aqc111.c-1402-\t} else {\ndrivers/net/usb/aqc111.c:1403:\t\taqc111_data-\u003ephy_cfg |= AQ_LOW_POWER;\ndrivers/net/usb/aqc111.c-1404-\t\taqc111_write32_cmd_nopm(dev, AQ_PHY_OPS, 0, 0,\ndrivers/net/usb/aqc111.c:1405:\t\t\t\t\t\u0026aqc111_data-\u003ephy_cfg);\ndrivers/net/usb/aqc111.c-1406-\n--\ndrivers/net/usb/aqc111.c=1418=static int aqc111_resume(struct usb_interface *intf)\n--\ndrivers/net/usb/aqc111.c-1427-\t/* Power up ethernet PHY */\ndrivers/net/usb/aqc111.c:1428:\taqc111_data-\u003ephy_cfg |= AQ_PHY_POWER_EN;\ndrivers/net/usb/aqc111.c:1429:\taqc111_data-\u003ephy_cfg \u0026= ~AQ_LOW_POWER;\ndrivers/net/usb/aqc111.c:1430:\taqc111_data-\u003ephy_cfg \u0026= ~AQ_WOL;\ndrivers/net/usb/aqc111.c-1431-\n--\ndrivers/net/usb/aqc111.c-1442-\ndrivers/net/usb/aqc111.c:1443:\taqc111_set_phy_speed(dev, aqc111_data-\u003eautoneg,\ndrivers/net/usb/aqc111.c-1444-\t\t\t     aqc111_data-\u003eadvertised_speed);\n--\ndrivers/net/usb/aqc111.h=161=struct aqc111_data {\n--\ndrivers/net/usb/aqc111.h-172-\t} fw_ver;\ndrivers/net/usb/aqc111.h:173:\tu32 phy_cfg;\ndrivers/net/usb/aqc111.h-174-\tu8 wol_flags;\n--\ndrivers/net/usb/asix.h=178=struct asix_common_private {\n--\ndrivers/net/usb/asix.h-181-\tint (*reset)(struct usbnet *dev, int in_pm);\ndrivers/net/usb/asix.h:182:\tu16 presvd_phy_advertise;\ndrivers/net/usb/asix.h:183:\tu16 presvd_phy_bmcr;\ndrivers/net/usb/asix.h-184-\tstruct asix_rx_fixup_info rx_fixup_info;\ndrivers/net/usb/asix.h-185-\tstruct mii_bus *mdio;\ndrivers/net/usb/asix.h:186:\tstruct phy_device *phydev;\ndrivers/net/usb/asix.h:187:\tstruct phy_device *phydev_int;\ndrivers/net/usb/asix.h-188-\tstruct phylink *phylink;\ndrivers/net/usb/asix.h-189-\tstruct phylink_config phylink_config;\ndrivers/net/usb/asix.h:190:\tu16 phy_addr;\ndrivers/net/usb/asix.h-191-\tbool embd_phy;\n--\ndrivers/net/usb/asix.h=214=struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb,\n--\ndrivers/net/usb/asix.h-216-\ndrivers/net/usb/asix.h:217:int asix_read_phy_addr(struct usbnet *dev, bool internal);\ndrivers/net/usb/asix.h-218-\n--\ndrivers/net/usb/asix.h=229=void asix_set_multicast(struct net_device *net);\ndrivers/net/usb/asix.h-230-\ndrivers/net/usb/asix.h:231:int asix_mdio_read(struct net_device *netdev, int phy_id, int loc);\ndrivers/net/usb/asix.h:232:void asix_mdio_write(struct net_device *netdev, int phy_id, int loc, int val);\ndrivers/net/usb/asix.h-233-\ndrivers/net/usb/asix.h:234:int asix_mdio_bus_read(struct mii_bus *bus, int phy_id, int regnum);\ndrivers/net/usb/asix.h:235:int asix_mdio_bus_write(struct mii_bus *bus, int phy_id, int regnum, u16 val);\ndrivers/net/usb/asix.h-236-\ndrivers/net/usb/asix.h:237:int asix_mdio_read_nopm(struct net_device *netdev, int phy_id, int loc);\ndrivers/net/usb/asix.h:238:void asix_mdio_write_nopm(struct net_device *netdev, int phy_id, int loc,\ndrivers/net/usb/asix.h-239-\t\t\t  int val);\n--\ndrivers/net/usb/asix_common.c=265=struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb,\n--\ndrivers/net/usb/asix_common.c-320-\ndrivers/net/usb/asix_common.c:321:int asix_read_phy_addr(struct usbnet *dev, bool internal)\ndrivers/net/usb/asix_common.c-322-{\n--\ndrivers/net/usb/asix_common.c=441=void asix_set_multicast(struct net_device *net)\n--\ndrivers/net/usb/asix_common.c-479-\ndrivers/net/usb/asix_common.c:480:static int __asix_mdio_read(struct net_device *netdev, int phy_id, int loc,\ndrivers/net/usb/asix_common.c-481-\t\t\t    bool in_pm)\n--\ndrivers/net/usb/asix_common.c-486-\ndrivers/net/usb/asix_common.c:487:\tmutex_lock(\u0026dev-\u003ephy_mutex);\ndrivers/net/usb/asix_common.c-488-\n--\ndrivers/net/usb/asix_common.c-490-\tif (ret == -ENODEV || ret == -ETIMEDOUT) {\ndrivers/net/usb/asix_common.c:491:\t\tmutex_unlock(\u0026dev-\u003ephy_mutex);\ndrivers/net/usb/asix_common.c-492-\t\treturn ret;\n--\ndrivers/net/usb/asix_common.c-494-\ndrivers/net/usb/asix_common.c:495:\tret = asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id, (__u16)loc, 2,\ndrivers/net/usb/asix_common.c-496-\t\t\t    \u0026res, in_pm);\n--\ndrivers/net/usb/asix_common.c-501-out:\ndrivers/net/usb/asix_common.c:502:\tmutex_unlock(\u0026dev-\u003ephy_mutex);\ndrivers/net/usb/asix_common.c-503-\ndrivers/net/usb/asix_common.c:504:\tnetdev_dbg(dev-\u003enet, \"asix_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x\\n\",\ndrivers/net/usb/asix_common.c:505:\t\t\tphy_id, loc, le16_to_cpu(res));\ndrivers/net/usb/asix_common.c-506-\n--\ndrivers/net/usb/asix_common.c-509-\ndrivers/net/usb/asix_common.c:510:int asix_mdio_read(struct net_device *netdev, int phy_id, int loc)\ndrivers/net/usb/asix_common.c-511-{\ndrivers/net/usb/asix_common.c:512:\treturn __asix_mdio_read(netdev, phy_id, loc, false);\ndrivers/net/usb/asix_common.c-513-}\ndrivers/net/usb/asix_common.c-514-\ndrivers/net/usb/asix_common.c:515:static int __asix_mdio_write(struct net_device *netdev, int phy_id, int loc,\ndrivers/net/usb/asix_common.c-516-\t\t\t     int val, bool in_pm)\n--\ndrivers/net/usb/asix_common.c-521-\ndrivers/net/usb/asix_common.c:522:\tnetdev_dbg(dev-\u003enet, \"asix_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x\\n\",\ndrivers/net/usb/asix_common.c:523:\t\t\tphy_id, loc, val);\ndrivers/net/usb/asix_common.c-524-\ndrivers/net/usb/asix_common.c:525:\tmutex_lock(\u0026dev-\u003ephy_mutex);\ndrivers/net/usb/asix_common.c-526-\n--\ndrivers/net/usb/asix_common.c-530-\ndrivers/net/usb/asix_common.c:531:\tret = asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, (__u16)loc, 2,\ndrivers/net/usb/asix_common.c-532-\t\t\t     \u0026res, in_pm);\n--\ndrivers/net/usb/asix_common.c-537-out:\ndrivers/net/usb/asix_common.c:538:\tmutex_unlock(\u0026dev-\u003ephy_mutex);\ndrivers/net/usb/asix_common.c-539-\n--\ndrivers/net/usb/asix_common.c-542-\ndrivers/net/usb/asix_common.c:543:void asix_mdio_write(struct net_device *netdev, int phy_id, int loc, int val)\ndrivers/net/usb/asix_common.c-544-{\ndrivers/net/usb/asix_common.c:545:\t__asix_mdio_write(netdev, phy_id, loc, val, false);\ndrivers/net/usb/asix_common.c-546-}\n--\ndrivers/net/usb/asix_common.c-548-/* MDIO read and write wrappers for phylib */\ndrivers/net/usb/asix_common.c:549:int asix_mdio_bus_read(struct mii_bus *bus, int phy_id, int regnum)\ndrivers/net/usb/asix_common.c-550-{\n--\ndrivers/net/usb/asix_common.c-552-\ndrivers/net/usb/asix_common.c:553:\treturn __asix_mdio_read(priv-\u003enet, phy_id, regnum, false);\ndrivers/net/usb/asix_common.c-554-}\ndrivers/net/usb/asix_common.c-555-\ndrivers/net/usb/asix_common.c:556:int asix_mdio_bus_write(struct mii_bus *bus, int phy_id, int regnum, u16 val)\ndrivers/net/usb/asix_common.c-557-{\n--\ndrivers/net/usb/asix_common.c-559-\ndrivers/net/usb/asix_common.c:560:\treturn __asix_mdio_write(priv-\u003enet, phy_id, regnum, val, false);\ndrivers/net/usb/asix_common.c-561-}\ndrivers/net/usb/asix_common.c-562-\ndrivers/net/usb/asix_common.c:563:int asix_mdio_read_nopm(struct net_device *netdev, int phy_id, int loc)\ndrivers/net/usb/asix_common.c-564-{\ndrivers/net/usb/asix_common.c:565:\treturn __asix_mdio_read(netdev, phy_id, loc, true);\ndrivers/net/usb/asix_common.c-566-}\n--\ndrivers/net/usb/asix_common.c=568=void\ndrivers/net/usb/asix_common.c:569:asix_mdio_write_nopm(struct net_device *netdev, int phy_id, int loc, int val)\ndrivers/net/usb/asix_common.c-570-{\ndrivers/net/usb/asix_common.c:571:\t__asix_mdio_write(netdev, phy_id, loc, val, true);\ndrivers/net/usb/asix_common.c-572-}\n--\ndrivers/net/usb/asix_devices.c=70=static u32 asix_get_phyid(struct usbnet *dev)\ndrivers/net/usb/asix_devices.c-71-{\ndrivers/net/usb/asix_devices.c:72:\tint phy_reg;\ndrivers/net/usb/asix_devices.c:73:\tu32 phy_id;\ndrivers/net/usb/asix_devices.c-74-\tint i;\n--\ndrivers/net/usb/asix_devices.c-77-\tfor (i = 0; i \u003c 100; i++) {\ndrivers/net/usb/asix_devices.c:78:\t\tphy_reg = asix_mdio_read(dev-\u003enet, dev-\u003emii.phy_id, MII_PHYSID1);\ndrivers/net/usb/asix_devices.c:79:\t\tif (phy_reg \u003c 0)\ndrivers/net/usb/asix_devices.c-80-\t\t\treturn 0;\ndrivers/net/usb/asix_devices.c:81:\t\tif (phy_reg != 0 \u0026\u0026 phy_reg != 0xFFFF)\ndrivers/net/usb/asix_devices.c-82-\t\t\tbreak;\n--\ndrivers/net/usb/asix_devices.c-85-\ndrivers/net/usb/asix_devices.c:86:\tif (phy_reg \u003c= 0 || phy_reg == 0xFFFF)\ndrivers/net/usb/asix_devices.c-87-\t\treturn 0;\ndrivers/net/usb/asix_devices.c-88-\ndrivers/net/usb/asix_devices.c:89:\tphy_id = (phy_reg \u0026 0xffff) \u003c\u003c 16;\ndrivers/net/usb/asix_devices.c-90-\ndrivers/net/usb/asix_devices.c:91:\tphy_reg = asix_mdio_read(dev-\u003enet, dev-\u003emii.phy_id, MII_PHYSID2);\ndrivers/net/usb/asix_devices.c:92:\tif (phy_reg \u003c 0)\ndrivers/net/usb/asix_devices.c-93-\t\treturn 0;\ndrivers/net/usb/asix_devices.c-94-\ndrivers/net/usb/asix_devices.c:95:\tphy_id |= (phy_reg \u0026 0xffff);\ndrivers/net/usb/asix_devices.c-96-\ndrivers/net/usb/asix_devices.c:97:\treturn phy_id;\ndrivers/net/usb/asix_devices.c-98-}\n--\ndrivers/net/usb/asix_devices.c=177=static const struct net_device_ops ax88172_netdev_ops = {\n--\ndrivers/net/usb/asix_devices.c-189-\ndrivers/net/usb/asix_devices.c:190:static void asix_phy_reset(struct usbnet *dev, unsigned int reset_bits)\ndrivers/net/usb/asix_devices.c-191-{\n--\ndrivers/net/usb/asix_devices.c-193-\ndrivers/net/usb/asix_devices.c:194:\tasix_mdio_write(dev-\u003enet, dev-\u003emii.phy_id, MII_BMCR, reset_bits);\ndrivers/net/usb/asix_devices.c-195-\ndrivers/net/usb/asix_devices.c:196:\t/* give phy_id a chance to process reset */\ndrivers/net/usb/asix_devices.c-197-\tudelay(500);\n--\ndrivers/net/usb/asix_devices.c-200-\twhile (timeout--) {\ndrivers/net/usb/asix_devices.c:201:\t\tif (asix_mdio_read(dev-\u003enet, dev-\u003emii.phy_id, MII_BMCR)\ndrivers/net/usb/asix_devices.c-202-\t\t\t\t\t\t\t\u0026 BMCR_RESET)\n--\ndrivers/net/usb/asix_devices.c-207-\ndrivers/net/usb/asix_devices.c:208:\tnetdev_err(dev-\u003enet, \"BMCR_RESET timeout on phy_id %d\\n\",\ndrivers/net/usb/asix_devices.c:209:\t\t   dev-\u003emii.phy_id);\ndrivers/net/usb/asix_devices.c-210-}\n--\ndrivers/net/usb/asix_devices.c=212=static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)\n--\ndrivers/net/usb/asix_devices.c-250-\tdev-\u003emii.mdio_write = asix_mdio_write;\ndrivers/net/usb/asix_devices.c:251:\tdev-\u003emii.phy_id_mask = 0x3f;\ndrivers/net/usb/asix_devices.c-252-\tdev-\u003emii.reg_num_mask = 0x1f;\ndrivers/net/usb/asix_devices.c-253-\ndrivers/net/usb/asix_devices.c:254:\tdev-\u003emii.phy_id = asix_read_phy_addr(dev, true);\ndrivers/net/usb/asix_devices.c:255:\tif (dev-\u003emii.phy_id \u003c 0)\ndrivers/net/usb/asix_devices.c:256:\t\treturn dev-\u003emii.phy_id;\ndrivers/net/usb/asix_devices.c-257-\n--\ndrivers/net/usb/asix_devices.c-262-\ndrivers/net/usb/asix_devices.c:263:\tasix_phy_reset(dev, BMCR_RESET);\ndrivers/net/usb/asix_devices.c:264:\tasix_mdio_write(dev-\u003enet, dev-\u003emii.phy_id, MII_ADVERTISE,\ndrivers/net/usb/asix_devices.c-265-\t\tADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP);\n--\ndrivers/net/usb/asix_devices.c=312=static const struct ethtool_ops ax88772_ethtool_ops = {\n--\ndrivers/net/usb/asix_devices.c-321-\t.set_eeprom\t\t= asix_set_eeprom,\ndrivers/net/usb/asix_devices.c:322:\t.nway_reset\t\t= phy_ethtool_nway_reset,\ndrivers/net/usb/asix_devices.c:323:\t.get_link_ksettings\t= phy_ethtool_get_link_ksettings,\ndrivers/net/usb/asix_devices.c:324:\t.set_link_ksettings\t= phy_ethtool_set_link_ksettings,\ndrivers/net/usb/asix_devices.c-325-\t.self_test\t\t= net_selftest,\n--\ndrivers/net/usb/asix_devices.c=362=static int ax88772_hw_reset(struct usbnet *dev, int in_pm)\n--\ndrivers/net/usb/asix_devices.c-406-\ndrivers/net/usb/asix_devices.c:407:\tif (in_pm \u0026\u0026 (!asix_mdio_read_nopm(dev-\u003enet, dev-\u003emii.phy_id,\ndrivers/net/usb/asix_devices.c-408-\t\t\t\t\t   MII_PHYSID1))){\n--\ndrivers/net/usb/asix_devices.c=456=static int ax88772a_hw_reset(struct usbnet *dev, int in_pm)\n--\ndrivers/net/usb/asix_devices.c-496-\ndrivers/net/usb/asix_devices.c:497:\tif (in_pm \u0026\u0026 (!asix_mdio_read_nopm(dev-\u003enet, dev-\u003emii.phy_id,\ndrivers/net/usb/asix_devices.c-498-\t\t\t\t\t   MII_PHYSID1))) {\n--\ndrivers/net/usb/asix_devices.c-512-\t\t/* Check if the PHY registers have default settings */\ndrivers/net/usb/asix_devices.c:513:\t\tphy14h = asix_mdio_read_nopm(dev-\u003enet, dev-\u003emii.phy_id,\ndrivers/net/usb/asix_devices.c-514-\t\t\t\t\t     AX88772A_PHY14H);\ndrivers/net/usb/asix_devices.c:515:\t\tphy15h = asix_mdio_read_nopm(dev-\u003enet, dev-\u003emii.phy_id,\ndrivers/net/usb/asix_devices.c-516-\t\t\t\t\t     AX88772A_PHY15H);\ndrivers/net/usb/asix_devices.c:517:\t\tphy16h = asix_mdio_read_nopm(dev-\u003enet, dev-\u003emii.phy_id,\ndrivers/net/usb/asix_devices.c-518-\t\t\t\t\t     AX88772A_PHY16H);\n--\ndrivers/net/usb/asix_devices.c-525-\t\tif (phy14h != AX88772A_PHY14H_DEFAULT)\ndrivers/net/usb/asix_devices.c:526:\t\t\tasix_mdio_write_nopm(dev-\u003enet, dev-\u003emii.phy_id,\ndrivers/net/usb/asix_devices.c-527-\t\t\t\t\t     AX88772A_PHY14H,\n--\ndrivers/net/usb/asix_devices.c-529-\t\tif (phy15h != AX88772A_PHY15H_DEFAULT)\ndrivers/net/usb/asix_devices.c:530:\t\t\tasix_mdio_write_nopm(dev-\u003enet, dev-\u003emii.phy_id,\ndrivers/net/usb/asix_devices.c-531-\t\t\t\t\t     AX88772A_PHY15H,\n--\ndrivers/net/usb/asix_devices.c-533-\t\tif (phy16h != AX88772A_PHY16H_DEFAULT)\ndrivers/net/usb/asix_devices.c:534:\t\t\tasix_mdio_write_nopm(dev-\u003enet, dev-\u003emii.phy_id,\ndrivers/net/usb/asix_devices.c-535-\t\t\t\t\t     AX88772A_PHY16H,\n--\ndrivers/net/usb/asix_devices.c=583=static const struct net_device_ops ax88772_netdev_ops = {\n--\ndrivers/net/usb/asix_devices.c-591-\t.ndo_validate_addr\t= eth_validate_addr,\ndrivers/net/usb/asix_devices.c:592:\t.ndo_eth_ioctl\t\t= phy_do_ioctl_running,\ndrivers/net/usb/asix_devices.c-593-\t.ndo_set_rx_mode        = asix_set_multicast,\n--\ndrivers/net/usb/asix_devices.c=669=static int ax88772_init_mdio(struct usbnet *dev)\n--\ndrivers/net/usb/asix_devices.c-681-\tpriv-\u003emdio-\u003ename = \"Asix MDIO Bus\";\ndrivers/net/usb/asix_devices.c:682:\tpriv-\u003emdio-\u003ephy_mask = ~(BIT(priv-\u003ephy_addr \u0026 0x1f) | BIT(AX_EMBD_PHY_ADDR));\ndrivers/net/usb/asix_devices.c-683-\t/* mii bus name is usb-\u003cusb bus number\u003e-\u003cusb device number\u003e */\n--\ndrivers/net/usb/asix_devices.c=703=static int ax88772_init_phy(struct usbnet *dev)\n--\ndrivers/net/usb/asix_devices.c-707-\ndrivers/net/usb/asix_devices.c:708:\tpriv-\u003ephydev = mdiobus_get_phy(priv-\u003emdio, priv-\u003ephy_addr);\ndrivers/net/usb/asix_devices.c-709-\tif (!priv-\u003ephydev) {\n--\ndrivers/net/usb/asix_devices.c-719-\ndrivers/net/usb/asix_devices.c:720:\tphy_suspend(priv-\u003ephydev);\ndrivers/net/usb/asix_devices.c-721-\tpriv-\u003ephydev-\u003emac_managed_pm = true;\ndrivers/net/usb/asix_devices.c-722-\ndrivers/net/usb/asix_devices.c:723:\tphy_attached_info(priv-\u003ephydev);\ndrivers/net/usb/asix_devices.c-724-\n--\ndrivers/net/usb/asix_devices.c-741-\tpriv-\u003ephydev_int-\u003emac_managed_pm = true;\ndrivers/net/usb/asix_devices.c:742:\tphy_suspend(priv-\u003ephydev_int);\ndrivers/net/usb/asix_devices.c-743-\n--\ndrivers/net/usb/asix_devices.c=753=static void ax88772_mac_link_down(struct phylink_config *config,\ndrivers/net/usb/asix_devices.c:754:\t\t\t\t unsigned int mode, phy_interface_t interface)\ndrivers/net/usb/asix_devices.c-755-{\n--\ndrivers/net/usb/asix_devices.c=762=static void ax88772_mac_link_up(struct phylink_config *config,\ndrivers/net/usb/asix_devices.c:763:\t\t\t       struct phy_device *phy,\ndrivers/net/usb/asix_devices.c:764:\t\t\t       unsigned int mode, phy_interface_t interface,\ndrivers/net/usb/asix_devices.c-765-\t\t\t       int speed, int duplex,\n--\ndrivers/net/usb/asix_devices.c=799=static int ax88772_phylink_setup(struct usbnet *dev)\n--\ndrivers/net/usb/asix_devices.c-801-\tstruct asix_common_private *priv = dev-\u003edriver_priv;\ndrivers/net/usb/asix_devices.c:802:\tphy_interface_t phy_if_mode;\ndrivers/net/usb/asix_devices.c-803-\tstruct phylink *phylink;\n--\ndrivers/net/usb/asix_devices.c-815-\tif (priv-\u003eembd_phy)\ndrivers/net/usb/asix_devices.c:816:\t\tphy_if_mode = PHY_INTERFACE_MODE_INTERNAL;\ndrivers/net/usb/asix_devices.c-817-\telse\ndrivers/net/usb/asix_devices.c:818:\t\tphy_if_mode = PHY_INTERFACE_MODE_RMII;\ndrivers/net/usb/asix_devices.c-819-\ndrivers/net/usb/asix_devices.c-820-\tphylink = phylink_create(\u0026priv-\u003ephylink_config, dev-\u003enet-\u003edev.fwnode,\ndrivers/net/usb/asix_devices.c:821:\t\t\t\t phy_if_mode, \u0026ax88772_phylink_mac_ops);\ndrivers/net/usb/asix_devices.c-822-\tif (IS_ERR(phylink))\n--\ndrivers/net/usb/asix_devices.c=829=static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)\n--\ndrivers/net/usb/asix_devices.c-877-\ndrivers/net/usb/asix_devices.c:878:\tret = asix_read_phy_addr(dev, true);\ndrivers/net/usb/asix_devices.c-879-\tif (ret \u003c 0)\n--\ndrivers/net/usb/asix_devices.c-881-\ndrivers/net/usb/asix_devices.c:882:\tpriv-\u003ephy_addr = ret;\ndrivers/net/usb/asix_devices.c:883:\tpriv-\u003eembd_phy = ((priv-\u003ephy_addr \u0026 0x1f) == AX_EMBD_PHY_ADDR);\ndrivers/net/usb/asix_devices.c-884-\n--\ndrivers/net/usb/asix_devices.c-913-\ndrivers/net/usb/asix_devices.c:914:\tpriv-\u003epresvd_phy_bmcr = 0;\ndrivers/net/usb/asix_devices.c:915:\tpriv-\u003epresvd_phy_advertise = 0;\ndrivers/net/usb/asix_devices.c-916-\n--\ndrivers/net/usb/asix_devices.c-926-\tif (ret)\ndrivers/net/usb/asix_devices.c:927:\t\tgoto initphy_err;\ndrivers/net/usb/asix_devices.c-928-\n--\ndrivers/net/usb/asix_devices.c-937-\ndrivers/net/usb/asix_devices.c:938:initphy_err:\ndrivers/net/usb/asix_devices.c-939-\tphylink_destroy(priv-\u003ephylink);\n--\ndrivers/net/usb/asix_devices.c=975=static const struct ethtool_ops ax88178_ethtool_ops = {\n--\ndrivers/net/usb/asix_devices.c-989-\ndrivers/net/usb/asix_devices.c:990:static int marvell_phy_init(struct usbnet *dev)\ndrivers/net/usb/asix_devices.c-991-{\n--\ndrivers/net/usb/asix_devices.c-994-\ndrivers/net/usb/asix_devices.c:995:\tnetdev_dbg(dev-\u003enet, \"marvell_phy_init()\\n\");\ndrivers/net/usb/asix_devices.c-996-\ndrivers/net/usb/asix_devices.c:997:\treg = asix_mdio_read(dev-\u003enet, dev-\u003emii.phy_id, MII_MARVELL_STATUS);\ndrivers/net/usb/asix_devices.c-998-\tnetdev_dbg(dev-\u003enet, \"MII_MARVELL_STATUS = 0x%04x\\n\", reg);\ndrivers/net/usb/asix_devices.c-999-\ndrivers/net/usb/asix_devices.c:1000:\tasix_mdio_write(dev-\u003enet, dev-\u003emii.phy_id, MII_MARVELL_CTRL,\ndrivers/net/usb/asix_devices.c-1001-\t\t\tMARVELL_CTRL_RXDELAY | MARVELL_CTRL_TXDELAY);\n--\ndrivers/net/usb/asix_devices.c-1003-\tif (data-\u003eledmode) {\ndrivers/net/usb/asix_devices.c:1004:\t\treg = asix_mdio_read(dev-\u003enet, dev-\u003emii.phy_id,\ndrivers/net/usb/asix_devices.c-1005-\t\t\tMII_MARVELL_LED_CTRL);\n--\ndrivers/net/usb/asix_devices.c-1009-\t\treg |= (1 + 0x0100);\ndrivers/net/usb/asix_devices.c:1010:\t\tasix_mdio_write(dev-\u003enet, dev-\u003emii.phy_id,\ndrivers/net/usb/asix_devices.c-1011-\t\t\tMII_MARVELL_LED_CTRL, reg);\ndrivers/net/usb/asix_devices.c-1012-\ndrivers/net/usb/asix_devices.c:1013:\t\treg = asix_mdio_read(dev-\u003enet, dev-\u003emii.phy_id,\ndrivers/net/usb/asix_devices.c-1014-\t\t\tMII_MARVELL_LED_CTRL);\n--\ndrivers/net/usb/asix_devices.c-1020-\ndrivers/net/usb/asix_devices.c:1021:static int rtl8211cl_phy_init(struct usbnet *dev)\ndrivers/net/usb/asix_devices.c-1022-{\n--\ndrivers/net/usb/asix_devices.c-1024-\ndrivers/net/usb/asix_devices.c:1025:\tnetdev_dbg(dev-\u003enet, \"rtl8211cl_phy_init()\\n\");\ndrivers/net/usb/asix_devices.c-1026-\ndrivers/net/usb/asix_devices.c:1027:\tasix_mdio_write (dev-\u003enet, dev-\u003emii.phy_id, 0x1f, 0x0005);\ndrivers/net/usb/asix_devices.c:1028:\tasix_mdio_write (dev-\u003enet, dev-\u003emii.phy_id, 0x0c, 0);\ndrivers/net/usb/asix_devices.c:1029:\tasix_mdio_write (dev-\u003enet, dev-\u003emii.phy_id, 0x01,\ndrivers/net/usb/asix_devices.c:1030:\t\tasix_mdio_read (dev-\u003enet, dev-\u003emii.phy_id, 0x01) | 0x0080);\ndrivers/net/usb/asix_devices.c:1031:\tasix_mdio_write (dev-\u003enet, dev-\u003emii.phy_id, 0x1f, 0);\ndrivers/net/usb/asix_devices.c-1032-\ndrivers/net/usb/asix_devices.c-1033-\tif (data-\u003eledmode == 12) {\ndrivers/net/usb/asix_devices.c:1034:\t\tasix_mdio_write (dev-\u003enet, dev-\u003emii.phy_id, 0x1f, 0x0002);\ndrivers/net/usb/asix_devices.c:1035:\t\tasix_mdio_write (dev-\u003enet, dev-\u003emii.phy_id, 0x1a, 0x00cb);\ndrivers/net/usb/asix_devices.c:1036:\t\tasix_mdio_write (dev-\u003enet, dev-\u003emii.phy_id, 0x1f, 0);\ndrivers/net/usb/asix_devices.c-1037-\t}\n--\ndrivers/net/usb/asix_devices.c=1042=static int marvell_led_status(struct usbnet *dev, u16 speed)\ndrivers/net/usb/asix_devices.c-1043-{\ndrivers/net/usb/asix_devices.c:1044:\tu16 reg = asix_mdio_read(dev-\u003enet, dev-\u003emii.phy_id, MARVELL_LED_MANUAL);\ndrivers/net/usb/asix_devices.c-1045-\n--\ndrivers/net/usb/asix_devices.c-1062-\tnetdev_dbg(dev-\u003enet, \"marvell_led_status() writing 0x%04x\\n\", reg);\ndrivers/net/usb/asix_devices.c:1063:\tasix_mdio_write(dev-\u003enet, dev-\u003emii.phy_id, MARVELL_LED_MANUAL, reg);\ndrivers/net/usb/asix_devices.c-1064-\n--\ndrivers/net/usb/asix_devices.c=1068=static int ax88178_reset(struct usbnet *dev)\n--\ndrivers/net/usb/asix_devices.c-1135-\tif (data-\u003ephymode == PHY_MODE_MARVELL) {\ndrivers/net/usb/asix_devices.c:1136:\t\tmarvell_phy_init(dev);\ndrivers/net/usb/asix_devices.c-1137-\t\tmsleep(60);\ndrivers/net/usb/asix_devices.c-1138-\t} else if (data-\u003ephymode == PHY_MODE_RTL8211CL)\ndrivers/net/usb/asix_devices.c:1139:\t\trtl8211cl_phy_init(dev);\ndrivers/net/usb/asix_devices.c-1140-\ndrivers/net/usb/asix_devices.c:1141:\tasix_phy_reset(dev, BMCR_RESET | BMCR_ANENABLE);\ndrivers/net/usb/asix_devices.c:1142:\tasix_mdio_write(dev-\u003enet, dev-\u003emii.phy_id, MII_ADVERTISE,\ndrivers/net/usb/asix_devices.c-1143-\t\t\tADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP);\ndrivers/net/usb/asix_devices.c:1144:\tasix_mdio_write(dev-\u003enet, dev-\u003emii.phy_id, MII_CTRL1000,\ndrivers/net/usb/asix_devices.c-1145-\t\t\tADVERTISE_1000FULL);\n--\ndrivers/net/usb/asix_devices.c=1271=static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)\n--\ndrivers/net/usb/asix_devices.c-1292-\tdev-\u003emii.mdio_write = asix_mdio_write;\ndrivers/net/usb/asix_devices.c:1293:\tdev-\u003emii.phy_id_mask = 0x1f;\ndrivers/net/usb/asix_devices.c-1294-\tdev-\u003emii.reg_num_mask = 0xff;\n--\ndrivers/net/usb/asix_devices.c-1296-\ndrivers/net/usb/asix_devices.c:1297:\tdev-\u003emii.phy_id = asix_read_phy_addr(dev, true);\ndrivers/net/usb/asix_devices.c:1298:\tif (dev-\u003emii.phy_id \u003c 0)\ndrivers/net/usb/asix_devices.c:1299:\t\treturn dev-\u003emii.phy_id;\ndrivers/net/usb/asix_devices.c-1300-\n--\ndrivers/net/usb/ax88172a.c=18=struct ax88172a_private {\ndrivers/net/usb/ax88172a.c-19-\tstruct mii_bus *mdio;\n\n"
}

13/2 2026/09/14 23:07 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 33026
							output: 36
							thoughts: 36
						

Thoughts:
Here's my summary, as though I'm thinking through this process:

**Diving into the AX88172A Driver**

Okay, time to get down to brass tacks. I need to understand this AX88172A USB Ethernet adapter code, so let's start with the heart of the matter. The logical starting point is the driver itself, so I'm heading directly into `ax88172a.c`. More specifically, I should look in the `drivers/net/usb/` directory since this is a USB-connected network device. Got it! Let's see what `drivers/net/usb/ax88172a.c` holds. Time to dig in and understand this implementation!



14/2 2026/09/14 23:07 tool grepper
0m Args:
{
  "Expression": "phy",
  "PathPrefix": "drivers/net/usb/ax88172a.c"
}

Results:
{
  "Output": "drivers/net/usb/ax88172a.c-5- *\ndrivers/net/usb/ax88172a.c:6: * Supports external PHYs via phylib. Based on the driver for the\ndrivers/net/usb/ax88172a.c-7- * AX88772. Original copyrights follow:\n--\ndrivers/net/usb/ax88172a.c-15-#include \"asix.h\"\ndrivers/net/usb/ax88172a.c:16:#include \u003clinux/phy.h\u003e\ndrivers/net/usb/ax88172a.c-17-\ndrivers/net/usb/ax88172a.c=18=struct ax88172a_private {\ndrivers/net/usb/ax88172a.c-19-\tstruct mii_bus *mdio;\ndrivers/net/usb/ax88172a.c:20:\tstruct phy_device *phydev;\ndrivers/net/usb/ax88172a.c:21:\tchar phy_name[PHY_ID_SIZE];\ndrivers/net/usb/ax88172a.c:22:\tu8 phy_addr;\ndrivers/net/usb/ax88172a.c-23-\tu16 oldmode;\ndrivers/net/usb/ax88172a.c:24:\tint use_embdphy;\ndrivers/net/usb/ax88172a.c-25-\tstruct asix_rx_fixup_info rx_fixup_info;\n--\ndrivers/net/usb/ax88172a.c-27-\ndrivers/net/usb/ax88172a.c:28:/* set MAC link settings according to information from phylib */\ndrivers/net/usb/ax88172a.c-29-static void ax88172a_adjust_link(struct net_device *netdev)\ndrivers/net/usb/ax88172a.c-30-{\ndrivers/net/usb/ax88172a.c:31:\tstruct phy_device *phydev = netdev-\u003ephydev;\ndrivers/net/usb/ax88172a.c-32-\tstruct usbnet *dev = netdev_priv(netdev);\n--\ndrivers/net/usb/ax88172a.c-35-\ndrivers/net/usb/ax88172a.c:36:\tif (phydev-\u003elink) {\ndrivers/net/usb/ax88172a.c-37-\t\tmode = AX88772_MEDIUM_DEFAULT;\ndrivers/net/usb/ax88172a.c-38-\ndrivers/net/usb/ax88172a.c:39:\t\tif (phydev-\u003eduplex == DUPLEX_HALF)\ndrivers/net/usb/ax88172a.c-40-\t\t\tmode \u0026= ~AX_MEDIUM_FD;\ndrivers/net/usb/ax88172a.c-41-\ndrivers/net/usb/ax88172a.c:42:\t\tif (phydev-\u003espeed != SPEED_100)\ndrivers/net/usb/ax88172a.c-43-\t\t\tmode \u0026= ~AX_MEDIUM_PS;\n--\ndrivers/net/usb/ax88172a.c-49-\t\tnetdev_dbg(netdev, \"speed %u duplex %d, setting mode to 0x%04x\\n\",\ndrivers/net/usb/ax88172a.c:50:\t\t\t   phydev-\u003espeed, phydev-\u003eduplex, mode);\ndrivers/net/usb/ax88172a.c:51:\t\tphy_print_status(phydev);\ndrivers/net/usb/ax88172a.c-52-\t}\n--\ndrivers/net/usb/ax88172a.c=55=static void ax88172a_status(struct usbnet *dev, struct urb *urb)\ndrivers/net/usb/ax88172a.c-56-{\ndrivers/net/usb/ax88172a.c:57:\t/* link changes are detected by polling the phy */\ndrivers/net/usb/ax88172a.c-58-}\ndrivers/net/usb/ax88172a.c-59-\ndrivers/net/usb/ax88172a.c:60:/* use phylib infrastructure */\ndrivers/net/usb/ax88172a.c-61-static int ax88172a_init_mdio(struct usbnet *dev)\n--\ndrivers/net/usb/ax88172a.c=103=static const struct net_device_ops ax88172a_netdev_ops = {\n--\ndrivers/net/usb/ax88172a.c-111-\t.ndo_validate_addr\t= eth_validate_addr,\ndrivers/net/usb/ax88172a.c:112:\t.ndo_eth_ioctl\t\t= phy_do_ioctl_running,\ndrivers/net/usb/ax88172a.c-113-\t.ndo_set_rx_mode        = asix_set_multicast,\n--\ndrivers/net/usb/ax88172a.c=116=static const struct ethtool_ops ax88172a_ethtool_ops = {\n--\ndrivers/net/usb/ax88172a.c-125-\t.set_eeprom\t\t= asix_set_eeprom,\ndrivers/net/usb/ax88172a.c:126:\t.nway_reset\t\t= phy_ethtool_nway_reset,\ndrivers/net/usb/ax88172a.c:127:\t.get_link_ksettings\t= phy_ethtool_get_link_ksettings,\ndrivers/net/usb/ax88172a.c:128:\t.set_link_ksettings\t= phy_ethtool_set_link_ksettings,\ndrivers/net/usb/ax88172a.c-129-};\ndrivers/net/usb/ax88172a.c-130-\ndrivers/net/usb/ax88172a.c:131:static int ax88172a_reset_phy(struct usbnet *dev, int embd_phy)\ndrivers/net/usb/ax88172a.c-132-{\n--\ndrivers/net/usb/ax88172a.c-145-\ndrivers/net/usb/ax88172a.c:146:\tret = asix_sw_reset(dev, embd_phy ? AX_SWRESET_IPRL : AX_SWRESET_IPPD,\ndrivers/net/usb/ax88172a.c-147-\t\t\t    0);\n--\ndrivers/net/usb/ax88172a.c=158=static int ax88172a_bind(struct usbnet *dev, struct usb_interface *intf)\n--\ndrivers/net/usb/ax88172a.c-185-\ndrivers/net/usb/ax88172a.c:186:\t/* are we using the internal or the external phy? */\ndrivers/net/usb/ax88172a.c-187-\tret = asix_read_cmd(dev, AX_CMD_SW_PHY_STATUS, 0, 0, 1, buf, 0);\n--\ndrivers/net/usb/ax88172a.c-196-\tcase AX_PHY_SELECT_INTERNAL:\ndrivers/net/usb/ax88172a.c:197:\t\tnetdev_dbg(dev-\u003enet, \"use internal phy\\n\");\ndrivers/net/usb/ax88172a.c:198:\t\tpriv-\u003euse_embdphy = 1;\ndrivers/net/usb/ax88172a.c-199-\t\tbreak;\ndrivers/net/usb/ax88172a.c-200-\tcase AX_PHY_SELECT_EXTERNAL:\ndrivers/net/usb/ax88172a.c:201:\t\tnetdev_dbg(dev-\u003enet, \"use external phy\\n\");\ndrivers/net/usb/ax88172a.c:202:\t\tpriv-\u003euse_embdphy = 0;\ndrivers/net/usb/ax88172a.c-203-\t\tbreak;\n--\ndrivers/net/usb/ax88172a.c-209-\ndrivers/net/usb/ax88172a.c:210:\tret = asix_read_phy_addr(dev, priv-\u003euse_embdphy);\ndrivers/net/usb/ax88172a.c-211-\tif (ret \u003c 0)\n--\ndrivers/net/usb/ax88172a.c-213-\ndrivers/net/usb/ax88172a.c:214:\tpriv-\u003ephy_addr = ret;\ndrivers/net/usb/ax88172a.c-215-\ndrivers/net/usb/ax88172a.c:216:\tax88172a_reset_phy(dev, priv-\u003euse_embdphy);\ndrivers/net/usb/ax88172a.c-217-\n--\ndrivers/net/usb/ax88172a.c=237=static int ax88172a_stop(struct usbnet *dev)\n--\ndrivers/net/usb/ax88172a.c-242-\ndrivers/net/usb/ax88172a.c:243:\tif (priv-\u003ephydev) {\ndrivers/net/usb/ax88172a.c:244:\t\tnetdev_info(dev-\u003enet, \"Disconnecting from phy %s\\n\",\ndrivers/net/usb/ax88172a.c:245:\t\t\t    priv-\u003ephy_name);\ndrivers/net/usb/ax88172a.c:246:\t\tphy_stop(priv-\u003ephydev);\ndrivers/net/usb/ax88172a.c:247:\t\tphy_disconnect(priv-\u003ephydev);\ndrivers/net/usb/ax88172a.c-248-\t}\n--\ndrivers/net/usb/ax88172a.c=261=static int ax88172a_reset(struct usbnet *dev)\n--\ndrivers/net/usb/ax88172a.c-267-\ndrivers/net/usb/ax88172a.c:268:\tax88172a_reset_phy(dev, priv-\u003euse_embdphy);\ndrivers/net/usb/ax88172a.c-269-\n--\ndrivers/net/usb/ax88172a.c-310-\t/* Connect to PHY */\ndrivers/net/usb/ax88172a.c:311:\tsnprintf(priv-\u003ephy_name, sizeof(priv-\u003ephy_name), PHY_ID_FMT,\ndrivers/net/usb/ax88172a.c:312:\t\t priv-\u003emdio-\u003eid, priv-\u003ephy_addr);\ndrivers/net/usb/ax88172a.c-313-\ndrivers/net/usb/ax88172a.c:314:\tpriv-\u003ephydev = phy_connect(dev-\u003enet, priv-\u003ephy_name,\ndrivers/net/usb/ax88172a.c-315-\t\t\t\t   \u0026ax88172a_adjust_link,\ndrivers/net/usb/ax88172a.c-316-\t\t\t\t   PHY_INTERFACE_MODE_MII);\ndrivers/net/usb/ax88172a.c:317:\tif (IS_ERR(priv-\u003ephydev)) {\ndrivers/net/usb/ax88172a.c-318-\t\tnetdev_err(dev-\u003enet, \"Could not connect to PHY device %s\\n\",\ndrivers/net/usb/ax88172a.c:319:\t\t\t   priv-\u003ephy_name);\ndrivers/net/usb/ax88172a.c:320:\t\tret = PTR_ERR(priv-\u003ephydev);\ndrivers/net/usb/ax88172a.c-321-\t\tgoto out;\n--\ndrivers/net/usb/ax88172a.c-323-\ndrivers/net/usb/ax88172a.c:324:\tnetdev_info(dev-\u003enet, \"Connected to phy %s\\n\", priv-\u003ephy_name);\ndrivers/net/usb/ax88172a.c-325-\n--\ndrivers/net/usb/ax88172a.c-328-\t */\ndrivers/net/usb/ax88172a.c:329:\tgenphy_resume(priv-\u003ephydev);\ndrivers/net/usb/ax88172a.c:330:\tphy_start(priv-\u003ephydev);\ndrivers/net/usb/ax88172a.c-331-\n"
}

15/2 2026/09/14 23:07 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 36678
							output: 23
							thoughts: 386
						

Thoughts:
**Analyzing a USB Network Adapter Driver Fix**

Okay, so I'm looking at this `ax88172a` USB network adapter driver. It's in `drivers/net/usb/`, controlled by `CONFIG_USB_NET_AX88172A`.  My initial thought is that when a USB device gets plugged in, which syzkaller can easily emulate, `ax88172a_reset` is going to be called, and that in turn calls `phy_connect`, which then drills down to `phy_connect_direct`, and finally `phy_attach_direct`.

But wait a minute… are there other drivers that might use this same mechanism?  I need to consider all the possibilities. What about DSA? Or those lower-level MDIO interfaces, like mdio-gpio, mdio-bitbang, or even virtio?

And the crucial question: does syzkaller even *test* the MDIO/PHY aspects of the kernel? That's what I really need to know, otherwise, I might be wasting my time.

Okay, let's see. The best way to understand this is to figure out the original problem that this patch fixed. The fix is probably related to syzkaller findings, so let's check syzkaller commit logs or maybe syzkaller issues for a clue.

No `git log`? Fine, let's look for a workaround. Can I use `grepper` or check the syzkaller issues to dig into this? That's probably the fastest path to understanding.

Wait, the prompt says the commit message is: `commit 0ca6eb7183eedad1bd175ed3055e7e6f810559cb`. Let me read that… Oh, it says "syz-cluster: applied patch under review".

Right, let me see if I can find the critical comment in the patch: `/* d->driver outlives phydev->drv on unbind, precedes it on bind */`. That's a good clue. That's a classic race condition or lifetime issue.  Now, I need to use this information.

I'm going to search using grepper or find recent commits that touch `phy_attach_direct` or, even better, `phy_device.c`. That should give me a better understanding of the bug and how to fix it.



16/2 2026/09/14 23:07 tool grepper
0m Args:
{
  "Expression": "d-\u003edriver outlives phydev-\u003edrv"
}

Results:
{
  "Output": "drivers/net/phy/phy_device.c=1752=int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,\n--\ndrivers/net/phy/phy_device.c-1784-\t} else if (!phydev-\u003edrv) {\ndrivers/net/phy/phy_device.c:1785:\t\t/* d-\u003edriver outlives phydev-\u003edrv on unbind, precedes it on bind */\ndrivers/net/phy/phy_device.c-1786-\t\terr = -EBUSY;\n"
}

17/2 2026/09/14 23:07 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 37753
							output: 29
							thoughts: 331
						

Thoughts:
**Analyzing PHY Device Driver Attachment**

Okay, let's break this down. I'm looking at `phy_attach_direct` in `phy_device.c`. Specifically, I'm trying to understand the driver attachment process. It seems that the function `phy_attach_direct` is responsible for attaching a PHY device directly to a network device.

I see that it's getting a reference to the device with `get_device(d)`. Now, the crucial part is this conditional block: If `d->driver` isn't assigned, it's assumed there's no specific driver. In this scenario, it proceeds by assigning either `genphy_c45_driver.mdiodrv.driver` or `genphy_driver.mdiodrv.driver` based on whether `phydev->is_c45` is set.  This makes the device generic. That makes sense, handling a fallback.

However, the more intriguing case, is that if `d->driver` *is* present, it then checks for `phydev->drv`. Here's the kicker: *if* `!phydev->drv`, then it bails out with an `-EBUSY` error. That's a strong indication of some important relationship at play here. It looks like `d->driver` is a more general device driver, perhaps, and `phydev->drv` represents a more specific PHY driver. The comment, "*d->driver outlives phydev->drv on unbind, precedes it on bind*", is important. It implies some potential ordering dependencies during the driver lifecycle. *What is `phydev->drv`?* I need to figure out what sets this variable. Let's trace this back in the code. I need to find where and how `phydev->drv` is actually assigned! Time to search for `phydev->drv` within this file.



18/2 2026/09/14 23:07 tool grepper
0m Args:
{
  "Expression": "phydev-\u003edrv",
  "PathPrefix": "drivers/net/phy"
}

Results:
{
  "Output": "\nFull output is too long, showing 500 out of 829 lines.\nUse more precise expression if possible.\n\ndrivers/net/phy/aquantia/aquantia_main.c=524=static phy_interface_t aqr_translate_interface(struct phy_device *phydev,\n--\ndrivers/net/phy/aquantia/aquantia_main.c-528-\ndrivers/net/phy/aquantia/aquantia_main.c:529:\tif (phy_id_compare(phydev-\u003edrv-\u003ephy_id, PHY_ID_AQR412C, phydev-\u003edrv-\u003ephy_id_mask) \u0026\u0026\ndrivers/net/phy/aquantia/aquantia_main.c-530-\t    priv-\u003efingerprint == AQR_G3_V4_3_C_AQR_NXP_SPF_30841_MUSX_ID40019_VER1198 \u0026\u0026\n--\ndrivers/net/phy/bcm-cygnus.c=128=static int bcm_omega_config_init(struct phy_device *phydev)\n--\ndrivers/net/phy/bcm-cygnus.c-132-\ndrivers/net/phy/bcm-cygnus.c:133:\trev = phydev-\u003ephy_id \u0026 ~phydev-\u003edrv-\u003ephy_id_mask;\ndrivers/net/phy/bcm-cygnus.c-134-\ndrivers/net/phy/bcm-cygnus.c-135-\tpr_info_once(\"%s: %s PHY revision: 0x%02x\\n\",\ndrivers/net/phy/bcm-cygnus.c:136:\t\t     phydev_name(phydev), phydev-\u003edrv-\u003ename, rev);\ndrivers/net/phy/bcm-cygnus.c-137-\n--\ndrivers/net/phy/bcm54140.c=505=static int bcm54140_get_base_addr_and_port(struct phy_device *phydev)\n--\ndrivers/net/phy/bcm54140.c-555-\t\t/* see if it is still the same PHY */\ndrivers/net/phy/bcm54140.c:556:\t\tif ((phy_id \u0026 phydev-\u003edrv-\u003ephy_id_mask) !=\ndrivers/net/phy/bcm54140.c:557:\t\t    (phydev-\u003edrv-\u003ephy_id \u0026 phydev-\u003edrv-\u003ephy_id_mask)) {\ndrivers/net/phy/bcm54140.c-558-\t\t\taddr = phydev-\u003emdio.addr;\n--\ndrivers/net/phy/bcm7xxx.c=143=static int bcm7xxx_28nm_config_init(struct phy_device *phydev)\n--\ndrivers/net/phy/bcm7xxx.c-153-\tif (rev == 0)\ndrivers/net/phy/bcm7xxx.c:154:\t\trev = phydev-\u003ephy_id \u0026 ~phydev-\u003edrv-\u003ephy_id_mask;\ndrivers/net/phy/bcm7xxx.c-155-\ndrivers/net/phy/bcm7xxx.c-156-\tpr_info_once(\"%s: %s PHY revision: 0x%02x, patch: %d\\n\",\ndrivers/net/phy/bcm7xxx.c:157:\t\t     phydev_name(phydev), phydev-\u003edrv-\u003ename, rev, patch);\ndrivers/net/phy/bcm7xxx.c-158-\n--\ndrivers/net/phy/bcm7xxx.c=388=static int bcm7xxx_28nm_ephy_config_init(struct phy_device *phydev)\ndrivers/net/phy/bcm7xxx.c-389-{\ndrivers/net/phy/bcm7xxx.c:390:\tu8 rev = phydev-\u003ephy_id \u0026 ~phydev-\u003edrv-\u003ephy_id_mask;\ndrivers/net/phy/bcm7xxx.c-391-\tint ret = 0;\n--\ndrivers/net/phy/bcm7xxx.c-393-\tpr_info_once(\"%s: %s PHY revision: 0x%02x\\n\",\ndrivers/net/phy/bcm7xxx.c:394:\t\t     phydev_name(phydev), phydev-\u003edrv-\u003ename, rev);\ndrivers/net/phy/bcm7xxx.c-395-\n--\ndrivers/net/phy/broadcom.c=237=static int bcm54xx_phydsp_config(struct phy_device *phydev)\n--\ndrivers/net/phy/broadcom.c-248-\ndrivers/net/phy/broadcom.c:249:\tif (phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM50610) ||\ndrivers/net/phy/broadcom.c:250:\t    phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM50610M)) {\ndrivers/net/phy/broadcom.c-251-\t\t/* Clear bit 9 to fix a phy interop issue. */\n--\ndrivers/net/phy/broadcom.c-256-\ndrivers/net/phy/broadcom.c:257:\t\tif (phydev-\u003edrv-\u003ephy_id == PHY_ID_BCM50610) {\ndrivers/net/phy/broadcom.c-258-\t\t\terr = bcm50610_a0_workaround(phydev);\n--\ndrivers/net/phy/broadcom.c-263-\ndrivers/net/phy/broadcom.c:264:\tif (phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM57780)) {\ndrivers/net/phy/broadcom.c-265-\t\tint val;\n--\ndrivers/net/phy/broadcom.c=285=static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev)\n--\ndrivers/net/phy/broadcom.c-291-\t/* Abort if we are using an untested phy. */\ndrivers/net/phy/broadcom.c:292:\tif (!(phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM57780) ||\ndrivers/net/phy/broadcom.c:293:\t      phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM50610) ||\ndrivers/net/phy/broadcom.c:294:\t      phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM50610M) ||\ndrivers/net/phy/broadcom.c:295:\t      phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM54210E) ||\ndrivers/net/phy/broadcom.c:296:\t      phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM54810) ||\ndrivers/net/phy/broadcom.c:297:\t      phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM54811)))\ndrivers/net/phy/broadcom.c-298-\t\treturn;\n--\ndrivers/net/phy/broadcom.c-305-\ndrivers/net/phy/broadcom.c:306:\tif ((phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM50610) ||\ndrivers/net/phy/broadcom.c:307:\t     phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM50610M)) \u0026\u0026\ndrivers/net/phy/broadcom.c-308-\t    BRCM_PHY_REV(phydev) \u003e= 0x3) {\n--\ndrivers/net/phy/broadcom.c-315-\t\tif (phydev-\u003edev_flags \u0026 PHY_BRCM_RX_REFCLK_UNUSED) {\ndrivers/net/phy/broadcom.c:316:\t\t\tif (!phy_id_compare_model(phydev-\u003edrv-\u003ephy_id,\ndrivers/net/phy/broadcom.c-317-\t\t\t\t\t\t  PHY_ID_BCM54811)) {\n--\ndrivers/net/phy/broadcom.c-330-\tif (phydev-\u003edev_flags \u0026 PHY_BRCM_DIS_TXCRXC_NOENRGY) {\ndrivers/net/phy/broadcom.c:331:\t\tif (phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM54210E) ||\ndrivers/net/phy/broadcom.c:332:\t\t    phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM54810) ||\ndrivers/net/phy/broadcom.c:333:\t\t    phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM54811))\ndrivers/net/phy/broadcom.c-334-\t\t\tval |= BCM54XX_SHD_SCR3_RXCTXC_DIS;\n--\ndrivers/net/phy/broadcom.c=458=static int bcm54xx_config_init(struct phy_device *phydev)\n--\ndrivers/net/phy/broadcom.c-479-\ndrivers/net/phy/broadcom.c:480:\tif ((phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM50610) ||\ndrivers/net/phy/broadcom.c:481:\t     phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM50610M)) \u0026\u0026\ndrivers/net/phy/broadcom.c-482-\t    (phydev-\u003edev_flags \u0026 PHY_BRCM_CLEAR_RGMII_MODE))\n--\ndrivers/net/phy/broadcom.c-486-\ndrivers/net/phy/broadcom.c:487:\tswitch (phydev-\u003edrv-\u003ephy_id \u0026 PHY_ID_MATCH_MODEL_MASK) {\ndrivers/net/phy/broadcom.c-488-\tcase PHY_ID_BCM50610:\n--\ndrivers/net/phy/broadcom.c=687=static int bcm5481x_read_abilities(struct phy_device *phydev)\n--\ndrivers/net/phy/broadcom.c-716-\t\t */\ndrivers/net/phy/broadcom.c:717:\t\tif (phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM54811))\ndrivers/net/phy/broadcom.c-718-\t\t\taneg = 0;\n--\ndrivers/net/phy/broadcom.c=877=static int brcm_fet_config_init(struct phy_device *phydev)\n--\ndrivers/net/phy/broadcom.c-911-\t/* Unmask events we are interested in and mask interrupts globally. */\ndrivers/net/phy/broadcom.c:912:\tif (phydev-\u003edrv-\u003ephy_id == PHY_ID_BCM5221)\ndrivers/net/phy/broadcom.c-913-\t\treg = MII_BRCM_FET_IR_ENABLE |\n--\ndrivers/net/phy/broadcom.c-940-\ndrivers/net/phy/broadcom.c:941:\tif (phydev-\u003edrv-\u003ephy_id != PHY_ID_BCM5221) {\ndrivers/net/phy/broadcom.c-942-\t\t/* Set the LED mode */\n--\ndrivers/net/phy/broadcom.c=1036=static int brcm_fet_suspend(struct phy_device *phydev)\n--\ndrivers/net/phy/broadcom.c-1061-\ndrivers/net/phy/broadcom.c:1062:\tif (phydev-\u003edrv-\u003ephy_id == PHY_ID_BCM5221)\ndrivers/net/phy/broadcom.c-1063-\t\t/* Force Low Power Mode with clock enabled */\n--\ndrivers/net/phy/cortina.c=46=static int cortina_probe(struct phy_device *phydev)\n--\ndrivers/net/phy/cortina.c-66-\t */\ndrivers/net/phy/cortina.c:67:\tif (phy_id != phydev-\u003edrv-\u003ephy_id) {\ndrivers/net/phy/cortina.c-68-\t\tphydev_err(phydev, \"Error matching phy with %s driver\\n\",\ndrivers/net/phy/cortina.c:69:\t\t\t   phydev-\u003edrv-\u003ename);\ndrivers/net/phy/cortina.c-70-\t\treturn -ENODEV;\n--\ndrivers/net/phy/dp83822.c=732=static int dp83822_phy_reset(struct phy_device *phydev)\n--\ndrivers/net/phy/dp83822.c-739-\ndrivers/net/phy/dp83822.c:740:\treturn phydev-\u003edrv-\u003econfig_init(phydev);\ndrivers/net/phy/dp83822.c-741-}\n--\ndrivers/net/phy/marvell-88q2xxx.c=473=static int mv88q2xxx_config_aneg(struct phy_device *phydev)\n--\ndrivers/net/phy/marvell-88q2xxx.c-480-\ndrivers/net/phy/marvell-88q2xxx.c:481:\treturn phydev-\u003edrv-\u003esoft_reset(phydev);\ndrivers/net/phy/marvell-88q2xxx.c-482-}\n--\ndrivers/net/phy/marvell.c=2873=to_marvell_hwmon_ops(const struct phy_device *phydev)\ndrivers/net/phy/marvell.c-2874-{\ndrivers/net/phy/marvell.c:2875:\treturn phydev-\u003edrv-\u003edriver_data;\ndrivers/net/phy/marvell.c-2876-}\n--\ndrivers/net/phy/marvell10g.c=176=static const struct mv3310_chip *to_mv3310_chip(struct phy_device *phydev)\ndrivers/net/phy/marvell10g.c-177-{\ndrivers/net/phy/marvell10g.c:178:\treturn phydev-\u003edrv-\u003edriver_data;\ndrivers/net/phy/marvell10g.c-179-}\n--\ndrivers/net/phy/marvell10g.c=244=static int mv3310_hwmon_config(struct phy_device *phydev, bool enable)\n--\ndrivers/net/phy/marvell10g.c-248-\ndrivers/net/phy/marvell10g.c:249:\tif (phydev-\u003edrv-\u003ephy_id != MARVELL_PHY_ID_88X3310)\ndrivers/net/phy/marvell10g.c-250-\t\treturn 0;\n--\ndrivers/net/phy/marvell10g.c=310=static int mv3310_power_up(struct phy_device *phydev)\n--\ndrivers/net/phy/marvell10g.c-324-\ndrivers/net/phy/marvell10g.c:325:\tif (phydev-\u003edrv-\u003ephy_id != MARVELL_PHY_ID_88X3310 ||\ndrivers/net/phy/marvell10g.c-326-\t    priv-\u003efirmware_ver \u003c 0x00030000)\n--\ndrivers/net/phy/mediatek/mtk-2p5ge.c=323=static int mt798x_2p5ge_phy_probe(struct phy_device *phydev)\n--\ndrivers/net/phy/mediatek/mtk-2p5ge.c-328-\ndrivers/net/phy/mediatek/mtk-2p5ge.c:329:\tswitch (phydev-\u003edrv-\u003ephy_id) {\ndrivers/net/phy/mediatek/mtk-2p5ge.c-330-\tcase MTK_2P5GPHY_ID_MT7988:\n--\ndrivers/net/phy/mediatek/mtk-ge-soc.c=476=static int tx_amp_fill_result(struct phy_device *phydev, u16 *buf)\n--\ndrivers/net/phy/mediatek/mtk-ge-soc.c-488-\ndrivers/net/phy/mediatek/mtk-ge-soc.c:489:\tswitch (phydev-\u003edrv-\u003ephy_id) {\ndrivers/net/phy/mediatek/mtk-ge-soc.c-490-\tcase MTK_GPHY_ID_MT7981:\n--\ndrivers/net/phy/mediatek/mtk-ge-soc.c=594=static int tx_r50_fill_result(struct phy_device *phydev, u16 tx_r50_cal_val,\n--\ndrivers/net/phy/mediatek/mtk-ge-soc.c-599-\ndrivers/net/phy/mediatek/mtk-ge-soc.c:600:\tif (phydev-\u003edrv-\u003ephy_id == MTK_GPHY_ID_MT7988)\ndrivers/net/phy/mediatek/mtk-ge-soc.c-601-\t\tbias = -1;\n--\ndrivers/net/phy/mediatek/mtk-ge-soc.c=1210=static int mt798x_phy_config_init(struct phy_device *phydev)\ndrivers/net/phy/mediatek/mtk-ge-soc.c-1211-{\ndrivers/net/phy/mediatek/mtk-ge-soc.c:1212:\tswitch (phydev-\u003edrv-\u003ephy_id) {\ndrivers/net/phy/mediatek/mtk-ge-soc.c-1213-\tcase MTK_GPHY_ID_MT7981:\n--\ndrivers/net/phy/mediatek/mtk-phy-lib.c=335=void mtk_phy_leds_state_init(struct phy_device *phydev)\n--\ndrivers/net/phy/mediatek/mtk-phy-lib.c-339-\tfor (i = 0; i \u003c 2; ++i)\ndrivers/net/phy/mediatek/mtk-phy-lib.c:340:\t\tphydev-\u003edrv-\u003eled_hw_control_get(phydev, i, NULL);\ndrivers/net/phy/mediatek/mtk-phy-lib.c-341-}\n--\ndrivers/net/phy/micrel.c=578=static int kszphy_config_intr(struct phy_device *phydev)\ndrivers/net/phy/micrel.c-579-{\ndrivers/net/phy/micrel.c:580:\tconst struct kszphy_type *type = phydev-\u003edrv-\u003edriver_data;\ndrivers/net/phy/micrel.c-581-\tint temp, err;\n--\ndrivers/net/phy/micrel.c=1510=static int ksz9131_config_rgmii_delay(struct phy_device *phydev)\ndrivers/net/phy/micrel.c-1511-{\ndrivers/net/phy/micrel.c:1512:\tconst struct kszphy_type *type = phydev-\u003edrv-\u003edriver_data;\ndrivers/net/phy/micrel.c-1513-\tu16 rxcdll_val, txcdll_val;\n--\ndrivers/net/phy/micrel.c=1788=static int ksz9031_read_status(struct phy_device *phydev)\n--\ndrivers/net/phy/micrel.c-1803-\t\tphydev-\u003elink = 0;\ndrivers/net/phy/micrel.c:1804:\t\tif (phydev-\u003edrv-\u003econfig_intr \u0026\u0026 phy_interrupt_is_valid(phydev))\ndrivers/net/phy/micrel.c:1805:\t\t\tphydev-\u003edrv-\u003econfig_intr(phydev);\ndrivers/net/phy/micrel.c-1806-\t\treturn genphy_config_aneg(phydev);\n--\ndrivers/net/phy/micrel.c=2604=static int kszphy_suspend(struct phy_device *phydev)\n--\ndrivers/net/phy/micrel.c-2608-\t\tphydev-\u003einterrupts = PHY_INTERRUPT_DISABLED;\ndrivers/net/phy/micrel.c:2609:\t\tif (phydev-\u003edrv-\u003econfig_intr)\ndrivers/net/phy/micrel.c:2610:\t\t\tphydev-\u003edrv-\u003econfig_intr(phydev);\ndrivers/net/phy/micrel.c-2611-\t}\n--\ndrivers/net/phy/micrel.c=2616=static void kszphy_parse_led_mode(struct phy_device *phydev)\ndrivers/net/phy/micrel.c-2617-{\ndrivers/net/phy/micrel.c:2618:\tconst struct kszphy_type *type = phydev-\u003edrv-\u003edriver_data;\ndrivers/net/phy/micrel.c-2619-\tconst struct device_node *np = phydev-\u003emdio.dev.of_node;\n--\ndrivers/net/phy/micrel.c=2640=static int kszphy_resume(struct phy_device *phydev)\n--\ndrivers/net/phy/micrel.c-2660-\t\tphydev-\u003einterrupts = PHY_INTERRUPT_ENABLED;\ndrivers/net/phy/micrel.c:2661:\t\tif (phydev-\u003edrv-\u003econfig_intr)\ndrivers/net/phy/micrel.c:2662:\t\t\tphydev-\u003edrv-\u003econfig_intr(phydev);\ndrivers/net/phy/micrel.c-2663-\t}\n--\ndrivers/net/phy/micrel.c=2686=static int ksz9477_resume(struct phy_device *phydev)\n--\ndrivers/net/phy/micrel.c-2714-\t\tphydev-\u003einterrupts = PHY_INTERRUPT_ENABLED;\ndrivers/net/phy/micrel.c:2715:\t\tif (phydev-\u003edrv-\u003econfig_intr)\ndrivers/net/phy/micrel.c:2716:\t\t\tphydev-\u003edrv-\u003econfig_intr(phydev);\ndrivers/net/phy/micrel.c-2717-\t}\n--\ndrivers/net/phy/micrel.c=2722=static int ksz8061_resume(struct phy_device *phydev)\n--\ndrivers/net/phy/micrel.c-2746-\t\tphydev-\u003einterrupts = PHY_INTERRUPT_ENABLED;\ndrivers/net/phy/micrel.c:2747:\t\tif (phydev-\u003edrv-\u003econfig_intr)\ndrivers/net/phy/micrel.c:2748:\t\t\tphydev-\u003edrv-\u003econfig_intr(phydev);\ndrivers/net/phy/micrel.c-2749-\t}\n--\ndrivers/net/phy/micrel.c=2759=static int kszphy_probe(struct phy_device *phydev)\ndrivers/net/phy/micrel.c-2760-{\ndrivers/net/phy/micrel.c:2761:\tconst struct kszphy_type *type = phydev-\u003edrv-\u003edriver_data;\ndrivers/net/phy/micrel.c-2762-\tconst struct device_node *np = phydev-\u003emdio.dev.of_node;\n--\ndrivers/net/phy/micrel.c=2902=static int ksz886x_cable_test_wait_for_completion(struct phy_device *phydev)\ndrivers/net/phy/micrel.c-2903-{\ndrivers/net/phy/micrel.c:2904:\tconst struct kszphy_type *type = phydev-\u003edrv-\u003edriver_data;\ndrivers/net/phy/micrel.c-2905-\tint val, ret;\n--\ndrivers/net/phy/micrel.c=3021=static int ksz886x_cable_test_get_status(struct phy_device *phydev,\n--\ndrivers/net/phy/micrel.c-3023-{\ndrivers/net/phy/micrel.c:3024:\tconst struct kszphy_type *type = phydev-\u003edrv-\u003edriver_data;\ndrivers/net/phy/micrel.c-3025-\tunsigned long pair_mask = type-\u003epair_mask;\n--\ndrivers/net/phy/micrel.c=4562=static int __lan8814_ptp_probe_once(struct phy_device *phydev, char *pin_name,\n--\ndrivers/net/phy/micrel.c-4589-\tshared-\u003eptp_clock_info.owner = THIS_MODULE;\ndrivers/net/phy/micrel.c:4590:\tsnprintf(shared-\u003eptp_clock_info.name, 30, \"%s\", phydev-\u003edrv-\u003ename);\ndrivers/net/phy/micrel.c-4591-\tshared-\u003eptp_clock_info.max_adj = 31249999;\n--\ndrivers/net/phy/micrel.c=4747=static int lan8814_probe(struct phy_device *phydev)\ndrivers/net/phy/micrel.c-4748-{\ndrivers/net/phy/micrel.c:4749:\tconst struct kszphy_type *type = phydev-\u003edrv-\u003edriver_data;\ndrivers/net/phy/micrel.c-4750-\tstruct kszphy_priv *priv;\n--\ndrivers/net/phy/microchip_rds_ptp.c=1242=struct mchp_rds_ptp_clock *mchp_rds_ptp_probe(struct phy_device *phydev, u8 mmd,\n--\ndrivers/net/phy/microchip_rds_ptp.c-1274-\tclock-\u003ecaps.owner          = THIS_MODULE;\ndrivers/net/phy/microchip_rds_ptp.c:1275:\tsnprintf(clock-\u003ecaps.name, 30, \"%s\", phydev-\u003edrv-\u003ename);\ndrivers/net/phy/microchip_rds_ptp.c-1276-\tclock-\u003ecaps.max_adj        = MCHP_RDS_PTP_MAX_ADJ;\n--\ndrivers/net/phy/motorcomm.c=891=static int ytphy_rgmii_clk_delay_config(struct phy_device *phydev)\n--\ndrivers/net/phy/motorcomm.c-922-\tcase PHY_INTERFACE_MODE_GMII:\ndrivers/net/phy/motorcomm.c:923:\t\tif (phydev-\u003edrv-\u003ephy_id != PHY_ID_YT8531S)\ndrivers/net/phy/motorcomm.c-924-\t\t\treturn -EOPNOTSUPP;\n--\ndrivers/net/phy/motorcomm.c=1064=static int yt8521_probe(struct phy_device *phydev)\n--\ndrivers/net/phy/motorcomm.c-1123-\ndrivers/net/phy/motorcomm.c:1124:\tif (phydev-\u003edrv-\u003ephy_id == PHY_ID_YT8521) {\ndrivers/net/phy/motorcomm.c-1125-\t\tswitch (freq) {\n--\ndrivers/net/phy/motorcomm.c-1150-\t\t}\ndrivers/net/phy/motorcomm.c:1151:\t} else if (phydev-\u003edrv-\u003ephy_id == PHY_ID_YT8531S) {\ndrivers/net/phy/motorcomm.c-1152-\t\tswitch (freq) {\n--\ndrivers/net/phy/mscc/mscc_macsec.c=953=int vsc8584_macsec_init(struct phy_device *phydev)\n--\ndrivers/net/phy/mscc/mscc_macsec.c-956-\ndrivers/net/phy/mscc/mscc_macsec.c:957:\tswitch (phydev-\u003ephy_id \u0026 phydev-\u003edrv-\u003ephy_id_mask) {\ndrivers/net/phy/mscc/mscc_macsec.c-958-\tcase PHY_ID_VSC856X:\n--\ndrivers/net/phy/mscc/mscc_main.c=1723=static int vsc8584_config_init(struct phy_device *phydev)\n--\ndrivers/net/phy/mscc/mscc_main.c-1746-\tif (phy_package_init_once(phydev)) {\ndrivers/net/phy/mscc/mscc_main.c:1747:\t\tswitch (phydev-\u003ephy_id \u0026 phydev-\u003edrv-\u003ephy_id_mask) {\ndrivers/net/phy/mscc/mscc_main.c-1748-\t\tcase PHY_ID_VSC8504:\n--\ndrivers/net/phy/mscc/mscc_main.c=1846=static int vsc85xx_config_init(struct phy_device *phydev)\n--\ndrivers/net/phy/mscc/mscc_main.c-1862-\ndrivers/net/phy/mscc/mscc_main.c:1863:\tphy_id = phydev-\u003edrv-\u003ephy_id \u0026 phydev-\u003edrv-\u003ephy_id_mask;\ndrivers/net/phy/mscc/mscc_main.c-1864-\tif (PHY_ID_VSC8531 == phy_id || PHY_ID_VSC8541 == phy_id ||\n--\ndrivers/net/phy/mscc/mscc_ptp.c=1538=int vsc8584_ptp_init(struct phy_device *phydev)\ndrivers/net/phy/mscc/mscc_ptp.c-1539-{\ndrivers/net/phy/mscc/mscc_ptp.c:1540:\tswitch (phydev-\u003ephy_id \u0026 phydev-\u003edrv-\u003ephy_id_mask) {\ndrivers/net/phy/mscc/mscc_ptp.c-1541-\tcase PHY_ID_VSC8572:\n--\ndrivers/net/phy/nxp-c45-tja11xx.c=300=struct nxp_c45_phy_data *nxp_c45_get_data(struct phy_device *phydev)\ndrivers/net/phy/nxp-c45-tja11xx.c-301-{\ndrivers/net/phy/nxp-c45-tja11xx.c:302:\treturn phydev-\u003edrv-\u003edriver_data;\ndrivers/net/phy/nxp-c45-tja11xx.c-303-}\n--\ndrivers/net/phy/nxp-tja11xx.c=211=static int tja11xx_config_aneg_cable_test(struct phy_device *phydev)\n--\ndrivers/net/phy/nxp-tja11xx.c-218-\ndrivers/net/phy/nxp-tja11xx.c:219:\tif (!phydev-\u003edrv-\u003ecable_test_start ||\ndrivers/net/phy/nxp-tja11xx.c:220:\t    !phydev-\u003edrv-\u003ecable_test_get_status)\ndrivers/net/phy/nxp-tja11xx.c-221-\t\treturn 0;\n--\ndrivers/net/phy/nxp-tja11xx.c-226-\ndrivers/net/phy/nxp-tja11xx.c:227:\tret = phydev-\u003edrv-\u003ecable_test_start(phydev);\ndrivers/net/phy/nxp-tja11xx.c-228-\tif (ret)\n--\ndrivers/net/phy/nxp-tja11xx.c-233-\ndrivers/net/phy/nxp-tja11xx.c:234:\tret = phydev-\u003edrv-\u003ecable_test_get_status(phydev, \u0026finished);\ndrivers/net/phy/nxp-tja11xx.c-235-\tif (ret)\n--\ndrivers/net/phy/phy-core.c=468=int __phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum)\n--\ndrivers/net/phy/phy-core.c-472-\ndrivers/net/phy/phy-core.c:473:\tif (phydev-\u003edrv \u0026\u0026 phydev-\u003edrv-\u003eread_mmd)\ndrivers/net/phy/phy-core.c:474:\t\treturn phydev-\u003edrv-\u003eread_mmd(phydev, devad, regnum);\ndrivers/net/phy/phy-core.c-475-\n--\ndrivers/net/phy/phy-core.c=512=int __phy_write_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val)\n--\ndrivers/net/phy/phy-core.c-516-\ndrivers/net/phy/phy-core.c:517:\tif (phydev-\u003edrv \u0026\u0026 phydev-\u003edrv-\u003ewrite_mmd)\ndrivers/net/phy/phy-core.c:518:\t\treturn phydev-\u003edrv-\u003ewrite_mmd(phydev, devad, regnum, val);\ndrivers/net/phy/phy-core.c-519-\n--\ndrivers/net/phy/phy-core.c=723=static int __phy_read_page(struct phy_device *phydev)\ndrivers/net/phy/phy-core.c-724-{\ndrivers/net/phy/phy-core.c:725:\tif (WARN_ONCE(!phydev-\u003edrv-\u003eread_page, \"read_page callback not available, PHY driver not loaded?\\n\"))\ndrivers/net/phy/phy-core.c-726-\t\treturn -EOPNOTSUPP;\ndrivers/net/phy/phy-core.c-727-\ndrivers/net/phy/phy-core.c:728:\treturn phydev-\u003edrv-\u003eread_page(phydev);\ndrivers/net/phy/phy-core.c-729-}\n--\ndrivers/net/phy/phy-core.c=731=static int __phy_write_page(struct phy_device *phydev, int page)\ndrivers/net/phy/phy-core.c-732-{\ndrivers/net/phy/phy-core.c:733:\tif (WARN_ONCE(!phydev-\u003edrv-\u003ewrite_page, \"write_page callback not available, PHY driver not loaded?\\n\"))\ndrivers/net/phy/phy-core.c-734-\t\treturn -EOPNOTSUPP;\ndrivers/net/phy/phy-core.c-735-\ndrivers/net/phy/phy-core.c:736:\treturn phydev-\u003edrv-\u003ewrite_page(phydev, page);\ndrivers/net/phy/phy-core.c-737-}\n--\ndrivers/net/phy/phy.c=64=static void phy_process_state_change(struct phy_device *phydev,\n--\ndrivers/net/phy/phy.c-70-\t\t\t   phy_state_to_str(phydev-\u003estate));\ndrivers/net/phy/phy.c:71:\t\tif (phydev-\u003edrv \u0026\u0026 phydev-\u003edrv-\u003elink_change_notify)\ndrivers/net/phy/phy.c:72:\t\t\tphydev-\u003edrv-\u003elink_change_notify(phydev);\ndrivers/net/phy/phy.c-73-\t}\n--\ndrivers/net/phy/phy.c=146=int phy_get_rate_matching(struct phy_device *phydev,\n--\ndrivers/net/phy/phy.c-150-\ndrivers/net/phy/phy.c:151:\tif (phydev-\u003edrv-\u003eget_rate_matching) {\ndrivers/net/phy/phy.c-152-\t\tmutex_lock(\u0026phydev-\u003elock);\ndrivers/net/phy/phy.c:153:\t\tret = phydev-\u003edrv-\u003eget_rate_matching(phydev, iface);\ndrivers/net/phy/phy.c-154-\t\tmutex_unlock(\u0026phydev-\u003elock);\n--\ndrivers/net/phy/phy.c=168=static int phy_config_interrupt(struct phy_device *phydev, bool interrupts)\n--\ndrivers/net/phy/phy.c-170-\tphydev-\u003einterrupts = interrupts ? 1 : 0;\ndrivers/net/phy/phy.c:171:\tif (phydev-\u003edrv-\u003econfig_intr)\ndrivers/net/phy/phy.c:172:\t\treturn phydev-\u003edrv-\u003econfig_intr(phydev);\ndrivers/net/phy/phy.c-173-\n--\ndrivers/net/phy/phy.c=205=int phy_aneg_done(struct phy_device *phydev)\ndrivers/net/phy/phy.c-206-{\ndrivers/net/phy/phy.c:207:\tif (phydev-\u003edrv \u0026\u0026 phydev-\u003edrv-\u003eaneg_done)\ndrivers/net/phy/phy.c:208:\t\treturn phydev-\u003edrv-\u003eaneg_done(phydev);\ndrivers/net/phy/phy.c-209-\telse if (phydev-\u003eis_c45)\n--\ndrivers/net/phy/phy.c=549=int phy_ethtool_get_strings(struct phy_device *phydev, u8 *data)\ndrivers/net/phy/phy.c-550-{\ndrivers/net/phy/phy.c:551:\tif (!phydev-\u003edrv)\ndrivers/net/phy/phy.c-552-\t\treturn -EIO;\n--\ndrivers/net/phy/phy.c-554-\tmutex_lock(\u0026phydev-\u003elock);\ndrivers/net/phy/phy.c:555:\tphydev-\u003edrv-\u003eget_strings(phydev, data);\ndrivers/net/phy/phy.c-556-\tmutex_unlock(\u0026phydev-\u003elock);\n--\ndrivers/net/phy/phy.c=567=int phy_ethtool_get_sset_count(struct phy_device *phydev)\n--\ndrivers/net/phy/phy.c-570-\ndrivers/net/phy/phy.c:571:\tif (!phydev-\u003edrv)\ndrivers/net/phy/phy.c-572-\t\treturn -EIO;\ndrivers/net/phy/phy.c-573-\ndrivers/net/phy/phy.c:574:\tif (phydev-\u003edrv-\u003eget_sset_count \u0026\u0026\ndrivers/net/phy/phy.c:575:\t    phydev-\u003edrv-\u003eget_strings \u0026\u0026\ndrivers/net/phy/phy.c:576:\t    phydev-\u003edrv-\u003eget_stats) {\ndrivers/net/phy/phy.c-577-\t\tmutex_lock(\u0026phydev-\u003elock);\ndrivers/net/phy/phy.c:578:\t\tret = phydev-\u003edrv-\u003eget_sset_count(phydev);\ndrivers/net/phy/phy.c-579-\t\tmutex_unlock(\u0026phydev-\u003elock);\n--\ndrivers/net/phy/phy.c=595=int phy_ethtool_get_stats(struct phy_device *phydev,\n--\ndrivers/net/phy/phy.c-597-{\ndrivers/net/phy/phy.c:598:\tif (!phydev-\u003edrv)\ndrivers/net/phy/phy.c-599-\t\treturn -EIO;\n--\ndrivers/net/phy/phy.c-601-\tmutex_lock(\u0026phydev-\u003elock);\ndrivers/net/phy/phy.c:602:\tphydev-\u003edrv-\u003eget_stats(phydev, stats, data);\ndrivers/net/phy/phy.c-603-\tmutex_unlock(\u0026phydev-\u003elock);\n--\ndrivers/net/phy/phy.c=619=void __phy_ethtool_get_phy_stats(struct phy_device *phydev,\n--\ndrivers/net/phy/phy.c-622-{\ndrivers/net/phy/phy.c:623:\tif (!phydev-\u003edrv || !phydev-\u003edrv-\u003eget_phy_stats)\ndrivers/net/phy/phy.c-624-\t\treturn;\n--\ndrivers/net/phy/phy.c-626-\tmutex_lock(\u0026phydev-\u003elock);\ndrivers/net/phy/phy.c:627:\tphydev-\u003edrv-\u003eget_phy_stats(phydev, phy_stats, phydev_stats);\ndrivers/net/phy/phy.c-628-\tmutex_unlock(\u0026phydev-\u003elock);\n--\ndrivers/net/phy/phy.c=639=void __phy_ethtool_get_link_ext_stats(struct phy_device *phydev,\n--\ndrivers/net/phy/phy.c-643-\ndrivers/net/phy/phy.c:644:\tif (!phydev-\u003edrv || !phydev-\u003edrv-\u003eget_link_stats)\ndrivers/net/phy/phy.c-645-\t\treturn;\n--\ndrivers/net/phy/phy.c-647-\tmutex_lock(\u0026phydev-\u003elock);\ndrivers/net/phy/phy.c:648:\tphydev-\u003edrv-\u003eget_link_stats(phydev, link_stats);\ndrivers/net/phy/phy.c-649-\tmutex_unlock(\u0026phydev-\u003elock);\n--\ndrivers/net/phy/phy.c=660=int phy_ethtool_get_plca_cfg(struct phy_device *phydev,\n--\ndrivers/net/phy/phy.c-664-\ndrivers/net/phy/phy.c:665:\tif (!phydev-\u003edrv) {\ndrivers/net/phy/phy.c-666-\t\tret = -EIO;\n--\ndrivers/net/phy/phy.c-669-\ndrivers/net/phy/phy.c:670:\tif (!phydev-\u003edrv-\u003eget_plca_cfg) {\ndrivers/net/phy/phy.c-671-\t\tret = -EOPNOTSUPP;\n--\ndrivers/net/phy/phy.c-675-\tmutex_lock(\u0026phydev-\u003elock);\ndrivers/net/phy/phy.c:676:\tret = phydev-\u003edrv-\u003eget_plca_cfg(phydev, plca_cfg);\ndrivers/net/phy/phy.c-677-\n--\ndrivers/net/phy/phy.c=721=int phy_ethtool_set_plca_cfg(struct phy_device *phydev,\n--\ndrivers/net/phy/phy.c-727-\ndrivers/net/phy/phy.c:728:\tif (!phydev-\u003edrv) {\ndrivers/net/phy/phy.c-729-\t\tret = -EIO;\n--\ndrivers/net/phy/phy.c-732-\ndrivers/net/phy/phy.c:733:\tif (!phydev-\u003edrv-\u003eset_plca_cfg ||\ndrivers/net/phy/phy.c:734:\t    !phydev-\u003edrv-\u003eget_plca_cfg) {\ndrivers/net/phy/phy.c-735-\t\tret = -EOPNOTSUPP;\n--\ndrivers/net/phy/phy.c-746-\ndrivers/net/phy/phy.c:747:\tret = phydev-\u003edrv-\u003eget_plca_cfg(phydev, curr_plca_cfg);\ndrivers/net/phy/phy.c-748-\tif (ret)\n--\ndrivers/net/phy/phy.c-803-\ndrivers/net/phy/phy.c:804:\tret = phydev-\u003edrv-\u003eset_plca_cfg(phydev, plca_cfg);\ndrivers/net/phy/phy.c-805-\n--\ndrivers/net/phy/phy.c=821=int phy_ethtool_get_plca_status(struct phy_device *phydev,\n--\ndrivers/net/phy/phy.c-825-\ndrivers/net/phy/phy.c:826:\tif (!phydev-\u003edrv) {\ndrivers/net/phy/phy.c-827-\t\tret = -EIO;\n--\ndrivers/net/phy/phy.c-830-\ndrivers/net/phy/phy.c:831:\tif (!phydev-\u003edrv-\u003eget_plca_status) {\ndrivers/net/phy/phy.c-832-\t\tret = -EOPNOTSUPP;\n--\ndrivers/net/phy/phy.c-836-\tmutex_lock(\u0026phydev-\u003elock);\ndrivers/net/phy/phy.c:837:\tret = phydev-\u003edrv-\u003eget_plca_status(phydev, plca_st);\ndrivers/net/phy/phy.c-838-\n--\ndrivers/net/phy/phy.c=850=int phy_start_cable_test(struct phy_device *phydev,\n--\ndrivers/net/phy/phy.c-855-\ndrivers/net/phy/phy.c:856:\tif (!(phydev-\u003edrv \u0026\u0026\ndrivers/net/phy/phy.c:857:\t      phydev-\u003edrv-\u003ecable_test_start \u0026\u0026\ndrivers/net/phy/phy.c:858:\t      phydev-\u003edrv-\u003ecable_test_get_status)) {\ndrivers/net/phy/phy.c-859-\t\tNL_SET_ERR_MSG(extack,\n--\ndrivers/net/phy/phy.c-887-\tnetif_testing_on(dev);\ndrivers/net/phy/phy.c:888:\terr = phydev-\u003edrv-\u003ecable_test_start(phydev);\ndrivers/net/phy/phy.c-889-\tif (err) {\n--\ndrivers/net/phy/phy.c=920=int phy_start_cable_test_tdr(struct phy_device *phydev,\n--\ndrivers/net/phy/phy.c-926-\ndrivers/net/phy/phy.c:927:\tif (!(phydev-\u003edrv \u0026\u0026\n\n"
}

19/2 2026/09/14 23:07 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 50306
							output: 32
							thoughts: 47
						

Thoughts:
Okay, let's break this down.

**Investigating PHY Device Driver Assignment**

Right, so I need to figure out how the `phydev->drv` pointer, within the `phy_device.c` file, is being assigned and cleared. That's the crux of understanding how the driver is bound and unbound. To do this systematically, a good starting point is to track down where that assignment happens in the first place, and then look for where it gets unassigned. A quick `grep` should provide those instances. Specifically, since the relevant code will be in the `drivers/net/phy/` directory, I'll execute a `grep` command, looking for the assignment " `phydev->drv =`" within that directory. This should highlight any places where the driver pointer is explicitly set. That will be my starting point in examining the code.



20/2 2026/09/14 23:07 tool grepper
0m Args:
{
  "Expression": "phydev-\u003edrv\\s*=",
  "PathPrefix": "drivers/net/phy"
}

Results:
{
  "Output": "drivers/net/phy/phy_device.c=3689=static int phy_probe(struct device *dev)\n--\ndrivers/net/phy/phy_device.c-3695-\ndrivers/net/phy/phy_device.c:3696:\tphydev-\u003edrv = phydrv;\ndrivers/net/phy/phy_device.c-3697-\n--\ndrivers/net/phy/phy_device.c=3833=static int phy_remove(struct device *dev)\n--\ndrivers/net/phy/phy_device.c-3857-\ndrivers/net/phy/phy_device.c:3858:\tphydev-\u003edrv = NULL;\ndrivers/net/phy/phy_device.c-3859-\n"
}

21/2 2026/09/14 23:07 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 50770
							output: 40
							thoughts: 38
						

Thoughts:
Here's my take on those thoughts, assuming I'm deep in PHY driver development:

**Diving into PHY Device Management**

Alright, time to get my hands dirty. I need to take a look at how the PHY devices are probed and removed. My gut feeling tells me to focus on `phy_device.c`. Specifically, I'm heading straight for the `phy_probe` and `phy_remove` functions. These are the core functions to examine for device initialization and de-initialization sequences. Let's see what the PHY driver authors did.



22/2 2026/09/14 23:07 tool read-file
0m Args:
{
  "File": "drivers/net/phy/phy_device.c",
  "FirstLine": 3685,
  "LineCount": 40
}

Results:
{
  "Contents": "3685:\t * @dev: device to probe and init\n3686:\t *\n3687:\t * Take care of setting up the phy_device structure, set the state to READY.\n3688:\t */\n3689:\tstatic int phy_probe(struct device *dev)\n3690:\t{\n3691:\t\tstruct phy_device *phydev = to_phy_device(dev);\n3692:\t\tstruct device_driver *drv = phydev-\u003emdio.dev.driver;\n3693:\t\tstruct phy_driver *phydrv = to_phy_driver(drv);\n3694:\t\tint err = 0;\n3695:\t\n3696:\t\tphydev-\u003edrv = phydrv;\n3697:\t\n3698:\t\t/* Disable the interrupt if the PHY doesn't support it\n3699:\t\t * but the interrupt is still a valid one\n3700:\t\t */\n3701:\t\tif (!phy_drv_supports_irq(phydrv) \u0026\u0026 phy_interrupt_is_valid(phydev))\n3702:\t\t\tphydev-\u003eirq = PHY_POLL;\n3703:\t\n3704:\t\tif (phydrv-\u003eflags \u0026 PHY_IS_INTERNAL)\n3705:\t\t\tphydev-\u003eis_internal = true;\n3706:\t\n3707:\t\t/* Deassert the reset signal */\n3708:\t\tphy_device_reset(phydev, 0);\n3709:\t\n3710:\t\tif (phydev-\u003edrv-\u003eprobe) {\n3711:\t\t\terr = phydev-\u003edrv-\u003eprobe(phydev);\n3712:\t\t\tif (err)\n3713:\t\t\t\tgoto out;\n3714:\t\t}\n3715:\t\n3716:\t\tphy_disable_interrupts(phydev);\n3717:\t\n3718:\t\t/* Start out supporting everything. Eventually,\n3719:\t\t * a controller will attach, and may modify one\n3720:\t\t * or both of these values\n3721:\t\t */\n3722:\t\tif (phydrv-\u003efeatures) {\n3723:\t\t\tlinkmode_copy(phydev-\u003esupported, phydrv-\u003efeatures);\n3724:\t\t\tgenphy_c45_read_eee_abilities(phydev);\n"
}

23/2 2026/09/14 23:07 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 51575
							output: 40
							thoughts: 31
						

Thoughts:
Okay, let's dive into this. I'm going to pull up lines 3830 to 3870 of `drivers/net/phy/phy_device.c`. This specific section should be interesting, given my past work with PHY drivers. I'm anticipating that it will likely deal with some aspect of PHY device management or initialization, perhaps related to link detection, autonegotiation, or MDIO access. The context of the surrounding code should provide crucial insights into how this module integrates with the broader networking stack. I will be looking to see if the chosen lines highlight aspects of advanced configuration, or perhaps exception handling related to specific PHY models. It will be valuable to identify, within these lines, any patterns or novel implementations compared to what I've seen in similar drivers in the past. Understanding the structure here will provide useful material to draw from if I must, in the future, implement a similar device.



24/2 2026/09/14 23:07 tool read-file
0m Args:
{
  "File": "drivers/net/phy/phy_device.c",
  "FirstLine": 3830,
  "LineCount": 40
}

Results:
{
  "Contents": "3830:\t\treturn err;\n3831:\t}\n3832:\t\n3833:\tstatic int phy_remove(struct device *dev)\n3834:\t{\n3835:\t\tstruct phy_device *phydev = to_phy_device(dev);\n3836:\t\n3837:\t\tcancel_delayed_work_sync(\u0026phydev-\u003estate_queue);\n3838:\t\n3839:\t\tif (IS_ENABLED(CONFIG_PHYLIB_LEDS) \u0026\u0026 !phy_driver_is_genphy(phydev))\n3840:\t\t\tphy_leds_unregister(phydev);\n3841:\t\n3842:\t\tif (!phydev-\u003eis_on_sfp_module)\n3843:\t\t\tphy_led_triggers_unregister(phydev);\n3844:\t\n3845:\t\tphydev-\u003estate = PHY_DOWN;\n3846:\t\n3847:\t\tsfp_bus_del_upstream(phydev-\u003esfp_bus);\n3848:\t\tphydev-\u003esfp_bus = NULL;\n3849:\t\n3850:\t\tphy_cleanup_ports(phydev);\n3851:\t\n3852:\t\tif (phydev-\u003edrv \u0026\u0026 phydev-\u003edrv-\u003eremove)\n3853:\t\t\tphydev-\u003edrv-\u003eremove(phydev);\n3854:\t\n3855:\t\t/* Assert the reset signal */\n3856:\t\tphy_device_reset(phydev, 1);\n3857:\t\n3858:\t\tphydev-\u003edrv = NULL;\n3859:\t\n3860:\t\treturn 0;\n3861:\t}\n3862:\t\n3863:\t/**\n3864:\t * phy_driver_register - register a phy_driver with the PHY layer\n3865:\t * @new_driver: new phy_driver to register\n3866:\t * @owner: module owning this PHY\n3867:\t */\n3868:\tstatic int phy_driver_register(struct phy_driver *new_driver,\n3869:\t\t\t\t       struct module *owner)\n"
}

25/2 2026/09/14 23:07 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 52403
							output: 40
							thoughts: 586
						

Thoughts:
**My Deep Dive into Driver Binding and Unbinding**

Okay, let's break down how driver binding and unbinding functions within the device core, focusing specifically on the intricacies of this patch. My mind is instantly drawn to this because it's the kind of low-level detail that can make or break a robust system.

First, when a driver successfully binds to a device, the sequence is clear. The system calls either `device_bind_driver` or `driver_probe_device`. These functions handle the crucial step of setting `dev->driver` *before* calling the driver's `probe` function, or, if we're dealing with `really_probe`, setting the driver and then, if the bus has a probe function, calling that, and finally, after returning from probe, checking if an error occurred and, if so, setting `dev->driver` to `NULL`.

Now, on the unbind or removal side, the process looks like this: the system invokes `dev->bus->remove(dev)`, which in this context translates to `phy_remove`. This removes the driver from the `phydev`, setting `phydev->drv = NULL`. Following this, the device core itself clears the `dev->driver` pointer.

The really interesting bit comes with the comment in the patch: "/* d->driver outlives phydev->drv on unbind, precedes it on bind */". It suggests an ordering concern. I can instantly see the potential race conditions here. The implication is a potential timing issue where `d->driver` might still be pointing to a driver that's already been unbound from `phydev` or has not yet been bound to `phydev` . If that's the case, then attempting to access it from `phydev` would be an issue.

The patch's logic introduces a critical check: if the device driver is already unbound, then there's an `EBUSY` error and we `goto error_put_device`.

Now, before this patch, what was the situation? I recall `phy_attach_direct` taking control of driver binding. I see this section, where if there isn't a driver assigned to the device, the system assigns either `genphy_c45_driver.mdiodrv.driver` or `genphy_driver.mdiodrv.driver` depending on the state of `phydev->is_c45`. A `try_module_get` call is performed to manage the driver's module usage, before the system calls the driver's `probe` function. If the probe is successful, `device_bind_driver` is called.

The code then checks if the device is already attached. And, if the device isn't attached, sets up the `phydev->phy_link_change` and handles the `attached_dev` linkage.

I need to circle back to lines 1800 to 1860 of `drivers/net/phy/phy_device.c` to fully grasp the state transitions prior to the patch. I suspect this is where the core issue resides. It looks like it was attempting a manual binding process. The patch is very interesting in that it is an attempt at synchronization.



26/2 2026/09/14 23:08 tool read-file
0m Args:
{
  "File": "drivers/net/phy/phy_device.c",
  "FirstLine": 1800,
  "LineCount": 60
}

Results:
{
  "Contents": "1800:\t\n1801:\t\t\tif (err)\n1802:\t\t\t\tgoto error_module_put;\n1803:\t\t}\n1804:\t\n1805:\t\tif (phydev-\u003eattached_dev) {\n1806:\t\t\tdev_err(\u0026dev-\u003edev, \"PHY already attached\\n\");\n1807:\t\t\terr = -EBUSY;\n1808:\t\t\tgoto error;\n1809:\t\t}\n1810:\t\n1811:\t\tphydev-\u003ephy_link_change = phy_link_change;\n1812:\t\tif (dev) {\n1813:\t\t\tphydev-\u003eattached_dev = dev;\n1814:\t\t\tdev-\u003ephydev = phydev;\n1815:\t\n1816:\t\t\tif (phydev-\u003esfp_bus_attached)\n1817:\t\t\t\tdev-\u003esfp_bus = phydev-\u003esfp_bus;\n1818:\t\n1819:\t\t\terr = phy_link_topo_add_phy(dev, phydev, PHY_UPSTREAM_MAC, dev);\n1820:\t\t\tif (err)\n1821:\t\t\t\tgoto error;\n1822:\t\t}\n1823:\t\n1824:\t\t/* Some Ethernet drivers try to connect to a PHY device before\n1825:\t\t * calling register_netdevice() -\u003e netdev_register_kobject() and\n1826:\t\t * does the dev-\u003edev.kobj initialization. Here we only check for\n1827:\t\t * success which indicates that the network device kobject is\n1828:\t\t * ready. Once we do that we still need to keep track of whether\n1829:\t\t * links were successfully set up or not for phy_detach() to\n1830:\t\t * remove them accordingly.\n1831:\t\t */\n1832:\t\tphydev-\u003esysfs_links = false;\n1833:\t\n1834:\t\tphy_sysfs_create_links(phydev);\n1835:\t\n1836:\t\tif (!phydev-\u003eattached_dev) {\n1837:\t\t\terr = sysfs_create_file(\u0026phydev-\u003emdio.dev.kobj,\n1838:\t\t\t\t\t\t\u0026dev_attr_phy_standalone.attr);\n1839:\t\t\tif (err)\n1840:\t\t\t\tphydev_err(phydev, \"error creating 'phy_standalone' sysfs entry\\n\");\n1841:\t\t}\n1842:\t\n1843:\t\tphydev-\u003edev_flags |= flags;\n1844:\t\n1845:\t\tphydev-\u003einterface = interface;\n1846:\t\n1847:\t\tphydev-\u003estate = PHY_READY;\n1848:\t\n1849:\t\tphydev-\u003einterrupts = PHY_INTERRUPT_DISABLED;\n1850:\t\n1851:\t\t/* PHYs can request to use poll mode even though they have an\n1852:\t\t * associated interrupt line. This could be the case if they\n1853:\t\t * detect a broken interrupt handling.\n1854:\t\t */\n1855:\t\tif (phydev-\u003edev_flags \u0026 PHY_F_NO_IRQ)\n1856:\t\t\tphydev-\u003eirq = PHY_POLL;\n1857:\t\n1858:\t\tif (!phy_drv_supports_irq(phydev-\u003edrv) \u0026\u0026 phy_interrupt_is_valid(phydev))\n1859:\t\t\tphydev-\u003eirq = PHY_POLL;\n"
}

27/2 2026/09/14 23:08 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 54613
							output: 40
							thoughts: 74
						

Thoughts:
Here's my summary, as though I'm thinking through this code:

**Diving into that PHY Interrupt Logic**

Okay, so I'm focusing on line 1858 – `if (!phy_drv_supports_irq(phydev->drv) && phy_interrupt_is_valid(phydev))` – right? Immediately, the `phy_drv_supports_irq` call catches my attention. I need to understand what that function is checking. It's crucial for the interrupt handling logic. Let me jump over to lines 1730-1740 to see how `phy_drv_supports_irq` is defined and what it's actually doing. I'm guessing it's probing whether the PHY driver in use is capable of handling interrupts at all, which is the pre-requisite, before we bother checking the validity.



28/2 2026/09/14 23:08 tool read-file
0m Args:
{
  "File": "drivers/net/phy/phy_device.c",
  "FirstLine": 1730,
  "LineCount": 20
}

Results:
{
  "Contents": "1730:\t}\n1731:\t\n1732:\tstatic bool phy_drv_supports_irq(const struct phy_driver *phydrv)\n1733:\t{\n1734:\t\treturn phydrv-\u003econfig_intr \u0026\u0026 phydrv-\u003ehandle_interrupt;\n1735:\t}\n1736:\t\n1737:\t/**\n1738:\t * phy_attach_direct - attach a network device to a given PHY device pointer\n1739:\t * @dev: network device to attach\n1740:\t * @phydev: Pointer to phy_device to attach\n1741:\t * @flags: PHY device's dev_flags\n1742:\t * @interface: PHY device's interface\n1743:\t *\n1744:\t * Description: Called by drivers to attach to a particular PHY\n1745:\t *     device. The phy_device is found, and properly hooked up\n1746:\t *     to the phy_driver.  If no driver is attached, then a\n1747:\t *     generic driver is used.  The phy_device is given a ptr to\n1748:\t *     the attaching device, and given a callback for link status\n1749:\t *     change.  The phy_device is returned to the attaching driver.\n"
}

29/2 2026/09/14 23:08 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 55259
							output: 40
							thoughts: 108
						

Thoughts:
**Analyzing Potential Null Pointer Dereferences in PHY Driver Code**

Okay, here's what's running through my head as I review this code. I've spotted a potential issue, and it's making me double-check the logic. My immediate concern is this: if `phydev->drv` happens to be NULL – and that could be due to a concurrent unbinding or binding operation, or some other race condition – then `phy_drv_supports_irq(phydev->drv)` is going to try and dereference `phydev->drv->config_intr`. And that, my friend, is a textbook case of a NULL pointer dereference. Bad news!

My mental gears are now shifting to the other potential issues, and I want to see what happens in other areas of the code. Let's dig deeper and see what happens if `phydev->drv` is NULL in `phy_attach_direct`. Okay, let's analyze lines 1860-1910, let's see if this issue presents again. I have a feeling there will be more potential NULL dereferences. I bet there are.



30/2 2026/09/14 23:08 tool read-file
0m Args:
{
  "File": "drivers/net/phy/phy_device.c",
  "FirstLine": 1860,
  "LineCount": 50
}

Results:
{
  "Contents": "1860:\t\n1861:\t\t/* Port is set to PORT_TP by default and the actual PHY driver will set\n1862:\t\t * it to different value depending on the PHY configuration. If we have\n1863:\t\t * the generic PHY driver we can't figure it out, thus set the old\n1864:\t\t * legacy PORT_MII value.\n1865:\t\t */\n1866:\t\tif (phydev-\u003eis_genphy_driven)\n1867:\t\t\tphydev-\u003eport = PORT_MII;\n1868:\t\n1869:\t\t/* Initial carrier state is off as the phy is about to be\n1870:\t\t * (re)initialized.\n1871:\t\t */\n1872:\t\tif (dev)\n1873:\t\t\tnetif_carrier_off(phydev-\u003eattached_dev);\n1874:\t\n1875:\t\t/* Do initial configuration here, now that\n1876:\t\t * we have certain key parameters\n1877:\t\t * (dev_flags and interface)\n1878:\t\t */\n1879:\t\terr = phy_init_hw(phydev);\n1880:\t\tif (err)\n1881:\t\t\tgoto error;\n1882:\t\n1883:\t\tphy_resume(phydev);\n1884:\t\n1885:\t\t/**\n1886:\t\t * If the external phy used by current mac interface is managed by\n1887:\t\t * another mac interface, so we should create a device link between\n1888:\t\t * phy dev and mac dev.\n1889:\t\t */\n1890:\t\tif (dev \u0026\u0026 phydev-\u003emdio.bus-\u003eparent \u0026\u0026 dev-\u003edev.parent != phydev-\u003emdio.bus-\u003eparent)\n1891:\t\t\tphydev-\u003edevlink = device_link_add(dev-\u003edev.parent, \u0026phydev-\u003emdio.dev,\n1892:\t\t\t\t\t\t\t  DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);\n1893:\t\n1894:\t\treturn err;\n1895:\t\n1896:\terror:\n1897:\t\t/* phy_detach() does all of the cleanup below */\n1898:\t\tphy_detach(phydev);\n1899:\t\treturn err;\n1900:\t\n1901:\terror_module_put:\n1902:\t\tmodule_put(d-\u003edriver-\u003eowner);\n1903:\t\tphydev-\u003eis_genphy_driven = 0;\n1904:\t\td-\u003edriver = NULL;\n1905:\terror_put_device:\n1906:\t\tput_device(d);\n1907:\t\tif (ndev_owner != bus-\u003eowner)\n1908:\t\t\tmodule_put(bus-\u003eowner);\n1909:\t\treturn err;\n"
}

31/2 2026/09/14 23:08 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 56381
							output: 43
							thoughts: 385
						

Thoughts:
**My Analysis of `phy_attach_direct` in a Fuzzing Context**

Okay, here's what's going through my head as I dissect this `phy_attach_direct` code snippet. First, I'm focusing on the core logic: if a driver isn't already assigned to a device `d`, it picks either the C45 or generic PHY driver based on `phydev->is_c45`.  Otherwise, if a driver *is* already present but `phydev->drv` is null, it returns EBUSY. I immediately start wondering if this code is reachable during syzkaller fuzzing, so I need to understand the call paths.

My immediate next thought is to find out how PHY devices are registered. What devices call `mdio` or `phy`? More importantly, how does `phy_attach_direct` get called in the first place? I need to trace the creation, registration, and attachment of PHYs within the kernel. I need to know the typical setup.

Can userspace somehow trigger this function? Or can syzkaller directly manipulate the PHY attachment process? I need to think about potential attack vectors. I have to think about whether syzkaller can affect netdev initialization.

Now I am going to investigate how PHY devices are typically brought into existence and linked to the kernel. What kinds of network devices might be involved? Virtual netdevs? USB netdevs? DSA devices? Ethtool or netlink interfaces?

Wait a minute, what about DSA (Distributed Switch Architecture)? That's a strong possibility. Can DSA switches be dynamically created or bound? I need to search for DSA-related code in both syzkaller and the kernel itself. This may be a key area for fuzzing.

I'm now also considering USB ethernet adapters. Let's see if the `ax88172a` driver has any relevance. A quick look in `drivers/net/usb/ax88172a.c` may be insightful. I need to examine the `usb_device_id` table for `ax88172a` to understand the kinds of hardware it supports.



32/2 2026/09/14 23:08 tool read-file
0m Args:
{
  "File": "drivers/net/usb/ax88172a.c",
  "FirstLine": 330,
  "LineCount": 40
}

Results:
{
  "Contents": " 330:\t\tphy_start(priv-\u003ephydev);\n 331:\t\n 332:\t\treturn 0;\n 333:\t\n 334:\tout:\n 335:\t\treturn ret;\n 336:\t\n 337:\t}\n 338:\t\n 339:\tstatic int ax88172a_rx_fixup(struct usbnet *dev, struct sk_buff *skb)\n 340:\t{\n 341:\t\tstruct ax88172a_private *dp = dev-\u003edriver_priv;\n 342:\t\tstruct asix_rx_fixup_info *rx = \u0026dp-\u003erx_fixup_info;\n 343:\t\n 344:\t\treturn asix_rx_fixup_internal(dev, skb, rx);\n 345:\t}\n 346:\t\n 347:\tconst struct driver_info ax88172a_info = {\n 348:\t\t.description = \"ASIX AX88172A USB 2.0 Ethernet\",\n 349:\t\t.bind = ax88172a_bind,\n 350:\t\t.reset = ax88172a_reset,\n 351:\t\t.stop = ax88172a_stop,\n 352:\t\t.unbind = ax88172a_unbind,\n 353:\t\t.status = ax88172a_status,\n 354:\t\t.flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR |\n 355:\t\t\t FLAG_MULTI_PACKET,\n 356:\t\t.rx_fixup = ax88172a_rx_fixup,\n 357:\t\t.tx_fixup = asix_tx_fixup,\n 358:\t};\n"
}

33/2 2026/09/14 23:08 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 57757
							output: 34
							thoughts: 19
						

Thoughts:
Here's my attempt at summarizing the thought process, tailored for an expert audience:

**Tracing the Usage of `ax88172a_info`**

Okay, so I'm looking at `ax88172a_info`. My initial thought is to quickly determine the scope of this structure. It's obviously important, likely central to the driver for the AX88172A. So, my next step is clear: I need to pinpoint everywhere this struct is *used*. I'll need to know where it's declared, initialized, accessed, and, critically, where its members are modified. Understanding its lifecyle is key to understanding the driver's behaviour and identifying any potential issues, or areas for optimization. This will require some rapid static analysis, maybe using `grep` or a more sophisticated code navigation tool if the codebase is sufficiently large and complex.



34/2 2026/09/14 23:09 tool grepper
0m Args:
{
  "Expression": "ax88172a_info",
  "PathPrefix": "drivers/net/usb"
}

Results:
{
  "Output": "drivers/net/usb/asix.h=178=struct asix_common_private {\n--\ndrivers/net/usb/asix.h-194-\ndrivers/net/usb/asix.h:195:extern const struct driver_info ax88172a_info;\ndrivers/net/usb/asix.h-196-\n--\ndrivers/net/usb/asix_devices.c=1447=static const struct usb_device_id\tproducts [] = {\n--\ndrivers/net/usb/asix_devices.c-1590-\tUSB_DEVICE(0x0b95, 0x172a),\ndrivers/net/usb/asix_devices.c:1591:\t.driver_info = (unsigned long) \u0026ax88172a_info,\ndrivers/net/usb/asix_devices.c-1592-}, {\n--\ndrivers/net/usb/ax88172a.c=339=static int ax88172a_rx_fixup(struct usbnet *dev, struct sk_buff *skb)\n--\ndrivers/net/usb/ax88172a.c-346-\ndrivers/net/usb/ax88172a.c:347:const struct driver_info ax88172a_info = {\ndrivers/net/usb/ax88172a.c-348-\t.description = \"ASIX AX88172A USB 2.0 Ethernet\",\n"
}

35/2 2026/09/14 23:09 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 58391
							output: 40
							thoughts: 220
						

Thoughts:
**Analyzing the ax88172a USB Ethernet Driver**

Okay, so I'm digging into this `ax88172a` driver, specifically the `ax88172a_info` struct. It's used in `asix_devices.c` for USB devices with VID 0x0b95 and PID 0x172a. The question immediately pops up: when does `ax88172a_reset` actually get executed? I need to understand the reset sequence.

From what I can tell in `usbnet`, the `reset` function is invoked during the `ndo_open` operation. That happens when the network interface is brought online, which is triggered by commands like `ip link set ethX up` or through the `SIOCSIFFLAGS` ioctl. It's likely that syzkaller is leveraging these interface up/down transitions constantly. This gives a clearer picture of possible attack vectors.

Now, let's trace this further. Within `ax88172a_reset`, I see `phy_connect` being called: `phy_connect(dev->net, priv->phy_name, &ax88172a_adjust_link, PHY_INTERFACE_MODE_MII);`. Okay, that's crucial. I need to understand this `phy_connect` function and its impact.

I'll check the source in `drivers/net/phy/phy_device.c`. That's where the magic probably happens. Let's get to reading that function.



36/2 2026/09/14 23:09 tool read-file
0m Args:
{
  "File": "drivers/net/phy/phy_device.c",
  "FirstLine": 1210,
  "LineCount": 40
}

Results:
{
  "Contents": "1210:\t *   this function.\n1211:\t */\n1212:\tstatic void phy_prepare_link(struct phy_device *phydev,\n1213:\t\t\t\t     void (*handler)(struct net_device *))\n1214:\t{\n1215:\t\tphydev-\u003eadjust_link = handler;\n1216:\t}\n1217:\t\n1218:\t/**\n1219:\t * phy_connect_direct - connect an ethernet device to a specific phy_device\n1220:\t * @dev: the network device to connect\n1221:\t * @phydev: the pointer to the phy device\n1222:\t * @handler: callback function for state change notifications\n1223:\t * @interface: PHY device's interface\n1224:\t */\n1225:\tint phy_connect_direct(struct net_device *dev, struct phy_device *phydev,\n1226:\t\t\t       void (*handler)(struct net_device *),\n1227:\t\t\t       phy_interface_t interface)\n1228:\t{\n1229:\t\tint rc;\n1230:\t\n1231:\t\tif (!dev)\n1232:\t\t\treturn -EINVAL;\n1233:\t\n1234:\t\trc = phy_attach_direct(dev, phydev, phydev-\u003edev_flags, interface);\n1235:\t\tif (rc)\n1236:\t\t\treturn rc;\n1237:\t\n1238:\t\tphy_prepare_link(phydev, handler);\n1239:\t\tif (phy_interrupt_is_valid(phydev))\n1240:\t\t\tphy_request_interrupt(phydev);\n1241:\t\n1242:\t\treturn 0;\n1243:\t}\n1244:\tEXPORT_SYMBOL(phy_connect_direct);\n1245:\t\n1246:\t/**\n1247:\t * phy_connect - connect an ethernet device to a PHY device\n1248:\t * @dev: the network device to connect\n1249:\t * @bus_id: the id string of the PHY device to connect\n"
}

37/2 2026/09/14 23:09 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 59555
							output: 28
							thoughts: 419
						

Thoughts:
**My Line of Inquiry: Deep Dive into PHY Connection and Potential Phylib Usage**

Okay, let's break down this `phy_connect` function. I see it's taking a net device, a bus ID, a handler, and an interface as arguments. The core here is `bus_find_device_by_name` searching for the PHY based on the bus ID. And then, we have `phy_connect_direct` which is calling `phy_attach_direct`. Interesting. It's all starting to click a little bit.

Now, I'm already starting to think beyond this specific function. I'm wondering, what other drivers are *relying* on the phylib/MDIO infrastructure? This isn't just an isolated case; it's a piece of a larger puzzle. What about DSA? I know DSA has to play a part here somewhere...

I need to understand if DSA, in this context, is constructing some sort of *virtual* or *emulated* devices. That's a key distinction. Now, where to look? Right, `net/dsa/`, specifically the DSA switches. And can this DSA be generated through some network link or some emulation?

Okay, let's explore. I'll need to expand my search. I should probably be looking at `drivers/net/dsa/mv88e6xxx/`, maybe the core `net/dsa/` directory itself, the more general `drivers/net/ethernet/` space, and also USB-related network drivers, since they could interact with PHYs.

And then I should consider the bigger picture: what are the implications of `CONFIG_MDIO_DEVICE` and `CONFIG_MDIO_BUS`? These are likely important in how the PHY is configured.

To wrap it up, let's try to identify all the other USB drivers and virtual drivers, that may leverage phylib. I know I have to search for `mdiobus_register` within `drivers/net/`!



38/2 2026/09/14 23:09 tool grepper
0m Args:
{
  "Expression": "mdiobus_register",
  "PathPrefix": "drivers/net"
}

Results:
{
  "Output": "\nFull output is too long, showing 500 out of 1018 lines.\nUse more precise expression if possible.\n\ndrivers/net/dsa/bcm_sf2.c=607=static int bcm_sf2_mdio_register(struct dsa_switch *ds)\n--\ndrivers/net/dsa/bcm_sf2.c-683-\ndrivers/net/dsa/bcm_sf2.c:684:\terr = mdiobus_register(priv-\u003euser_mii_bus);\ndrivers/net/dsa/bcm_sf2.c-685-\tif (err)\n--\ndrivers/net/dsa/lantiq/lantiq_gswip_common.c=187=static int gswip_mdio(struct gswip_priv *priv)\n--\ndrivers/net/dsa/lantiq/lantiq_gswip_common.c-213-\ndrivers/net/dsa/lantiq/lantiq_gswip_common.c:214:\terr = devm_of_mdiobus_register(dev, bus, mdio_np);\ndrivers/net/dsa/lantiq/lantiq_gswip_common.c-215-\n--\ndrivers/net/dsa/microchip/ksz9477.c=321=static int ksz9477_pcs_create(struct ksz_device *dev)\n--\ndrivers/net/dsa/microchip/ksz9477.c-341-\ndrivers/net/dsa/microchip/ksz9477.c:342:\tret = devm_mdiobus_register(dev-\u003edev, bus);\ndrivers/net/dsa/microchip/ksz9477.c-343-\tif (ret)\n--\ndrivers/net/dsa/microchip/ksz_common.c=2321=int ksz_mdio_register(struct ksz_device *dev)\n--\ndrivers/net/dsa/microchip/ksz_common.c-2392-\ndrivers/net/dsa/microchip/ksz_common.c:2393:\tret = devm_of_mdiobus_register(ds-\u003edev, bus, mdio_np);\ndrivers/net/dsa/microchip/ksz_common.c-2394-\tif (ret) {\n--\ndrivers/net/dsa/microchip/lan937x_main.c=685=static int lan937x_mdio_register(struct ksz_device *dev)\n--\ndrivers/net/dsa/microchip/lan937x_main.c-755-\ndrivers/net/dsa/microchip/lan937x_main.c:756:\tret = devm_of_mdiobus_register(ds-\u003edev, bus, mdio_np);\ndrivers/net/dsa/microchip/lan937x_main.c-757-\tif (ret)\n--\ndrivers/net/dsa/mt7530.c=2409=mt7530_setup_mdio(struct mt7530_priv *priv)\n--\ndrivers/net/dsa/mt7530.c-2444-\ndrivers/net/dsa/mt7530.c:2445:\tret = devm_of_mdiobus_register(dev, bus, mnp);\ndrivers/net/dsa/mt7530.c-2446-\tif (ret) {\n--\ndrivers/net/dsa/mt7628.c=242=static int mt7628_setup_internal_mdio(struct dsa_switch *ds)\n--\ndrivers/net/dsa/mt7628.c-261-\ndrivers/net/dsa/mt7628.c:262:\treturn devm_mdiobus_register(dev, bus);\ndrivers/net/dsa/mt7628.c-263-}\n--\ndrivers/net/dsa/mv88e6xxx/chip.c=3842=static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip,\n--\ndrivers/net/dsa/mv88e6xxx/chip.c-3895-\ndrivers/net/dsa/mv88e6xxx/chip.c:3896:\terr = of_mdiobus_register(bus, np);\ndrivers/net/dsa/mv88e6xxx/chip.c-3897-\tif (err) {\n--\ndrivers/net/dsa/mxl862xx/mxl862xx.c=267=static int mxl862xx_setup_mdio(struct dsa_switch *ds)\n--\ndrivers/net/dsa/mxl862xx/mxl862xx.c-292-\ndrivers/net/dsa/mxl862xx/mxl862xx.c:293:\tret = devm_of_mdiobus_register(dev, bus, mdio_np);\ndrivers/net/dsa/mxl862xx/mxl862xx.c-294-\tof_node_put(mdio_np);\n--\ndrivers/net/dsa/netc/netc_main.c=149=static int netc_port_create_emdio_bus(struct netc_port *np,\n--\ndrivers/net/dsa/netc/netc_main.c-179-\ndrivers/net/dsa/netc/netc_main.c:180:\terr = devm_of_mdiobus_register(dev, bus, node);\ndrivers/net/dsa/netc/netc_main.c-181-\tif (err)\n--\ndrivers/net/dsa/ocelot/felix_vsc9959.c=957=static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot)\n--\ndrivers/net/dsa/ocelot/felix_vsc9959.c-1013-\t/* Needed in order to initialize the bus mutex lock */\ndrivers/net/dsa/ocelot/felix_vsc9959.c:1014:\trc = mdiobus_register(bus);\ndrivers/net/dsa/ocelot/felix_vsc9959.c-1015-\tif (rc \u003c 0) {\n--\ndrivers/net/dsa/ocelot/seville_vsc9953.c=878=static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot)\n--\ndrivers/net/dsa/ocelot/seville_vsc9953.c-903-\t/* Needed in order to initialize the bus mutex lock */\ndrivers/net/dsa/ocelot/seville_vsc9953.c:904:\trc = devm_of_mdiobus_register(dev, bus, NULL);\ndrivers/net/dsa/ocelot/seville_vsc9953.c-905-\tif (rc \u003c 0) {\n--\ndrivers/net/dsa/qca/ar9331.c=357=static int ar9331_sw_mbus_init(struct ar9331_sw_priv *priv)\n--\ndrivers/net/dsa/qca/ar9331.c-381-\ndrivers/net/dsa/qca/ar9331.c:382:\tret = devm_of_mdiobus_register(dev, mbus, mnp);\ndrivers/net/dsa/qca/ar9331.c-383-\tof_node_put(mnp);\n--\ndrivers/net/dsa/qca/qca8k-8xxx.c=947=qca8k_mdio_register(struct qca8k_priv *priv)\n--\ndrivers/net/dsa/qca/qca8k-8xxx.c-986-\ndrivers/net/dsa/qca/qca8k-8xxx.c:987:\tret = devm_of_mdiobus_register(dev, bus, mdio);\ndrivers/net/dsa/qca/qca8k-8xxx.c-988-\n--\ndrivers/net/dsa/realtek/rtl83xx.c=74=int rtl83xx_setup_user_mdio(struct dsa_switch *ds)\n--\ndrivers/net/dsa/realtek/rtl83xx.c-99-\ndrivers/net/dsa/realtek/rtl83xx.c:100:\tret = devm_of_mdiobus_register(priv-\u003edev, bus, mdio_np);\ndrivers/net/dsa/realtek/rtl83xx.c-101-\tif (ret) {\n--\ndrivers/net/dsa/rzn1_a5psw.c=1117=static int a5psw_probe_mdio(struct a5psw *a5psw, struct device_node *node)\n--\ndrivers/net/dsa/rzn1_a5psw.c-1143-\ndrivers/net/dsa/rzn1_a5psw.c:1144:\treturn devm_of_mdiobus_register(dev, bus, node);\ndrivers/net/dsa/rzn1_a5psw.c-1145-}\n--\ndrivers/net/dsa/sja1105/sja1105.h=307=void sja1105_frame_memory_partitioning(struct sja1105_private *priv);\n--\ndrivers/net/dsa/sja1105/sja1105.h-309-/* From sja1105_mdio.c */\ndrivers/net/dsa/sja1105/sja1105.h:310:int sja1105_mdiobus_register(struct dsa_switch *ds);\ndrivers/net/dsa/sja1105/sja1105.h-311-void sja1105_mdiobus_unregister(struct dsa_switch *ds);\n--\ndrivers/net/dsa/sja1105/sja1105_main.c=3026=static int sja1105_setup(struct dsa_switch *ds)\n--\ndrivers/net/dsa/sja1105/sja1105_main.c-3067-\ndrivers/net/dsa/sja1105/sja1105_main.c:3068:\trc = sja1105_mdiobus_register(ds);\ndrivers/net/dsa/sja1105/sja1105_main.c-3069-\tif (rc \u003c 0) {\n--\ndrivers/net/dsa/sja1105/sja1105_mdio.c=258=static int sja1105_mdiobus_base_tx_register(struct sja1105_private *priv,\n--\ndrivers/net/dsa/sja1105/sja1105_mdio.c-287-\ndrivers/net/dsa/sja1105/sja1105_mdio.c:288:\trc = of_mdiobus_register(bus, np);\ndrivers/net/dsa/sja1105/sja1105_mdio.c-289-\tif (rc) {\n--\ndrivers/net/dsa/sja1105/sja1105_mdio.c=312=static int sja1105_mdiobus_base_t1_register(struct sja1105_private *priv,\n--\ndrivers/net/dsa/sja1105/sja1105_mdio.c-343-\ndrivers/net/dsa/sja1105/sja1105_mdio.c:344:\trc = of_mdiobus_register(bus, np);\ndrivers/net/dsa/sja1105/sja1105_mdio.c-345-\tif (rc) {\n--\ndrivers/net/dsa/sja1105/sja1105_mdio.c=368=static int sja1105_mdiobus_pcs_register(struct sja1105_private *priv)\n--\ndrivers/net/dsa/sja1105/sja1105_mdio.c-395-\ndrivers/net/dsa/sja1105/sja1105_mdio.c:396:\trc = mdiobus_register(bus);\ndrivers/net/dsa/sja1105/sja1105_mdio.c-397-\tif (rc) {\n--\ndrivers/net/dsa/sja1105/sja1105_mdio.c=439=static void sja1105_mdiobus_pcs_unregister(struct sja1105_private *priv)\n--\ndrivers/net/dsa/sja1105/sja1105_mdio.c-458-\ndrivers/net/dsa/sja1105/sja1105_mdio.c:459:int sja1105_mdiobus_register(struct dsa_switch *ds)\ndrivers/net/dsa/sja1105/sja1105_mdio.c-460-{\n--\ndrivers/net/dsa/yt921x.c=595=yt921x_mbus_int_init(struct yt921x_priv *priv, struct device_node *mnp)\n--\ndrivers/net/dsa/yt921x.c-612-\ndrivers/net/dsa/yt921x.c:613:\tres = devm_of_mdiobus_register(dev, mbus, mnp);\ndrivers/net/dsa/yt921x.c-614-\tif (res)\n--\ndrivers/net/dsa/yt921x.c=726=yt921x_mbus_ext_init(struct yt921x_priv *priv, struct device_node *mnp)\n--\ndrivers/net/dsa/yt921x.c-743-\ndrivers/net/dsa/yt921x.c:744:\tres = devm_of_mdiobus_register(dev, mbus, mnp);\ndrivers/net/dsa/yt921x.c-745-\tif (res)\n--\ndrivers/net/ethernet/8390/ax88796.c=459=static int ax_mii_init(struct net_device *dev)\n--\ndrivers/net/ethernet/8390/ax88796.c-478-\ndrivers/net/ethernet/8390/ax88796.c:479:\terr = mdiobus_register(ax-\u003emii_bus);\ndrivers/net/ethernet/8390/ax88796.c-480-\tif (err)\n--\ndrivers/net/ethernet/actions/owl-emac.c=1321=static int owl_emac_mdio_init(struct net_device *netdev)\n--\ndrivers/net/ethernet/actions/owl-emac.c-1345-\ndrivers/net/ethernet/actions/owl-emac.c:1346:\tret = devm_of_mdiobus_register(dev, priv-\u003emii, mdio_node);\ndrivers/net/ethernet/actions/owl-emac.c-1347-\n--\ndrivers/net/ethernet/adi/adin1110.c=509=static int adin1110_register_mdiobus(struct adin1110_priv *priv,\n--\ndrivers/net/ethernet/adi/adin1110.c-529-\ndrivers/net/ethernet/adi/adin1110.c:530:\tret = devm_mdiobus_register(dev, mii_bus);\ndrivers/net/ethernet/adi/adin1110.c-531-\tif (ret)\n--\ndrivers/net/ethernet/adi/adin1140.c=617=static int adin1140_mdio_register(struct adin1140_priv *priv,\n--\ndrivers/net/ethernet/adi/adin1140.c-636-\ndrivers/net/ethernet/adi/adin1140.c:637:\treturn devm_mdiobus_register(\u0026spidev-\u003edev, priv-\u003emdiobus);\ndrivers/net/ethernet/adi/adin1140.c-638-}\n--\ndrivers/net/ethernet/aeroflex/greth.c=1290=static int greth_mdio_init(struct greth_private *greth)\n--\ndrivers/net/ethernet/aeroflex/greth.c-1306-\ndrivers/net/ethernet/aeroflex/greth.c:1307:\tret = mdiobus_register(greth-\u003emdio);\ndrivers/net/ethernet/aeroflex/greth.c-1308-\tif (ret) {\n--\ndrivers/net/ethernet/agere/et131x.c=3931=static int et131x_pci_setup(struct pci_dev *pdev,\n--\ndrivers/net/ethernet/agere/et131x.c-4026-\ndrivers/net/ethernet/agere/et131x.c:4027:\trc = mdiobus_register(adapter-\u003emii_bus);\ndrivers/net/ethernet/agere/et131x.c-4028-\tif (rc \u003c 0) {\n--\ndrivers/net/ethernet/altera/altera_tse_main.c=121=static int altera_tse_mdio_create(struct net_device *dev, unsigned int id)\n--\ndrivers/net/ethernet/altera/altera_tse_main.c-157-\ndrivers/net/ethernet/altera/altera_tse_main.c:158:\tret = of_mdiobus_register(mdio, mdio_node);\ndrivers/net/ethernet/altera/altera_tse_main.c-159-\tif (ret != 0) {\n--\ndrivers/net/ethernet/amd/au1000_eth.c=1061=static int au1000_probe(struct platform_device *pdev)\n--\ndrivers/net/ethernet/amd/au1000_eth.c-1221-\ndrivers/net/ethernet/amd/au1000_eth.c:1222:\terr = mdiobus_register(aup-\u003emii_bus);\ndrivers/net/ethernet/amd/au1000_eth.c-1223-\tif (err) {\n--\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c=3428=static int xgbe_phy_init(struct xgbe_prv_data *pdata)\n--\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c-3717-\tsnprintf(mii-\u003eid, sizeof(mii-\u003eid), \"%s\", dev_name(pdata-\u003edev));\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:3718:\tret = mdiobus_register(mii);\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c-3719-\tif (ret) {\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:3720:\t\tdev_err(pdata-\u003edev, \"mdiobus_register failed\\n\");\ndrivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c-3721-\t\treturn ret;\n--\ndrivers/net/ethernet/apm/xgene-v2/mdio.c=98=int xge_mdio_config(struct net_device *ndev)\n--\ndrivers/net/ethernet/apm/xgene-v2/mdio.c-118-\tmdio_bus-\u003ephy_mask = 0x1;\ndrivers/net/ethernet/apm/xgene-v2/mdio.c:119:\tret = mdiobus_register(mdio_bus);\ndrivers/net/ethernet/apm/xgene-v2/mdio.c-120-\tif (ret)\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c=837=int xgene_enet_phy_connect(struct net_device *ndev)\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-887-\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c:888:static int xgene_mdiobus_register(struct xgene_enet_pdata *pdata,\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-889-\t\t\t\t  struct mii_bus *mdio)\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-912-\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c:913:\t\tret = of_mdiobus_register(mdio, mdio_np);\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-914-\t\tof_node_put(mdio_np);\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-921-\t/* Register the MDIO bus */\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c:922:\tret = mdiobus_register(mdio);\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-923-\tif (ret)\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c=939=int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata)\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-957-\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c:958:\tret = xgene_mdiobus_register(pdata, mdio_bus);\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-959-\tif (ret) {\n--\ndrivers/net/ethernet/arc/emac_mdio.c=131=int arc_mdio_probe(struct arc_emac_priv *priv)\n--\ndrivers/net/ethernet/arc/emac_mdio.c-172-\ndrivers/net/ethernet/arc/emac_mdio.c:173:\terror = of_mdiobus_register(bus, mdio_node);\ndrivers/net/ethernet/arc/emac_mdio.c-174-\tof_node_put(mdio_node);\n--\ndrivers/net/ethernet/asix/ax88796c_main.c=966=static int ax88796c_probe(struct spi_device *spi)\n--\ndrivers/net/ethernet/asix/ax88796c_main.c-1010-\ndrivers/net/ethernet/asix/ax88796c_main.c:1011:\tret = devm_mdiobus_register(\u0026spi-\u003edev, ax_local-\u003emdiobus);\ndrivers/net/ethernet/asix/ax88796c_main.c-1012-\tif (ret \u003c 0) {\n--\ndrivers/net/ethernet/atheros/ag71xx.c=687=static int ag71xx_mdio_probe(struct ag71xx *ag)\n--\ndrivers/net/ethernet/atheros/ag71xx.c-727-\tmnp = of_get_child_by_name(np, \"mdio\");\ndrivers/net/ethernet/atheros/ag71xx.c:728:\terr = devm_of_mdiobus_register(dev, mii_bus, mnp);\ndrivers/net/ethernet/atheros/ag71xx.c-729-\tof_node_put(mnp);\n--\ndrivers/net/ethernet/broadcom/b44.c=2234=static int b44_register_phy_one(struct b44 *bp)\n--\ndrivers/net/ethernet/broadcom/b44.c-2259-\ndrivers/net/ethernet/broadcom/b44.c:2260:\terr = mdiobus_register(mii_bus);\ndrivers/net/ethernet/broadcom/b44.c-2261-\tif (err) {\n--\ndrivers/net/ethernet/broadcom/bcm63xx_enet.c=1713=static int bcm_enet_probe(struct platform_device *pdev)\n--\ndrivers/net/ethernet/broadcom/bcm63xx_enet.c-1829-\ndrivers/net/ethernet/broadcom/bcm63xx_enet.c:1830:\t\tret = mdiobus_register(bus);\ndrivers/net/ethernet/broadcom/bcm63xx_enet.c-1831-\t\tif (ret) {\n--\ndrivers/net/ethernet/broadcom/bgmac-bcma-mdio.c=211=struct mii_bus *bcma_mdio_mii_register(struct bgmac *bgmac)\n--\ndrivers/net/ethernet/broadcom/bgmac-bcma-mdio.c-235-\ndrivers/net/ethernet/broadcom/bgmac-bcma-mdio.c:236:\terr = of_mdiobus_register(mii_bus, np);\ndrivers/net/ethernet/broadcom/bgmac-bcma-mdio.c-237-\tof_node_put(np);\n--\ndrivers/net/ethernet/broadcom/genet/bcmmii.c=193=int bcmgenet_mii_config(struct net_device *dev, bool init)\n--\ndrivers/net/ethernet/broadcom/genet/bcmmii.c-233-\t\tphy_name = \"external RvMII\";\ndrivers/net/ethernet/broadcom/genet/bcmmii.c:234:\t\t/* of_mdiobus_register took care of reading the 'max-speed'\ndrivers/net/ethernet/broadcom/genet/bcmmii.c-235-\t\t * PHY property for us, effectively limiting the PHY supported\n--\ndrivers/net/ethernet/broadcom/sb1250-mac.c=2157=static int sbmac_init(struct platform_device *pldev, long long base)\n--\ndrivers/net/ethernet/broadcom/sb1250-mac.c-2227-\t */\ndrivers/net/ethernet/broadcom/sb1250-mac.c:2228:\terr = mdiobus_register(sc-\u003emii_bus);\ndrivers/net/ethernet/broadcom/sb1250-mac.c-2229-\tif (err) {\n--\ndrivers/net/ethernet/broadcom/tg3.c=1505=static int tg3_mdio_init(struct tg3 *tp)\n--\ndrivers/net/ethernet/broadcom/tg3.c-1557-\ndrivers/net/ethernet/broadcom/tg3.c:1558:\ti = mdiobus_register(tp-\u003emdio_bus);\ndrivers/net/ethernet/broadcom/tg3.c-1559-\tif (i) {\n--\ndrivers/net/ethernet/cadence/macb_main.c=1023=static int macb_mii_probe(struct net_device *netdev)\n--\ndrivers/net/ethernet/cadence/macb_main.c-1096-\ndrivers/net/ethernet/cadence/macb_main.c:1097:static int macb_mdiobus_register(struct macb *bp, struct device_node *mdio_np)\ndrivers/net/ethernet/cadence/macb_main.c-1098-{\n--\ndrivers/net/ethernet/cadence/macb_main.c-1104-\tif (mdio_np)\ndrivers/net/ethernet/cadence/macb_main.c:1105:\t\treturn of_mdiobus_register(bp-\u003emii_bus, mdio_np);\ndrivers/net/ethernet/cadence/macb_main.c-1106-\n--\ndrivers/net/ethernet/cadence/macb_main.c-1118-\ndrivers/net/ethernet/cadence/macb_main.c:1119:\t\t\treturn of_mdiobus_register(bp-\u003emii_bus, np);\ndrivers/net/ethernet/cadence/macb_main.c-1120-\t\t}\ndrivers/net/ethernet/cadence/macb_main.c-1121-\ndrivers/net/ethernet/cadence/macb_main.c:1122:\treturn mdiobus_register(bp-\u003emii_bus);\ndrivers/net/ethernet/cadence/macb_main.c-1123-}\n--\ndrivers/net/ethernet/cadence/macb_main.c=1125=static int macb_mii_init(struct macb *bp)\n--\ndrivers/net/ethernet/cadence/macb_main.c-1158-\ndrivers/net/ethernet/cadence/macb_main.c:1159:\terr = macb_mdiobus_register(bp, mdio_np);\ndrivers/net/ethernet/cadence/macb_main.c-1160-\tif (err)\n--\ndrivers/net/ethernet/davicom/dm9051.c=1107=static int dm9051_mdio_register(struct board_info *db)\n--\ndrivers/net/ethernet/davicom/dm9051.c-1124-\ndrivers/net/ethernet/davicom/dm9051.c:1125:\tret = devm_mdiobus_register(\u0026spi-\u003edev, db-\u003emdiobus);\ndrivers/net/ethernet/davicom/dm9051.c-1126-\tif (ret)\n--\ndrivers/net/ethernet/engleder/tsnep_main.c=2423=static int tsnep_mdio_init(struct tsnep_adapter *adapter)\n--\ndrivers/net/ethernet/engleder/tsnep_main.c-2454-\ndrivers/net/ethernet/engleder/tsnep_main.c:2455:\tretval = of_mdiobus_register(adapter-\u003emdiobus, np);\ndrivers/net/ethernet/engleder/tsnep_main.c-2456-\n--\ndrivers/net/ethernet/ethoc.c=1024=static int ethoc_probe(struct platform_device *pdev)\n--\ndrivers/net/ethernet/ethoc.c-1207-\ndrivers/net/ethernet/ethoc.c:1208:\tret = mdiobus_register(priv-\u003emdio);\ndrivers/net/ethernet/ethoc.c-1209-\tif (ret) {\n--\ndrivers/net/ethernet/faraday/ftgmac100.c=1734=static int ftgmac100_setup_mdio(struct net_device *netdev)\n--\ndrivers/net/ethernet/faraday/ftgmac100.c-1769-\ndrivers/net/ethernet/faraday/ftgmac100.c:1770:\terr = devm_of_mdiobus_register(priv-\u003edev, priv-\u003emii_bus, mdio_np);\ndrivers/net/ethernet/faraday/ftgmac100.c-1771-\tof_node_put(mdio_np);\n--\ndrivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c=36=static int enetc_pci_mdio_probe(struct pci_dev *pdev,\n--\ndrivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c-90-\ndrivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c:91:\terr = of_mdiobus_register(bus, dev-\u003eof_node);\ndrivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c-92-\tif (err)\n--\ndrivers/net/ethernet/freescale/enetc/enetc_pf_common.c=266=static int enetc_mdio_probe(struct enetc_pf *pf, struct device_node *np)\n--\ndrivers/net/ethernet/freescale/enetc/enetc_pf_common.c-292-\ndrivers/net/ethernet/freescale/enetc/enetc_pf_common.c:293:\terr = of_mdiobus_register(bus, np);\ndrivers/net/ethernet/freescale/enetc/enetc_pf_common.c-294-\tif (err)\n--\ndrivers/net/ethernet/freescale/enetc/enetc_pf_common.c=308=static int enetc_imdio_create(struct enetc_pf *pf)\n--\ndrivers/net/ethernet/freescale/enetc/enetc_pf_common.c-342-\ndrivers/net/ethernet/freescale/enetc/enetc_pf_common.c:343:\terr = mdiobus_register(bus);\ndrivers/net/ethernet/freescale/enetc/enetc_pf_common.c-344-\tif (err) {\n--\ndrivers/net/ethernet/freescale/fec_main.c=3042=static int fec_enet_mii_init(struct platform_device *pdev)\n--\ndrivers/net/ethernet/freescale/fec_main.c-3160-\ndrivers/net/ethernet/freescale/fec_main.c:3161:\terr = of_mdiobus_register(fep-\u003emii_bus, node);\ndrivers/net/ethernet/freescale/fec_main.c-3162-\tif (err)\n--\ndrivers/net/ethernet/freescale/fec_mpc52xx_phy.c=65=static int mpc52xx_fec_mdio_probe(struct platform_device *of)\n--\ndrivers/net/ethernet/freescale/fec_mpc52xx_phy.c-105-\ndrivers/net/ethernet/freescale/fec_mpc52xx_phy.c:106:\terr = of_mdiobus_register(bus, np);\ndrivers/net/ethernet/freescale/fec_mpc52xx_phy.c-107-\tif (err)\n--\ndrivers/net/ethernet/freescale/fs_enet/mii-bitbang.c=149=static int fs_enet_mdio_probe(struct platform_device *ofdev)\n--\ndrivers/net/ethernet/freescale/fs_enet/mii-bitbang.c-175-\ndrivers/net/ethernet/freescale/fs_enet/mii-bitbang.c:176:\tret = of_mdiobus_register(new_bus, ofdev-\u003edev.of_node);\ndrivers/net/ethernet/freescale/fs_enet/mii-bitbang.c-177-\tif (ret)\n--\ndrivers/net/ethernet/freescale/fs_enet/mii-fec.c=97=static int fs_enet_mdio_probe(struct platform_device *ofdev)\n--\ndrivers/net/ethernet/freescale/fs_enet/mii-fec.c-166-\ndrivers/net/ethernet/freescale/fs_enet/mii-fec.c:167:\tret = of_mdiobus_register(new_bus, ofdev-\u003edev.of_node);\ndrivers/net/ethernet/freescale/fs_enet/mii-fec.c-168-\tif (ret)\n--\ndrivers/net/ethernet/freescale/fsl_pq_mdio.c=409=static int fsl_pq_mdio_probe(struct platform_device *pdev)\n--\ndrivers/net/ethernet/freescale/fsl_pq_mdio.c-493-\ndrivers/net/ethernet/freescale/fsl_pq_mdio.c:494:\terr = of_mdiobus_register(new_bus, np);\ndrivers/net/ethernet/freescale/fsl_pq_mdio.c-495-\tif (err) {\n--\ndrivers/net/ethernet/freescale/xgmac_mdio.c=371=static int xgmac_mdio_probe(struct platform_device *pdev)\n--\ndrivers/net/ethernet/freescale/xgmac_mdio.c-426-\tif (is_of_node(fwnode))\ndrivers/net/ethernet/freescale/xgmac_mdio.c:427:\t\tret = of_mdiobus_register(bus, to_of_node(fwnode));\ndrivers/net/ethernet/freescale/xgmac_mdio.c-428-\telse if (is_acpi_node(fwnode))\ndrivers/net/ethernet/freescale/xgmac_mdio.c:429:\t\tret = acpi_mdiobus_register(bus, fwnode);\ndrivers/net/ethernet/freescale/xgmac_mdio.c-430-\telse\n--\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c=266=int hbg_mdio_init(struct hbg_priv *priv)\n--\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c-291-\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c:292:\tret = devm_mdiobus_register(dev, mdio_bus);\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c-293-\tif (ret)\n--\ndrivers/net/ethernet/hisilicon/hix5hd2_gmac.c=1094=static int hix5hd2_dev_probe(struct platform_device *pdev)\n--\ndrivers/net/ethernet/hisilicon/hix5hd2_gmac.c-1185-\ndrivers/net/ethernet/hisilicon/hix5hd2_gmac.c:1186:\tret = of_mdiobus_register(bus, node);\ndrivers/net/ethernet/hisilicon/hix5hd2_gmac.c-1187-\tif (ret)\n--\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c=123=int hclge_mac_mdio_config(struct hclge_dev *hdev)\n--\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c-154-\tmdio_bus-\u003ephy_mask = ~(1U \u003c\u003c mac-\u003ephy_addr);\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c:155:\tret = mdiobus_register(mdio_bus);\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c-156-\tif (ret) {\n--\ndrivers/net/ethernet/hisilicon/hns_mdio.c=495=static int hns_mdio_probe(struct platform_device *pdev)\n--\ndrivers/net/ethernet/hisilicon/hns_mdio.c-583-\ndrivers/net/ethernet/hisilicon/hns_mdio.c:584:\t\tret = of_mdiobus_register(new_bus, pdev-\u003edev.of_node);\ndrivers/net/ethernet/hisilicon/hns_mdio.c-585-\t} else if (is_acpi_node(pdev-\u003edev.fwnode)) {\n--\ndrivers/net/ethernet/hisilicon/hns_mdio.c-592-\t\t/* Register the MDIO bus */\ndrivers/net/ethernet/hisilicon/hns_mdio.c:593:\t\tret = mdiobus_register(new_bus);\ndrivers/net/ethernet/hisilicon/hns_mdio.c-594-\t} else {\n--\ndrivers/net/ethernet/ibm/emac/core.c=2560=static int emac_dt_mdio_probe(struct emac_instance *dev)\n--\ndrivers/net/ethernet/ibm/emac/core.c-2584-\tsnprintf(bus-\u003eid, MII_BUS_ID_SIZE, \"%s\", dev-\u003eofdev-\u003ename);\ndrivers/net/ethernet/ibm/emac/core.c:2585:\tres = devm_of_mdiobus_register(\u0026dev-\u003eofdev-\u003edev, bus, mii_np);\ndrivers/net/ethernet/ibm/emac/core.c-2586-\tif (res) {\n--\ndrivers/net/ethernet/intel/ixgbe/ixgbe_phy.c=1026=int ixgbe_mii_bus_init(struct ixgbe_hw *hw)\n--\ndrivers/net/ethernet/intel/ixgbe/ixgbe_phy.c-1088-\tadapter-\u003emii_bus = bus;\ndrivers/net/ethernet/intel/ixgbe/ixgbe_phy.c:1089:\treturn mdiobus_register(bus);\ndrivers/net/ethernet/intel/ixgbe/ixgbe_phy.c-1090-}\n--\ndrivers/net/ethernet/lantiq_etop.c=385=ltq_etop_mdio_init(struct net_device *dev)\n--\ndrivers/net/ethernet/lantiq_etop.c-402-\t\t priv-\u003epdev-\u003ename, priv-\u003epdev-\u003eid);\ndrivers/net/ethernet/lantiq_etop.c:403:\tif (mdiobus_register(priv-\u003emii_bus)) {\ndrivers/net/ethernet/lantiq_etop.c-404-\t\terr = -ENXIO;\n--\ndrivers/net/ethernet/marvell/mvmdio.c=283=static int orion_mdio_probe(struct platform_device *pdev)\n--\ndrivers/net/ethernet/marvell/mvmdio.c-381-\t/* For the platforms not supporting DT/ACPI fall-back\ndrivers/net/ethernet/marvell/mvmdio.c:382:\t * to mdiobus_register via of_mdiobus_register.\ndrivers/net/ethernet/marvell/mvmdio.c-383-\t */\ndrivers/net/ethernet/marvell/mvmdio.c-384-\tif (is_acpi_node(pdev-\u003edev.fwnode))\ndrivers/net/ethernet/marvell/mvmdio.c:385:\t\tret = acpi_mdiobus_register(bus, pdev-\u003edev.fwnode);\ndrivers/net/ethernet/marvell/mvmdio.c-386-\telse\ndrivers/net/ethernet/marvell/mvmdio.c:387:\t\tret = of_mdiobus_register(bus, pdev-\u003edev.of_node);\ndrivers/net/ethernet/marvell/mvmdio.c-388-\tif (ret \u003c 0) {\n--\ndrivers/net/ethernet/marvell/pxa168_eth.c=1387=static int pxa168_eth_probe(struct platform_device *pdev)\n--\ndrivers/net/ethernet/marvell/pxa168_eth.c-1504-\tpep-\u003esmi_bus-\u003ephy_mask = 0xffffffff;\ndrivers/net/ethernet/marvell/pxa168_eth.c:1505:\terr = mdiobus_register(pep-\u003esmi_bus);\ndrivers/net/ethernet/marvell/pxa168_eth.c-1506-\tif (err)\n--\ndrivers/net/ethernet/mediatek/mtk_eth_soc.c=998=static int mtk_mdio_init(struct mtk_eth *eth)\n--\ndrivers/net/ethernet/mediatek/mtk_eth_soc.c-1037-\tdev_dbg(eth-\u003edev, \"MDC is running on %d Hz\\n\", MDC_MAX_FREQ / eth-\u003emdc_divider);\ndrivers/net/ethernet/mediatek/mtk_eth_soc.c:1038:\tret = of_mdiobus_register(eth-\u003emii_bus, mii_np);\ndrivers/net/ethernet/mediatek/mtk_eth_soc.c-1039-\n--\ndrivers/net/ethernet/mediatek/mtk_star_emac.c=1422=static int mtk_star_mdio_init(struct net_device *ndev)\n--\ndrivers/net/ethernet/mediatek/mtk_star_emac.c-1447-\ndrivers/net/ethernet/mediatek/mtk_star_emac.c:1448:\tret = devm_of_mdiobus_register(dev, priv-\u003emii, mdio_node);\ndrivers/net/ethernet/mediatek/mtk_star_emac.c-1449-\n--\ndrivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c=287=int mlxbf_gige_mdio_probe(struct platform_device *pdev, struct mlxbf_gige *priv)\n--\ndrivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c-332-\ndrivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c:333:\tret = mdiobus_register(priv-\u003emdiobus);\ndrivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c-334-\tif (ret)\n--\ndrivers/net/ethernet/meta/fbnic/fbnic_mdio.c=253=int fbnic_mdiobus_create(struct fbnic_dev *fbd)\n--\ndrivers/net/ethernet/meta/fbnic/fbnic_mdio.c-272-\ndrivers/net/ethernet/meta/fbnic/fbnic_mdio.c:273:\terr = devm_mdiobus_register(fbd-\u003edev, bus);\ndrivers/net/ethernet/meta/fbnic/fbnic_mdio.c-274-\tif (err) {\n--\ndrivers/net/ethernet/micrel/ks8851_common.c=1030=static int ks8851_register_mdiobus(struct ks8851_net *ks, struct device *dev)\n--\ndrivers/net/ethernet/micrel/ks8851_common.c-1046-\ndrivers/net/ethernet/micrel/ks8851_common.c:1047:\tret = mdiobus_register(mii_bus);\ndrivers/net/ethernet/micrel/ks8851_common.c-1048-\tif (ret)\ndrivers/net/ethernet/micrel/ks8851_common.c:1049:\t\tgoto err_mdiobus_register;\ndrivers/net/ethernet/micrel/ks8851_common.c-1050-\n--\ndrivers/net/ethernet/micrel/ks8851_common.c-1054-\ndrivers/net/ethernet/micrel/ks8851_common.c:1055:err_mdiobus_register:\ndrivers/net/ethernet/micrel/ks8851_common.c-1056-\tmdiobus_free(mii_bus);\n--\ndrivers/net/ethernet/microchip/lan743x_main.c=1379=static int lan743x_hw_reset_phy(struct lan743x_adapter *adapter)\n--\ndrivers/net/ethernet/microchip/lan743x_main.c-1382-\ndrivers/net/ethernet/microchip/lan743x_main.c:1383:\t/* Only called with in probe, and before mdiobus_register */\ndrivers/net/ethernet/microchip/lan743x_main.c-1384-\n--\ndrivers/net/ethernet/microchip/lan743x_main.c=3628=static int lan743x_mdiobus_init(struct lan743x_adapter *adapter)\n--\ndrivers/net/ethernet/microchip/lan743x_main.c-3671-\t/* register mdiobus */\ndrivers/net/ethernet/microchip/lan743x_main.c:3672:\tret = mdiobus_register(adapter-\u003emdiobus);\ndrivers/net/ethernet/microchip/lan743x_main.c-3673-\tif (ret \u003c 0)\n--\ndrivers/net/ethernet/ni/nixge.c=1212=static int nixge_mdio_setup(struct nixge_priv *priv, struct device_node *np)\n--\ndrivers/net/ethernet/ni/nixge.c-1230-\ndrivers/net/ethernet/ni/nixge.c:1231:\treturn of_mdiobus_register(bus, np);\ndrivers/net/ethernet/ni/nixge.c-1232-}\n--\n\n"
}

39/2 2026/09/14 23:09 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 73379
							output: 24
							thoughts: 21
						

Thoughts:
Here's my attempt at summarizing the thought process, tailored for an expert audience:

**MDIO Driver Exploration**

Okay, hold on a minute. Before I dive too deep into this networking issue, let's step back and consider the Media Independent Interface (MDIO) drivers. My immediate thought is to check what's actually available within the kernel's `drivers/net/mdio/` directory. Understanding the existing MDIO driver landscape is crucial before I start troubleshooting or integrating anything new. I need to get a clear picture of the current implementations. What specific hardware and PHYs are already supported by the kernel? Let's take a look.



40/2 2026/09/14 23:09 tool codesearch-dir-index
0m Args:
{
  "Dir": "drivers/net/mdio"
}

Results:
{
  "Files": [
    "acpi_mdio.c",
    "fwnode_mdio.c",
    "mdio-airoha.c",
    "mdio-aspeed.c",
    "mdio-bcm-iproc.c",
    "mdio-bcm-unimac.c",
    "mdio-bitbang.c",
    "mdio-cavium.c",
    "mdio-cavium.h",
    "mdio-gpio.c",
    "mdio-hisi-femac.c",
    "mdio-i2c.c",
    "mdio-ipq4019.c",
    "mdio-ipq8064.c",
    "mdio-moxart.c",
    "mdio-mscc-miim.c",
    "mdio-mux-bcm-iproc.c",
    "mdio-mux-bcm6368.c",
    "mdio-mux-gpio.c",
    "mdio-mux-meson-g12a.c",
    "mdio-mux-meson-gxl.c",
    "mdio-mux-mmioreg.c",
    "mdio-mux-multiplexer.c",
    "mdio-mux.c",
    "mdio-mvusb.c",
    "mdio-octeon.c",
    "mdio-pic64hpsc.c",
    "mdio-realtek-rtl9300.c",
    "mdio-regmap.c",
    "mdio-sun4i.c",
    "mdio-thunder.c",
    "mdio-xgene.c",
    "of_mdio.c"
  ],
  "Subdirs": null
}

41/2 2026/09/14 23:09 llm patch-evaluator-compressor
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Reply:
### 1. Approaches Tried and Results

- **Patch Inspection**:
  - Inspected the commit diff in `drivers/net/phy/phy_device.c` at function `phy_attach_direct()`.
  - Added code:
    ```c
    } else if (!phydev->drv) {
        /* d->driver outlives phydev->drv on unbind, precedes it on bind */
        err = -EBUSY;
        goto error_put_device;
    }
    ```
  - Identified the core change: inside `phy_attach_direct()`, when `d->driver` is non-NULL (a driver is associated or in the process of binding/unbinding) but `phydev->drv` is NULL, return `-EBUSY`.

- **Call Path & Reachability Analysis**:
  - Checked callers of `phy_attach_direct()`:
    - Direct callers include `phy_connect_direct()`, `phylink_attach_phy()`, `phylink_fwnode_phy_connect()`, and several network drivers (`xgbe-phy-v2.c`, `hns_enet.c`).
    - Indirect callers: `phy_connect()` calls `phy_connect_direct()`, widely used across Ethernet drivers and USB net drivers.
  - Checked virtual / emulated bus reachability:
    - Searched for USB Ethernet drivers calling PHY connect/attach: found `drivers/net/usb/ax88172a.c` (`CONFIG_USB_NET_AX88172A`), which creates an MDIO bus and calls `phy_connect()` during `ax88172a_reset()`.
    - USB net devices can be instantiated and fuzzed via Syzkaller USB emulation (raw-gadget / dummy_hcd).

- **Lifecycle and State Mechanics**:
  - Traced `phydev->drv` assignment:
    - Set in `phy_probe(struct device *dev)` (`phydev->drv = phydrv`).
    - Cleared in `phy_remove(struct device *dev)` (`phydev->drv = NULL`).
  - Observed device core interaction:
    - `d->driver` is set by the device driver core before `probe()` completes or until driver unbind finishes.
    - If `phy_attach_direct()` was called concurrently or in a state where `d->driver` was set but `phydev->drv` was NULL (e.g. during bind/unbind race, or if device probe hasn't populated `phydev->drv`, or unbind cleared `phydev->drv` while `d->driver` still exists), line 1858 previously did `!phy_drv_supports_irq(phydev->drv)` which would dereference `phydev->drv` or cause undefined behavior / null pointer dereference if `phydev->drv == NULL`.

### 2. Current Hypotheses & Triage Evaluation

- **Evaluation against triage criteria**:
  - **Reachable code**: `phy_attach_direct()` is part of the core PHY library (`drivers/net/phy/phy_device.c`).
  - Reachable via USB Ethernet drivers (e.g. `ax88172a`), sysfs device binding/unbinding operations, or network device operations.
  - The patch introduces a defensive runtime check returning `-EBUSY` when `d->driver && !phydev->drv`, preventing potential NULL dereference later in `phy_attach_direct()` (specifically at line 1858: `phy_drv_supports_irq(phydev->drv)`).
  - Since this touches reachable executable code in a core driver subsystem (PHY library) and modifies error/state-validation handling, this patch qualifies as `WorthFuzzing=true`.

- **Focus Symbols**:
  - `phy_attach_direct` (the direct modified function)
  - `phy_connect_direct` (direct caller wrapper)
  - `phy_connect` (common entrypoint for PHY attachment)
  - `phy_probe` / `phy_remove` (lifecycle functions setting/clearing `phydev->drv`)

- **EnableConfigs**:
  - `PHYLIB` (core phylib config)
  - `MDIO_BUS`
  - `USB_NET_AX88172A` (USB net driver exercising phylib over USB)
  - `USB_USBNET`

### 3. Critical File Paths & Snippets

- **Target File**: `drivers/net/phy/phy_device.c`
- **Context in `phy_attach_direct()`** (~lines 1774–1794):
  ```c
  /* Assume that if there is no driver, that it doesn't
   * exist, and we should use the genphy driver.
   */
  if (!d->driver) {
      if (phydev->is_c45)
          d->driver = &genphy_c45_driver.mdiodrv.driver;
      else
          d->driver = &genphy_driver.mdiodrv.driver;

      phydev->is_genphy_driven = 1;
  } else if (!phydev->drv) {
      /* d->driver outlives phydev->drv on unbind, precedes it on bind */
      err = -EBUSY;
      goto error_put_device;
  }

  if (!try_module_get(d->driver->owner)) {
      phydev_err(phydev, "failed to get the device driver module\n");
      err = -EIO;
      goto error_put_device;
  }
  ```
- **Context in `phy_probe()`** (`drivers/net/phy/phy_device.c:3689`):
  ```c
  static int phy_probe(struct device *dev)
  {
      struct phy_device *phydev = to_phy_device(dev);
      struct device_driver *drv = phydev->mdio.dev.driver;
      struct phy_driver *phydrv = to_phy_driver(drv);
      int err = 0;

      phydev->drv = phydrv;
      ...
  ```
- **Context in `phy_remove()`** (`drivers/net/phy/phy_device.c:3833`):
  ```c
  static int phy_remove(struct device *dev)
  {
      ...
      phydev->drv = NULL;
      return 0;
  }
  ```

### 4. Watchouts & Guidance for Next Step
- No repetitive loop detected.
- Investigation of reachability and symbol identification is complete.
- Next step: call `set-results` tool once with final determination (`WorthFuzzing=true`, target `FocusSymbols`, `EnableConfigs`, and explanatory reasoning) and provide the concluding triage output.

Tokens:
							input: 57755
							output: 1548
							thoughts: 0
						

42/2 2026/09/14 23:09 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 22571
							output: 26
							thoughts: 0
						

43/2 2026/09/14 23:09 tool grepper
0m Args:
{
  "Expression": "phy_connect",
  "PathPrefix": "drivers/net"
}

Results:
{
  "Output": "\nFull output is too long, showing 500 out of 917 lines.\nUse more precise expression if possible.\n\ndrivers/net/dsa/bcm_sf2.c=607=static int bcm_sf2_mdio_register(struct dsa_switch *ds)\n--\ndrivers/net/dsa/bcm_sf2.c-656-\ndrivers/net/dsa/bcm_sf2.c:657:\t/* We need to make sure that of_phy_connect() will not work by\ndrivers/net/dsa/bcm_sf2.c-658-\t * removing the 'phandle' and 'linux,phandle' properties and\n--\ndrivers/net/dsa/netc/netc_main.c=968=static bool netc_port_is_emdio_consumer(struct device_node *node)\n--\ndrivers/net/dsa/netc/netc_main.c-984-\ndrivers/net/dsa/netc/netc_main.c:985:/* Currently, phylink_of_phy_connect() is called by dsa_user_create(),\ndrivers/net/dsa/netc/netc_main.c-986- * so if the switch uses the external MDIO controller (like the EMDIO\ndrivers/net/dsa/netc/netc_main.c-987- * function) to manage the external PHYs. The MDIO bus may not be\ndrivers/net/dsa/netc/netc_main.c:988: * created when phylink_of_phy_connect() is called, so it will return\ndrivers/net/dsa/netc/netc_main.c-989- * an error and cause the switch driver to fail to probe.\ndrivers/net/dsa/netc/netc_main.c:990: * This workaround can be removed when DSA phylink_of_phy_connect()\ndrivers/net/dsa/netc/netc_main.c-991- * calls are moved from probe() to ndo_open().\n--\ndrivers/net/ethernet/8390/ax88796.c=364=static int ax_mii_probe(struct net_device *dev)\n--\ndrivers/net/ethernet/8390/ax88796.c-376-\ndrivers/net/ethernet/8390/ax88796.c:377:\tret = phy_connect_direct(dev, phy_dev, ax_handle_link_change,\ndrivers/net/ethernet/8390/ax88796.c-378-\t\t\t\t PHY_INTERFACE_MODE_MII);\n--\ndrivers/net/ethernet/adi/adin1110.c=1569=static int adin1110_probe_netdevs(struct adin1110_priv *priv)\n--\ndrivers/net/ethernet/adi/adin1110.c-1612-\ndrivers/net/ethernet/adi/adin1110.c:1613:\t\tport_priv-\u003ephydev = phy_connect(netdev,\ndrivers/net/ethernet/adi/adin1110.c-1614-\t\t\t\t\t\tphydev_name(port_priv-\u003ephydev),\n--\ndrivers/net/ethernet/adi/adin1140.c=650=static int adin1140_phy_init(struct adin1140_priv *priv,\n--\ndrivers/net/ethernet/adi/adin1140.c-663-\tpriv-\u003ephydev-\u003eis_internal = true;\ndrivers/net/ethernet/adi/adin1140.c:664:\tret = phy_connect_direct(priv-\u003enetdev, priv-\u003ephydev,\ndrivers/net/ethernet/adi/adin1140.c-665-\t\t\t\t \u0026adin1140_handle_link_change,\n--\ndrivers/net/ethernet/aeroflex/greth.c=1253=static int greth_mdio_probe(struct net_device *dev)\n--\ndrivers/net/ethernet/aeroflex/greth.c-1267-\ndrivers/net/ethernet/aeroflex/greth.c:1268:\tret = phy_connect_direct(dev, phy, \u0026greth_link_change,\ndrivers/net/ethernet/aeroflex/greth.c-1269-\t\t\t\t greth-\u003egbit_mac ? PHY_INTERFACE_MODE_GMII : PHY_INTERFACE_MODE_MII);\n--\ndrivers/net/ethernet/agere/et131x.c=3273=static int et131x_mii_probe(struct net_device *netdev)\n--\ndrivers/net/ethernet/agere/et131x.c-3283-\ndrivers/net/ethernet/agere/et131x.c:3284:\tphydev = phy_connect(netdev, phydev_name(phydev),\ndrivers/net/ethernet/agere/et131x.c-3285-\t\t\t     \u0026et131x_adjust_link, PHY_INTERFACE_MODE_MII);\n--\ndrivers/net/ethernet/allwinner/sun4i-emac.c=167=static int emac_mdio_probe(struct net_device *dev)\n--\ndrivers/net/ethernet/allwinner/sun4i-emac.c-174-\t/* attach the mac to the phy */\ndrivers/net/ethernet/allwinner/sun4i-emac.c:175:\tphydev = of_phy_connect(db-\u003endev, db-\u003ephy_node,\ndrivers/net/ethernet/allwinner/sun4i-emac.c-176-\t\t\t\t\u0026emac_handle_link_change, 0,\n--\ndrivers/net/ethernet/altera/altera_tse_main.c=876=static int tse_open(struct net_device *dev)\n--\ndrivers/net/ethernet/altera/altera_tse_main.c-951-\ndrivers/net/ethernet/altera/altera_tse_main.c:952:\tret = phylink_of_phy_connect(priv-\u003ephylink, priv-\u003edevice-\u003eof_node, 0);\ndrivers/net/ethernet/altera/altera_tse_main.c-953-\tif (ret) {\n--\ndrivers/net/ethernet/amd/au1000_eth.c=472=static int au1000_mii_probe(struct net_device *dev)\n--\ndrivers/net/ethernet/amd/au1000_eth.c-538-\ndrivers/net/ethernet/amd/au1000_eth.c:539:\tphydev = phy_connect(dev, phydev_name(phydev),\ndrivers/net/ethernet/amd/au1000_eth.c-540-\t\t\t     \u0026au1000_adjust_link, PHY_INTERFACE_MODE_MII);\n--\ndrivers/net/ethernet/apm/xgene-v2/mdio.c=98=int xge_mdio_config(struct net_device *ndev)\n--\ndrivers/net/ethernet/apm/xgene-v2/mdio.c-128-\t}\ndrivers/net/ethernet/apm/xgene-v2/mdio.c:129:\tphydev = phy_connect(ndev, phydev_name(phydev),\ndrivers/net/ethernet/apm/xgene-v2/mdio.c-130-\t\t\t     \u0026xge_adjust_link,\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c=819=static struct acpi_device *acpi_phy_find_device(struct device *dev)\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-836-\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c:837:int xgene_enet_phy_connect(struct net_device *ndev)\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-838-{\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-847-\t\t\tnp = of_parse_phandle(dev-\u003eof_node, \"phy-handle\", i);\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c:848:\t\t\tphy_dev = of_phy_connect(ndev, np,\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-849-\t\t\t\t\t\t \u0026xgene_enet_adjust_link,\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-868-\t\tif (!phy_dev ||\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c:869:\t\t    phy_connect_direct(ndev, phy_dev, \u0026xgene_enet_adjust_link,\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-870-\t\t\t\t       pdata-\u003ephy_mode)) {\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c=939=int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata)\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-965-\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c:966:\tret = xgene_enet_phy_connect(ndev);\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.c-967-\tif (ret)\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.h=426=bool xgene_ring_mgr_init(struct xgene_enet_pdata *p);\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.h:427:int xgene_enet_phy_connect(struct net_device *ndev);\ndrivers/net/ethernet/apm/xgene/xgene_enet_hw.h-428-void xgene_enet_phy_disconnect(struct xgene_enet_pdata *pdata);\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_main.c=1651=static void xgene_enet_check_phy_handle(struct xgene_enet_pdata *pdata)\n--\ndrivers/net/ethernet/apm/xgene/xgene_enet_main.c-1660-\ndrivers/net/ethernet/apm/xgene/xgene_enet_main.c:1661:\tret = xgene_enet_phy_connect(pdata-\u003endev);\ndrivers/net/ethernet/apm/xgene/xgene_enet_main.c-1662-\tif (!ret)\n--\ndrivers/net/ethernet/arc/emac_main.c=858=int arc_emac_probe(struct net_device *ndev, int interface)\n--\ndrivers/net/ethernet/arc/emac_main.c-988-\ndrivers/net/ethernet/arc/emac_main.c:989:\tphydev = of_phy_connect(ndev, phy_node, arc_emac_adjust_link, 0,\ndrivers/net/ethernet/arc/emac_main.c-990-\t\t\t\tinterface);\ndrivers/net/ethernet/arc/emac_main.c-991-\tif (!phydev) {\ndrivers/net/ethernet/arc/emac_main.c:992:\t\tdev_err(dev, \"of_phy_connect() failed\\n\");\ndrivers/net/ethernet/arc/emac_main.c-993-\t\terr = -ENODEV;\n--\ndrivers/net/ethernet/asix/ax88796c_main.c=966=static int ax88796c_probe(struct spi_device *spi)\n--\ndrivers/net/ethernet/asix/ax88796c_main.c-1076-\t\t ax_local-\u003emdiobus-\u003eid, AX88796C_PHY_ID);\ndrivers/net/ethernet/asix/ax88796c_main.c:1077:\tax_local-\u003ephydev = phy_connect(ax_local-\u003endev, phy_id,\ndrivers/net/ethernet/asix/ax88796c_main.c-1078-\t\t\t\t       ax88796c_handle_link_change,\n--\ndrivers/net/ethernet/atheros/ag71xx.c=1404=static int ag71xx_open(struct net_device *ndev)\n--\ndrivers/net/ethernet/atheros/ag71xx.c-1409-\ndrivers/net/ethernet/atheros/ag71xx.c:1410:\tret = phylink_of_phy_connect(ag-\u003ephylink, ag-\u003epdev-\u003edev.of_node, 0);\ndrivers/net/ethernet/atheros/ag71xx.c-1411-\tif (ret) {\ndrivers/net/ethernet/atheros/ag71xx.c:1412:\t\tnetif_err(ag, link, ndev, \"phylink_of_phy_connect filed with err: %i\\n\",\ndrivers/net/ethernet/atheros/ag71xx.c-1413-\t\t\t  ret);\n--\ndrivers/net/ethernet/broadcom/asp2/bcmasp_intf.c=1076=static int bcmasp_phy_attach(struct bcmasp_intf *intf)\n--\ndrivers/net/ethernet/broadcom/asp2/bcmasp_intf.c-1084-\tphy_iface = bcmasp_phy_iface_for_connect(intf-\u003ephy_interface);\ndrivers/net/ethernet/broadcom/asp2/bcmasp_intf.c:1085:\tphydev = of_phy_connect(intf-\u003endev, intf-\u003ephy_dn,\ndrivers/net/ethernet/broadcom/asp2/bcmasp_intf.c-1086-\t\t\t\tbcmasp_adj_link, phy_flags,\n--\ndrivers/net/ethernet/broadcom/b44.c=2234=static int b44_register_phy_one(struct b44 *bp)\n--\ndrivers/net/ethernet/broadcom/b44.c-2280-\telse\ndrivers/net/ethernet/broadcom/b44.c:2281:\t\terr = phy_connect_direct(bp-\u003edev, phydev, \u0026b44_adjust_link,\ndrivers/net/ethernet/broadcom/b44.c-2282-\t\t\t\t\t PHY_INTERFACE_MODE_MII);\n--\ndrivers/net/ethernet/broadcom/bcm63xx_enet.c=890=static int bcm_enet_open(struct net_device *dev)\n--\ndrivers/net/ethernet/broadcom/bcm63xx_enet.c-909-\ndrivers/net/ethernet/broadcom/bcm63xx_enet.c:910:\t\tphydev = phy_connect(dev, phy_id, bcm_enet_adjust_phy_link,\ndrivers/net/ethernet/broadcom/bcm63xx_enet.c-911-\t\t\t\t     PHY_INTERFACE_MODE_MII);\n--\ndrivers/net/ethernet/broadcom/bcmsysport.c=1928=static int bcm_sysport_open(struct net_device *dev)\n--\ndrivers/net/ethernet/broadcom/bcmsysport.c-1966-\ndrivers/net/ethernet/broadcom/bcmsysport.c:1967:\tphydev = of_phy_connect(dev, priv-\u003ephy_dn, bcm_sysport_adj_link,\ndrivers/net/ethernet/broadcom/bcmsysport.c-1968-\t\t\t\t0, priv-\u003ephy_interface);\n--\ndrivers/net/ethernet/broadcom/bgmac-bcma.c=79=static void bcma_bgmac_cmn_maskset32(struct bgmac *bgmac, u16 offset, u32 mask,\n--\ndrivers/net/ethernet/broadcom/bgmac-bcma.c-84-\ndrivers/net/ethernet/broadcom/bgmac-bcma.c:85:static int bcma_phy_connect(struct bgmac *bgmac)\ndrivers/net/ethernet/broadcom/bgmac-bcma.c-86-{\n--\ndrivers/net/ethernet/broadcom/bgmac-bcma.c-99-\t\t\t bgmac-\u003ephyaddr);\ndrivers/net/ethernet/broadcom/bgmac-bcma.c:100:\t\tphy_dev = phy_connect(bgmac-\u003enet_dev, bus_id, bgmac_adjust_link,\ndrivers/net/ethernet/broadcom/bgmac-bcma.c-101-\t\t\t\t      PHY_INTERFACE_MODE_MII);\n--\ndrivers/net/ethernet/broadcom/bgmac-bcma.c-110-\t/* Assume a fixed link to the switch port */\ndrivers/net/ethernet/broadcom/bgmac-bcma.c:111:\treturn bgmac_phy_connect_direct(bgmac);\ndrivers/net/ethernet/broadcom/bgmac-bcma.c-112-}\n--\ndrivers/net/ethernet/broadcom/bgmac-bcma.c=124=static int bgmac_probe(struct bcma_device *core)\n--\ndrivers/net/ethernet/broadcom/bgmac-bcma.c-311-\tbgmac-\u003ecmn_maskset32 = bcma_bgmac_cmn_maskset32;\ndrivers/net/ethernet/broadcom/bgmac-bcma.c:312:\tbgmac-\u003ephy_connect = bcma_phy_connect;\ndrivers/net/ethernet/broadcom/bgmac-bcma.c-313-\n--\ndrivers/net/ethernet/broadcom/bgmac-platform.c=118=static void bgmac_nicpm_speed_set(struct net_device *net_dev)\n--\ndrivers/net/ethernet/broadcom/bgmac-platform.c-150-\ndrivers/net/ethernet/broadcom/bgmac-platform.c:151:static int platform_phy_connect(struct bgmac *bgmac)\ndrivers/net/ethernet/broadcom/bgmac-platform.c-152-{\n--\ndrivers/net/ethernet/broadcom/bgmac-platform.c=171=static int bgmac_probe(struct platform_device *pdev)\n--\ndrivers/net/ethernet/broadcom/bgmac-platform.c-242-\t\tof_node_put(phy_node);\ndrivers/net/ethernet/broadcom/bgmac-platform.c:243:\t\tbgmac-\u003ephy_connect = platform_phy_connect;\ndrivers/net/ethernet/broadcom/bgmac-platform.c-244-\t} else {\ndrivers/net/ethernet/broadcom/bgmac-platform.c:245:\t\tbgmac-\u003ephy_connect = bgmac_phy_connect_direct;\ndrivers/net/ethernet/broadcom/bgmac-platform.c-246-\t\tbgmac-\u003efeature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;\n--\ndrivers/net/ethernet/broadcom/bgmac.c=1437=EXPORT_SYMBOL_GPL(bgmac_adjust_link);\ndrivers/net/ethernet/broadcom/bgmac.c-1438-\ndrivers/net/ethernet/broadcom/bgmac.c:1439:int bgmac_phy_connect_direct(struct bgmac *bgmac)\ndrivers/net/ethernet/broadcom/bgmac.c-1440-{\n--\ndrivers/net/ethernet/broadcom/bgmac.c-1454-\ndrivers/net/ethernet/broadcom/bgmac.c:1455:\terr = phy_connect_direct(bgmac-\u003enet_dev, phy_dev, bgmac_adjust_link,\ndrivers/net/ethernet/broadcom/bgmac.c-1456-\t\t\t\t PHY_INTERFACE_MODE_MII);\n--\ndrivers/net/ethernet/broadcom/bgmac.c-1463-}\ndrivers/net/ethernet/broadcom/bgmac.c:1464:EXPORT_SYMBOL_GPL(bgmac_phy_connect_direct);\ndrivers/net/ethernet/broadcom/bgmac.c-1465-\n--\ndrivers/net/ethernet/broadcom/bgmac.c=1487=int bgmac_enet_probe(struct bgmac *bgmac)\n--\ndrivers/net/ethernet/broadcom/bgmac.c-1532-\ndrivers/net/ethernet/broadcom/bgmac.c:1533:\terr = bgmac_phy_connect(bgmac);\ndrivers/net/ethernet/broadcom/bgmac.c-1534-\tif (err) {\n--\ndrivers/net/ethernet/broadcom/bgmac.h=439=struct bgmac {\n--\ndrivers/net/ethernet/broadcom/bgmac.h-495-\t\t\t      u32 set);\ndrivers/net/ethernet/broadcom/bgmac.h:496:\tint (*phy_connect)(struct bgmac *bgmac);\ndrivers/net/ethernet/broadcom/bgmac.h-497-};\n--\ndrivers/net/ethernet/broadcom/bgmac.h=502=void bgmac_adjust_link(struct net_device *net_dev);\ndrivers/net/ethernet/broadcom/bgmac.h:503:int bgmac_phy_connect_direct(struct bgmac *bgmac);\ndrivers/net/ethernet/broadcom/bgmac.h-504-int bgmac_enet_suspend(struct bgmac *bgmac);\n--\ndrivers/net/ethernet/broadcom/bgmac.h=583=static inline void bgmac_umac_maskset(struct bgmac *bgmac, u16 offset, u32 mask, u32 set)\n--\ndrivers/net/ethernet/broadcom/bgmac.h-587-\ndrivers/net/ethernet/broadcom/bgmac.h:588:static inline int bgmac_phy_connect(struct bgmac *bgmac)\ndrivers/net/ethernet/broadcom/bgmac.h-589-{\ndrivers/net/ethernet/broadcom/bgmac.h:590:\treturn bgmac-\u003ephy_connect(bgmac);\ndrivers/net/ethernet/broadcom/bgmac.h-591-}\n--\ndrivers/net/ethernet/broadcom/genet/bcmmii.c=301=int bcmgenet_mii_probe(struct net_device *dev)\n--\ndrivers/net/ethernet/broadcom/genet/bcmmii.c-350-\tif (dn) {\ndrivers/net/ethernet/broadcom/genet/bcmmii.c:351:\t\tphydev = of_phy_connect(dev, priv-\u003ephy_dn, bcmgenet_mii_setup,\ndrivers/net/ethernet/broadcom/genet/bcmmii.c-352-\t\t\t\t\tphy_flags, phy_iface);\n--\ndrivers/net/ethernet/broadcom/genet/bcmmii.c-380-\ndrivers/net/ethernet/broadcom/genet/bcmmii.c:381:\t\tret = phy_connect_direct(dev, phydev, bcmgenet_mii_setup,\ndrivers/net/ethernet/broadcom/genet/bcmmii.c-382-\t\t\t\t\t phy_iface);\n--\ndrivers/net/ethernet/broadcom/sb1250-mac.c=2324=static int sbmac_mii_probe(struct net_device *dev)\n--\ndrivers/net/ethernet/broadcom/sb1250-mac.c-2334-\ndrivers/net/ethernet/broadcom/sb1250-mac.c:2335:\tphy_dev = phy_connect(dev, dev_name(\u0026phy_dev-\u003emdio.dev),\ndrivers/net/ethernet/broadcom/sb1250-mac.c-2336-\t\t\t      \u0026sbmac_mii_poll, PHY_INTERFACE_MODE_GMII);\n--\ndrivers/net/ethernet/broadcom/tg3.c=2084=static int tg3_phy_init(struct tg3 *tp)\n--\ndrivers/net/ethernet/broadcom/tg3.c-2096-\t/* Attach the MAC to the PHY. */\ndrivers/net/ethernet/broadcom/tg3.c:2097:\tphydev = phy_connect(tp-\u003edev, phydev_name(phydev),\ndrivers/net/ethernet/broadcom/tg3.c-2098-\t\t\t     tg3_adjust_link, phydev-\u003einterface);\n--\ndrivers/net/ethernet/cadence/macb_main.c=982=static int macb_phylink_connect(struct macb *bp)\n--\ndrivers/net/ethernet/cadence/macb_main.c-989-\tif (dn)\ndrivers/net/ethernet/cadence/macb_main.c:990:\t\tret = phylink_of_phy_connect(bp-\u003ephylink, dn, 0);\ndrivers/net/ethernet/cadence/macb_main.c-991-\n--\ndrivers/net/ethernet/cavium/octeon/octeon_mgmt.c=945=static int octeon_mgmt_init_phy(struct net_device *netdev)\n--\ndrivers/net/ethernet/cavium/octeon/octeon_mgmt.c-955-\ndrivers/net/ethernet/cavium/octeon/octeon_mgmt.c:956:\tphydev = of_phy_connect(netdev, p-\u003ephy_np,\ndrivers/net/ethernet/cavium/octeon/octeon_mgmt.c-957-\t\t\t\tocteon_mgmt_adjust_link, 0,\n--\ndrivers/net/ethernet/cavium/thunder/thunder_bgx.c=1055=static int bgx_lmac_enable(struct bgx *bgx, u8 lmacid)\n--\ndrivers/net/ethernet/cavium/thunder/thunder_bgx.c-1119-\ndrivers/net/ethernet/cavium/thunder/thunder_bgx.c:1120:\t\tif (phy_connect_direct(lmac-\u003enetdev, lmac-\u003ephydev,\ndrivers/net/ethernet/cavium/thunder/thunder_bgx.c-1121-\t\t\t\t       bgx_lmac_handler,\n--\ndrivers/net/ethernet/davicom/dm9051.c=1132=static void dm9051_handle_link_change(struct net_device *ndev)\n--\ndrivers/net/ethernet/davicom/dm9051.c-1151- */\ndrivers/net/ethernet/davicom/dm9051.c:1152:static int dm9051_phy_connect(struct board_info *db)\ndrivers/net/ethernet/davicom/dm9051.c-1153-{\n--\ndrivers/net/ethernet/davicom/dm9051.c-1158-\ndrivers/net/ethernet/davicom/dm9051.c:1159:\tdb-\u003ephydev = phy_connect(db-\u003endev, phy_id, dm9051_handle_link_change,\ndrivers/net/ethernet/davicom/dm9051.c-1160-\t\t\t\t PHY_INTERFACE_MODE_MII);\n--\ndrivers/net/ethernet/davicom/dm9051.c=1164=static int dm9051_probe(struct spi_device *spi)\n--\ndrivers/net/ethernet/davicom/dm9051.c-1208-\ndrivers/net/ethernet/davicom/dm9051.c:1209:\tret = dm9051_phy_connect(db);\ndrivers/net/ethernet/davicom/dm9051.c-1210-\tif (ret)\n--\ndrivers/net/ethernet/engleder/tsnep_main.c=241=static int tsnep_phy_open(struct tsnep_adapter *adapter)\n--\ndrivers/net/ethernet/engleder/tsnep_main.c-246-\ndrivers/net/ethernet/engleder/tsnep_main.c:247:\tretval = phy_connect_direct(adapter-\u003enetdev, adapter-\u003ephydev,\ndrivers/net/ethernet/engleder/tsnep_main.c-248-\t\t\t\t    tsnep_phy_link_status_change,\n--\ndrivers/net/ethernet/ethoc.c=699=static int ethoc_mdio_probe(struct net_device *dev)\n--\ndrivers/net/ethernet/ethoc.c-715-\ndrivers/net/ethernet/ethoc.c:716:\terr = phy_connect_direct(dev, phy, ethoc_mdio_poll,\ndrivers/net/ethernet/ethoc.c-717-\t\t\t\t PHY_INTERFACE_MODE_GMII);\n--\ndrivers/net/ethernet/faraday/ftgmac100.c=1497=static int ftgmac100_mii_probe(struct net_device *netdev)\n--\ndrivers/net/ethernet/faraday/ftgmac100.c-1541-\ndrivers/net/ethernet/faraday/ftgmac100.c:1542:\tphydev = phy_connect(netdev, phydev_name(phydev),\ndrivers/net/ethernet/faraday/ftgmac100.c-1543-\t\t\t     \u0026ftgmac100_adjust_link, phy_intf);\n--\ndrivers/net/ethernet/faraday/ftgmac100.c=1848=static int ftgmac100_probe_ncsi(struct net_device *netdev,\n--\ndrivers/net/ethernet/faraday/ftgmac100.c-1872-\t}\ndrivers/net/ethernet/faraday/ftgmac100.c:1873:\terr = phy_connect_direct(netdev, phydev, ftgmac100_adjust_link,\ndrivers/net/ethernet/faraday/ftgmac100.c-1874-\t\t\t\t PHY_INTERFACE_MODE_RMII);\n--\ndrivers/net/ethernet/freescale/dpaa/dpaa_eth.c=2941=static int dpaa_open(struct net_device *net_dev)\n--\ndrivers/net/ethernet/freescale/dpaa/dpaa_eth.c-2950-\ndrivers/net/ethernet/freescale/dpaa/dpaa_eth.c:2951:\terr = phylink_of_phy_connect(mac_dev-\u003ephylink,\ndrivers/net/ethernet/freescale/dpaa/dpaa_eth.c-2952-\t\t\t\t     mac_dev-\u003edev-\u003eof_node, 0);\n--\ndrivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c=560=int dpaa2_mac_connect(struct dpaa2_mac *mac)\n--\ndrivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c-634-\trtnl_lock();\ndrivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c:635:\terr = phylink_fwnode_phy_connect(mac-\u003ephylink, dpmac_node, 0);\ndrivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c-636-\trtnl_unlock();\ndrivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c-637-\tif (err) {\ndrivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c:638:\t\tnetdev_err(net_dev, \"phylink_fwnode_phy_connect() = %d\\n\", err);\ndrivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c-639-\t\tgoto err_phylink_destroy;\n--\ndrivers/net/ethernet/freescale/enetc/enetc.c=2935=static int enetc_phylink_connect(struct net_device *ndev)\n--\ndrivers/net/ethernet/freescale/enetc/enetc.c-2946-\ndrivers/net/ethernet/freescale/enetc/enetc.c:2947:\terr = phylink_of_phy_connect(priv-\u003ephylink, priv-\u003edev-\u003eof_node, 0);\ndrivers/net/ethernet/freescale/enetc/enetc.c-2948-\tif (err) {\n--\ndrivers/net/ethernet/freescale/enetc/enetc.c=3010=int enetc_open(struct net_device *ndev)\n--\ndrivers/net/ethernet/freescale/enetc/enetc.c-3028-\tif (err)\ndrivers/net/ethernet/freescale/enetc/enetc.c:3029:\t\tgoto err_phy_connect;\ndrivers/net/ethernet/freescale/enetc/enetc.c-3030-\n--\ndrivers/net/ethernet/freescale/enetc/enetc.c-3055-\t\tphylink_disconnect_phy(priv-\u003ephylink);\ndrivers/net/ethernet/freescale/enetc/enetc.c:3056:err_phy_connect:\ndrivers/net/ethernet/freescale/enetc/enetc.c-3057-\tenetc_free_irqs(priv);\n--\ndrivers/net/ethernet/freescale/fec_main.c=2981=static int fec_enet_mii_probe(struct net_device *ndev)\n--\ndrivers/net/ethernet/freescale/fec_main.c-2987-\tif (fep-\u003ephy_node) {\ndrivers/net/ethernet/freescale/fec_main.c:2988:\t\tphy_dev = of_phy_connect(ndev, fep-\u003ephy_node,\ndrivers/net/ethernet/freescale/fec_main.c-2989-\t\t\t\t\t \u0026fec_enet_adjust_link, 0,\n--\ndrivers/net/ethernet/freescale/fec_main.c-3009-\ndrivers/net/ethernet/freescale/fec_main.c:3010:\t\tret = phy_connect_direct(ndev, phy_dev, \u0026fec_enet_adjust_link,\ndrivers/net/ethernet/freescale/fec_main.c-3011-\t\t\t\t\t fep-\u003ephy_interface);\n--\ndrivers/net/ethernet/freescale/fec_mpc52xx.c=216=static int mpc52xx_fec_open(struct net_device *dev)\n--\ndrivers/net/ethernet/freescale/fec_mpc52xx.c-222-\tif (priv-\u003ephy_node) {\ndrivers/net/ethernet/freescale/fec_mpc52xx.c:223:\t\tphydev = of_phy_connect(priv-\u003endev, priv-\u003ephy_node,\ndrivers/net/ethernet/freescale/fec_mpc52xx.c-224-\t\t\t\t\tmpc52xx_fec_adjust_link, 0, 0);\ndrivers/net/ethernet/freescale/fec_mpc52xx.c-225-\t\tif (!phydev) {\ndrivers/net/ethernet/freescale/fec_mpc52xx.c:226:\t\t\tdev_err(\u0026dev-\u003edev, \"of_phy_connect failed\\n\");\ndrivers/net/ethernet/freescale/fec_mpc52xx.c-227-\t\t\treturn -ENODEV;\n--\ndrivers/net/ethernet/freescale/fs_enet/fs_enet-main.c=656=static int fs_enet_open(struct net_device *dev)\n--\ndrivers/net/ethernet/freescale/fs_enet/fs_enet-main.c-677-\ndrivers/net/ethernet/freescale/fs_enet/fs_enet-main.c:678:\terr = phylink_of_phy_connect(fep-\u003ephylink, fep-\u003edev-\u003eof_node, 0);\ndrivers/net/ethernet/freescale/fs_enet/fs_enet-main.c-679-\tif (err) {\n--\ndrivers/net/ethernet/freescale/gianfar.c=1640=static int init_phy(struct net_device *dev)\n--\ndrivers/net/ethernet/freescale/gianfar.c-1650-\ndrivers/net/ethernet/freescale/gianfar.c:1651:\tphydev = of_phy_connect(dev, priv-\u003ephy_node, \u0026adjust_link, 0,\ndrivers/net/ethernet/freescale/gianfar.c-1652-\t\t\t\tinterface);\n--\ndrivers/net/ethernet/freescale/ucc_geth.c=3167=static int ucc_geth_open(struct net_device *dev)\n--\ndrivers/net/ethernet/freescale/ucc_geth.c-3180-\ndrivers/net/ethernet/freescale/ucc_geth.c:3181:\terr = phylink_of_phy_connect(ugeth-\u003ephylink, ugeth-\u003edev-\u003eof_node, 0);\ndrivers/net/ethernet/freescale/ucc_geth.c-3182-\tif (err) {\n--\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c=196=static void hbg_phy_disconnect(void *data)\n--\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c-200-\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c:201:static int hbg_phy_connect(struct hbg_priv *priv)\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c-202-{\n--\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c-206-\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c:207:\tret = phy_connect_direct(priv-\u003enetdev, phydev, hbg_phy_adjust_link,\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c-208-\t\t\t\t PHY_INTERFACE_MODE_SGMII);\n--\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c=238=static int hbg_fixed_phy_init(struct hbg_priv *priv)\n--\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c-262-\tpriv-\u003emac.phydev = phydev;\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c:263:\treturn hbg_phy_connect(priv);\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c-264-}\n--\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c=266=int hbg_mdio_init(struct hbg_priv *priv)\n--\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c-302-\thbg_mdio_init_hw(priv);\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c:303:\treturn hbg_phy_connect(priv);\ndrivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c-304-}\n--\ndrivers/net/ethernet/hisilicon/hip04_eth.c=898=static int hip04_mac_probe(struct platform_device *pdev)\n--\ndrivers/net/ethernet/hisilicon/hip04_eth.c-980-\tif (priv-\u003ephy_node) {\ndrivers/net/ethernet/hisilicon/hip04_eth.c:981:\t\tpriv-\u003ephy = of_phy_connect(ndev, priv-\u003ephy_node,\ndrivers/net/ethernet/hisilicon/hip04_eth.c-982-\t\t\t\t\t   \u0026hip04_adjust_link,\n--\ndrivers/net/ethernet/hisilicon/hix5hd2_gmac.c=826=static int hix5hd2_net_open(struct net_device *dev)\n--\ndrivers/net/ethernet/hisilicon/hix5hd2_gmac.c-844-\ndrivers/net/ethernet/hisilicon/hix5hd2_gmac.c:845:\tphy = of_phy_connect(dev, priv-\u003ephy_node,\ndrivers/net/ethernet/hisilicon/hix5hd2_gmac.c-846-\t\t\t     \u0026hix5hd2_adjust_link, 0, priv-\u003ephy_mode);\n--\ndrivers/net/ethernet/hisilicon/hns/hns_enet.c=1159=int hns_nic_init_phy(struct net_device *ndev, struct hnae_handle *h)\n--\ndrivers/net/ethernet/hisilicon/hns/hns_enet.c-1177-\ndrivers/net/ethernet/hisilicon/hns/hns_enet.c:1178:\t\tret = phy_connect_direct(ndev, phy_dev, hns_nic_adjust_link,\ndrivers/net/ethernet/hisilicon/hns/hns_enet.c-1179-\t\t\t\t\t h-\u003ephy_if);\n--\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c=202=int hclge_mac_connect_phy(struct hnae3_handle *handle)\n--\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c-217-\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c:218:\tret = phy_connect_direct(netdev, phydev,\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c-219-\t\t\t\t hclge_mac_adjust_link,\n--\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c-221-\tif (ret) {\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c:222:\t\tnetdev_err(netdev, \"phy_connect_direct err.\\n\");\ndrivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c-223-\t\treturn ret;\n--\ndrivers/net/ethernet/ibm/emac/core.c=2560=static int emac_dt_mdio_probe(struct emac_instance *dev)\n--\ndrivers/net/ethernet/ibm/emac/core.c-2595-\ndrivers/net/ethernet/ibm/emac/core.c:2596:static int emac_dt_phy_connect(struct emac_instance *dev,\ndrivers/net/ethernet/ibm/emac/core.c-2597-\t\t\t       struct device_node *phy_handle)\n--\ndrivers/net/ethernet/ibm/emac/core.c-2605-\ndrivers/net/ethernet/ibm/emac/core.c:2606:\tphy_dev = of_phy_connect(dev-\u003endev, phy_handle, \u0026emac_adjust_link, 0,\ndrivers/net/ethernet/ibm/emac/core.c-2607-\t\t\t\t dev-\u003ephy_mode);\n--\ndrivers/net/ethernet/ibm/emac/core.c=2624=static int emac_dt_phy_probe(struct emac_instance *dev)\n--\ndrivers/net/ethernet/ibm/emac/core.c-2634-\t\tif (!res) {\ndrivers/net/ethernet/ibm/emac/core.c:2635:\t\t\tres = emac_dt_phy_connect(dev, phy_handle);\ndrivers/net/ethernet/ibm/emac/core.c-2636-\t\t}\n--\ndrivers/net/ethernet/lantiq_etop.c=357=ltq_etop_mdio_probe(struct net_device *dev)\n--\ndrivers/net/ethernet/lantiq_etop.c-368-\ndrivers/net/ethernet/lantiq_etop.c:369:\tphydev = phy_connect(dev, phydev_name(phydev),\ndrivers/net/ethernet/lantiq_etop.c-370-\t\t\t     \u0026ltq_etop_mdio_link, priv-\u003epldata-\u003emii_mode);\n--\ndrivers/net/ethernet/marvell/mv643xx_eth.c=2980=static struct phy_device *phy_scan(struct mv643xx_eth_private *mp,\n--\ndrivers/net/ethernet/marvell/mv643xx_eth.c-3004-\ndrivers/net/ethernet/marvell/mv643xx_eth.c:3005:\t\tphydev = phy_connect(mp-\u003edev, phy_id, mv643xx_eth_adjust_link,\ndrivers/net/ethernet/marvell/mv643xx_eth.c-3006-\t\t\t\t     get_phy_mode(mp));\n--\ndrivers/net/ethernet/marvell/mv643xx_eth.c=3083=static int mv643xx_eth_probe(struct platform_device *pdev)\n--\ndrivers/net/ethernet/marvell/mv643xx_eth.c-3175-\tif (pd-\u003ephy_node) {\ndrivers/net/ethernet/marvell/mv643xx_eth.c:3176:\t\tphydev = of_phy_connect(mp-\u003edev, pd-\u003ephy_node,\ndrivers/net/ethernet/marvell/mv643xx_eth.c-3177-\t\t\t\t\tmv643xx_eth_adjust_link, 0,\n--\ndrivers/net/ethernet/marvell/mvneta.c=4351=static int mvneta_mdio_probe(struct mvneta_port *pp)\n--\ndrivers/net/ethernet/marvell/mvneta.c-4353-\tstruct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };\ndrivers/net/ethernet/marvell/mvneta.c:4354:\tint err = phylink_of_phy_connect(pp-\u003ephylink, pp-\u003edn, 0);\ndrivers/net/ethernet/marvell/mvneta.c-4355-\n--\ndrivers/net/ethernet/marvell/mvpp2/mvpp2_main.c=4791=static int mvpp2_open(struct net_device *dev)\n--\ndrivers/net/ethernet/marvell/mvpp2/mvpp2_main.c-4840-\tif (port-\u003ephylink) {\ndrivers/net/ethernet/marvell/mvpp2/mvpp2_main.c:4841:\t\terr = phylink_fwnode_phy_connect(port-\u003ephylink, port-\u003efwnode, 0);\ndrivers/net/ethernet/marvell/mvpp2/mvpp2_main.c-4842-\t\tif (err) {\n--\ndrivers/net/ethernet/marvell/pxa168_eth.c=958=static int pxa168_init_phy(struct net_device *dev)\n--\ndrivers/net/ethernet/marvell/pxa168_eth.c-971-\ndrivers/net/ethernet/marvell/pxa168_eth.c:972:\terr = phy_connect_direct(dev, phy, pxa168_eth_adjust_link,\ndrivers/net/ethernet/marvell/pxa168_eth.c-973-\t\t\t\t pep-\u003ephy_intf);\n--\ndrivers/net/ethernet/mediatek/mtk_eth_soc.c=3603=static int mtk_open(struct net_device *dev)\n--\ndrivers/net/ethernet/mediatek/mtk_eth_soc.c-3611-\ndrivers/net/ethernet/mediatek/mtk_eth_soc.c:3612:\terr = phylink_of_phy_connect(mac-\u003ephylink, mac-\u003eof_node, 0);\ndrivers/net/ethernet/mediatek/mtk_eth_soc.c-3613-\tif (err) {\n--\ndrivers/net/ethernet/mediatek/mtk_star_emac.c=959=static int mtk_star_enable(struct net_device *ndev)\n--\ndrivers/net/ethernet/mediatek/mtk_star_emac.c-1012-\t/* Connect to and start PHY */\ndrivers/net/ethernet/mediatek/mtk_star_emac.c:1013:\tpriv-\u003ephydev = of_phy_connect(ndev, priv-\u003ephy_node,\ndrivers/net/ethernet/mediatek/mtk_star_emac.c-1014-\t\t\t\t      mtk_star_adjust_link, 0, priv-\u003ephy_intf);\n--\ndrivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c=385=static int mlxbf_gige_probe(struct platform_device *pdev)\n--\ndrivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c-476-\ndrivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c:477:\terr = phy_connect_direct(netdev, phydev,\ndrivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c-478-\t\t\t\t mlxbf_gige_link_cfgs[priv-\u003ehw_version].adjust_link,\n--\ndrivers/net/ethernet/microchip/lan743x_main.c=3233=static int lan743x_phylink_connect(struct lan743x_adapter *adapter)\n--\ndrivers/net/ethernet/microchip/lan743x_main.c-3240-\tif (dn)\ndrivers/net/ethernet/microchip/lan743x_main.c:3241:\t\tret = phylink_of_phy_connect(adapter-\u003ephylink, dn, 0);\ndrivers/net/ethernet/microchip/lan743x_main.c-3242-\n--\ndrivers/net/ethernet/microchip/lan966x/lan966x_main.c=169=static int lan966x_port_open(struct net_device *dev)\n--\ndrivers/net/ethernet/microchip/lan966x/lan966x_main.c-185-\ndrivers/net/ethernet/microchip/lan966x/lan966x_main.c:186:\terr = phylink_fwnode_phy_connect(port-\u003ephylink, port-\u003efwnode, 0);\ndrivers/net/ethernet/microchip/lan966x/lan966x_main.c-187-\tif (err) {\n--\ndrivers/net/ethernet/microchip/sparx5/sparx5_netdev.c=105=static int sparx5_port_open(struct net_device *ndev)\n\n"
}

44/2 2026/09/14 23:09 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 35911
							output: 28
							thoughts: 0
						

45/2 2026/09/14 23:09 tool grepper
0m Args:
{
  "Expression": "phy_connect",
  "PathPrefix": "drivers/net/usb"
}

Results:
{
  "Output": "drivers/net/usb/ax88172a.c=261=static int ax88172a_reset(struct usbnet *dev)\n--\ndrivers/net/usb/ax88172a.c-313-\ndrivers/net/usb/ax88172a.c:314:\tpriv-\u003ephydev = phy_connect(dev-\u003enet, priv-\u003ephy_name,\ndrivers/net/usb/ax88172a.c-315-\t\t\t\t   \u0026ax88172a_adjust_link,\n--\ndrivers/net/usb/smsc95xx.c=1147=static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)\n--\ndrivers/net/usb/smsc95xx.c-1284-\ndrivers/net/usb/smsc95xx.c:1285:\tret = phy_connect_direct(dev-\u003enet, pdata-\u003ephydev,\ndrivers/net/usb/smsc95xx.c-1286-\t\t\t\t \u0026smsc95xx_handle_link_change,\n"
}

46/2 2026/09/14 23:09 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 36231
							output: 34
							thoughts: 0
						

47/2 2026/09/14 23:09 tool grepper
0m Args:
{
  "Expression": "CONFIG_USB_NET_SMSC95XX",
  "PathPrefix": "drivers/net"
}

Results:
{
  "Output": "drivers/net/usb/Makefile=21=obj-$(CONFIG_USB_NET_SMSC75XX)\t+= smsc75xx.o\ndrivers/net/usb/Makefile:22:obj-$(CONFIG_USB_NET_SMSC95XX)\t+= smsc95xx.o\ndrivers/net/usb/Makefile-23-obj-$(CONFIG_USB_NET_GL620A)\t+= gl620a.o\n"
}

48/2 2026/09/14 23:09 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 36385
							output: 33
							thoughts: 0
						

49/2 2026/09/14 23:09 tool grepper
0m Args:
{
  "Expression": "config USB_NET_SMSC95XX",
  "PathPrefix": "drivers/net"
}

Results:
{
  "Output": "drivers/net/usb/Kconfig=341=config USB_NET_SMSC75XX\n--\ndrivers/net/usb/Kconfig-350-\ndrivers/net/usb/Kconfig:351:config USB_NET_SMSC95XX\ndrivers/net/usb/Kconfig-352-\ttristate \"SMSC LAN95XX based USB 2.0 10/100 ethernet devices\"\n"
}

50/2 2026/09/14 23:09 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 36535
							output: 36
							thoughts: 0
						

51/2 2026/09/14 23:09 tool read-file
0m Args:
{
  "File": "drivers/net/usb/Kconfig",
  "FirstLine": 350,
  "LineCount": 20
}

Results:
{
  "Contents": " 350:\t\n 351:\tconfig USB_NET_SMSC95XX\n 352:\t\ttristate \"SMSC LAN95XX based USB 2.0 10/100 ethernet devices\"\n 353:\t\tdepends on USB_USBNET\n 354:\t\tselect PHYLIB\n 355:\t\tselect SMSC_PHY\n 356:\t\tselect BITREVERSE\n 357:\t\tselect CRC16\n 358:\t\tselect CRC32\n 359:\t\timply NET_SELFTESTS\n 360:\t\thelp\n 361:\t\t  This option adds support for SMSC LAN95XX based USB 2.0\n 362:\t\t  10/100 Ethernet adapters.\n 363:\t\n 364:\tconfig USB_NET_GL620A\n 365:\t\ttristate \"GeneSys GL620USB-A based cables\"\n 366:\t\tdepends on USB_USBNET\n 367:\t\thelp\n 368:\t\t  Choose this option if you're using a host-to-host cable,\n 369:\t\t  or PC2PC motherboard, with this chip.\n"
}

52/2 2026/09/14 23:09 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 36885
							output: 36
							thoughts: 0
						

53/2 2026/09/14 23:09 tool read-file
0m Args:
{
  "File": "drivers/net/usb/Kconfig",
  "FirstLine": 145,
  "LineCount": 20
}

Results:
{
  "Contents": " 145:\t\t    \"Laplink\" parallel cables or some motherboards.  These rely\n 146:\t\t    on specialized chips from many suppliers.\n 147:\t\n 148:\t\t  - An intelligent USB gadget, perhaps embedding a Linux system.\n 149:\t\t    These include PDAs running Linux (iPaq, Yopy, Zaurus, and\n 150:\t\t    others), and devices that interoperate using the standard\n 151:\t\t    CDC-Ethernet specification (including many cable modems).\n 152:\t\n 153:\t\t  - Network adapter hardware (like those for 10/100 Ethernet) which\n 154:\t\t    uses this driver framework.\n 155:\t\n 156:\t\t  The link will appear with a name like \"usb0\", when the link is\n 157:\t\t  a two-node link, or \"eth0\" for most CDC-Ethernet devices.  Those\n 158:\t\t  two-node links are most easily managed with Ethernet Bridging\n 159:\t\t  (CONFIG_BRIDGE) instead of routing.\n 160:\t\n 161:\t\t  For more information see \u003chttp://www.linux-usb.org/usbnet/\u003e.\n 162:\t\n 163:\t\t  To compile this driver as a module, choose M here: the\n 164:\t\t  module will be called usbnet.\n"
}

54/2 2026/09/14 23:09 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 37282
							output: 35
							thoughts: 0
						

55/2 2026/09/14 23:09 tool grepper
0m Error:
no matches

Args:
{
  "Expression": "config USB_NET_AX88172A",
  "PathPrefix": "drivers/net"
}

Results:
{
  "error": "no matches"
}

56/2 2026/09/14 23:09 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 37331
							output: 34
							thoughts: 0
						

57/2 2026/09/14 23:09 tool grepper
0m Args:
{
  "Expression": "ax88172a",
  "PathPrefix": "drivers/net/usb/Makefile"
}

Results:
{
  "Output": "drivers/net/usb/Makefile=13=obj-$(CONFIG_USB_NET_AX8817X)\t+= asix.o\ndrivers/net/usb/Makefile:14:asix-y := asix_devices.o asix_common.o ax88172a.o\ndrivers/net/usb/Makefile-15-obj-$(CONFIG_USB_NET_AX88179_178A)      += ax88179_178a.o\n"
}

58/2 2026/09/14 23:09 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 37497
							output: 34
							thoughts: 0
						

59/2 2026/09/14 23:09 tool grepper
0m Args:
{
  "Expression": "config USB_NET_AX8817X",
  "PathPrefix": "drivers/net"
}

Results:
{
  "Output": "drivers/net/usb/Kconfig=132=config USB_USBNET\n--\ndrivers/net/usb/Kconfig-165-\ndrivers/net/usb/Kconfig:166:config USB_NET_AX8817X\ndrivers/net/usb/Kconfig-167-\ttristate \"ASIX AX88xxx Based USB 2.0 Ethernet Adapters\"\n"
}

60/2 2026/09/14 23:09 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 37639
							output: 231
							thoughts: 0
						

61/2 2026/09/14 23:09 tool set-results
0m Args:
{
  "EnableConfigs": [
    "PHYLIB",
    "USB_NET_DRIVERS",
    "USB_USBNET",
    "USB_NET_AX8817X",
    "USB_NET_SMSC95XX"
  ],
  "FocusSymbols": [
    "phy_attach_direct",
    "phy_connect_direct",
    "phy_connect",
    "phy_probe",
    "phy_remove"
  ],
  "Reasoning": "The patch adds a defensive check in phy_attach_direct() returning -EBUSY when the device has a driver bound (or in progress) but phydev-\u003edrv is NULL (e.g. during bind/unbind transitions), preventing potential NULL pointer dereferences later in the function. The PHY subsystem is reachable in standard virtualized fuzzing environments via emulated USB Ethernet drivers such as smsc95xx or ax88172a (asix) as well as sysfs bind/unbind and device operations. Hence, the changes touch reachable executable code and warrant fuzzing.",
  "WorthFuzzing": true
}

Results:
{
  "EnableConfigs": [
    "PHYLIB",
    "USB_NET_DRIVERS",
    "USB_USBNET",
    "USB_NET_AX8817X",
    "USB_NET_SMSC95XX"
  ],
  "FocusSymbols": [
    "phy_attach_direct",
    "phy_connect_direct",
    "phy_connect",
    "phy_probe",
    "phy_remove"
  ],
  "Reasoning": "The patch adds a defensive check in phy_attach_direct() returning -EBUSY when the device has a driver bound (or in progress) but phydev-\u003edrv is NULL (e.g. during bind/unbind transitions), preventing potential NULL pointer dereferences later in the function. The PHY subsystem is reachable in standard virtualized fuzzing environments via emulated USB Ethernet drivers such as smsc95xx or ax88172a (asix) as well as sysfs bind/unbind and device operations. Hence, the changes touch reachable executable code and warrant fuzzing.",
  "WorthFuzzing": true
}

62/1 2026/09/14 23:09 action If
0m Args:
{
  "WorthFuzzing": true
}

Results:
null

63/2 2026/09/14 23:09 agent kmsan-evaluator
0m Model:
core

Args:
null

Results:
{
  "KMSANReasoning": "The patch adds a validation check `else if (!phydev-\u003edrv)` in `phy_attach_direct()` to prevent attaching to a PHY device whose underlying device driver (`d-\u003edriver`) is set but whose PHY driver pointer (`phydev-\u003edrv`) is NULL (which occurs during transient bind or unbind operations). Without this check, callers could attach to a PHY in an incomplete state and subsequently trigger NULL pointer dereferences when invoking driver callbacks via `phydev-\u003edrv`.\n\nThis change is purely control-flow and state-validation logic addressing race conditions and potential NULL pointer dereferences. It does not introduce, modify, or read any uninitialized stack or heap memory, nor does it affect buffers copied to user space. Therefore, KMSAN is not applicable, and standard bug detectors and KASAN are sufficient.",
  "NeedsKMSAN": false
}

Instruction:
You are an expert Linux kernel security engineer specializing in kernel memory
error detectors (KASAN and KMSAN). Your job is to review the provided patch series and
determine if the code changes justify spawning a dedicated KMSAN (KernelMemorySanitizer)
fuzzing session in addition to standard KASAN fuzzing.

CRITICAL DISTINCTION BETWEEN KASAN AND KMSAN:
- Standard KASAN kernel builds (upstream-apparmor-kasan.config) already enable
  a comprehensive suite of debugging tools and sanitizers, including KASAN
  (out-of-bounds accesses, use-after-free, double free, invalid free), LOCKDEP
  (locking bugs and deadlocks), UB-sanitizers, and memory corruption checks.
- KMSAN (KernelMemorySanitizer) detects reads of UNINITIALIZED memory (stack, heap,
  or page allocations) and kernel-to-user memory info-leaks.

Rule: THERE IS NO SENSE IN RUNNING A KMSAN SESSION IF A BUG CAN BE CAUGHT BY KASAN,
LOCKDEP, OR OTHER STANDARD BUG DETECTORS.
A dedicated KMSAN fuzzing session incurs significant resource costs. You must ONLY
set NeedsKMSAN=true if the code changes introduce or expose UNINITIALIZED MEMORY risks
that are detected ONLY by KMSAN.

Look holistically at the patch series and surrounding code. Even if no direct
uninitialized field accesses or new buffer allocations are added in the diff itself,
a patch may alter control flow, bounds checking, or data length calculations in ways
that change how the rest of the code operates on existing buffers (e.g. allowing
uninitialized stack/heap memory to be read, copied to user space, or used in control
flow). Do not hesitate to use your code access tools to inspect the surrounding code,
called functions, and callers.

Set NeedsKMSAN=true ONLY IF the patch introduces or modifies:
1. Kernel structures sent to user space (via copy_to_user, put_user, netlink skb
   attributes, ioctl output arguments, socket options, or BPF buffers) where fields
   or structure padding might not be fully initialized/zeroed.
2. Conditional logic or branching that depends on potentially uninitialized variables
   or struct fields.
3. Allocation or initialization of complex data structures where uninitialized fields
   could be read later in reachable code paths.
4. Bounds checks, lengths, or logic in a way that allows surrounding code to access
   uninitialized bytes of existing buffers.

Set NeedsKMSAN=false IF:
- The code changes primarily risk out-of-bounds access, array overflows, NULL pointer
  dereferences, locking deadlocks, or use-after-free bugs (these are already caught
  by KASAN, LOCKDEP, or standard bug detectors).
- All stack/heap structures touched or introduced by the patch are fully zeroed
  or initialized (e.g. using = {0}, memset, kzalloc) before being read or copied.
- The patch does not introduce any risk of uninitialized memory usage or info-leaks.

Use your code access tools to inspect the surrounding code if necessary, then provide
detailed KMSANReasoning contrasting KASAN vs KMSAN applicability for this patch.
Prefer calling several tools at the same time to save round-trips.


Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.

Prompt:
Target architecture: amd64

For your convenience, here is the diff of the changes:
commit 0ca6eb7183eedad1bd175ed3055e7e6f810559cb
Author: syz-cluster <triage@syzkaller.com>
Date:   Mon Sep 14 23:06:27 2026 +0000

    syz-cluster: applied patch under review

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 94b2e85e00a37..044cefd9840bb 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1781,6 +1781,10 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
 			d->driver = &genphy_driver.mdiodrv.driver;
 
 		phydev->is_genphy_driven = 1;
+	} else if (!phydev->drv) {
+		/* d->driver outlives phydev->drv on unbind, precedes it on bind */
+		err = -EBUSY;
+		goto error_put_device;
 	}
 
 	if (!try_module_get(d->driver->owner)) {

64/3 2026/09/14 23:09 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 2120
							output: 40
							thoughts: 86
						

Thoughts:
**KMSAN Fuzzing Evaluation - drivers/net/phy/phy_device.c**

Okay, so I need to decide if this patch in `drivers/net/phy/phy_device.c` warrants KMSAN fuzzing. Let's dig in. First things first, I'll examine the diff itself. I'll need to understand what's been changed, what the modifications are doing. Then, I need to zoom out a bit and look at the surrounding code in `drivers/net/phy/phy_device.c` – a little context is always crucial.

Specifically, I think I will focus on the code around line 1781. I'll grab that section with a `read-file` command. This will allow me to assess the data structures, function calls, and potential memory access patterns involved in the changes. From there, I can determine if there are any obvious areas of concern, such as potential use-after-free conditions, uninitialized memory reads, or other memory safety vulnerabilities that would benefit from fuzzing with KMSAN.



65/3 2026/09/14 23:10 tool read-file
0m Args:
{
  "File": "drivers/net/phy/phy_device.c",
  "FirstLine": 1760,
  "LineCount": 60
}

Results:
{
  "Contents": "1760:\t\t/* For Ethernet device drivers that register their own MDIO bus, we\n1761:\t\t * will have bus-\u003eowner match ndev_mod, so we do not want to increment\n1762:\t\t * our own module-\u003erefcnt here, otherwise we would not be able to\n1763:\t\t * unload later on.\n1764:\t\t */\n1765:\t\tif (dev)\n1766:\t\t\tndev_owner = dev-\u003edev.parent-\u003edriver-\u003eowner;\n1767:\t\tif (ndev_owner != bus-\u003eowner \u0026\u0026 !try_module_get(bus-\u003eowner)) {\n1768:\t\t\tphydev_err(phydev, \"failed to get the bus module\\n\");\n1769:\t\t\treturn -EIO;\n1770:\t\t}\n1771:\t\n1772:\t\tget_device(d);\n1773:\t\n1774:\t\t/* Assume that if there is no driver, that it doesn't\n1775:\t\t * exist, and we should use the genphy driver.\n1776:\t\t */\n1777:\t\tif (!d-\u003edriver) {\n1778:\t\t\tif (phydev-\u003eis_c45)\n1779:\t\t\t\td-\u003edriver = \u0026genphy_c45_driver.mdiodrv.driver;\n1780:\t\t\telse\n1781:\t\t\t\td-\u003edriver = \u0026genphy_driver.mdiodrv.driver;\n1782:\t\n1783:\t\t\tphydev-\u003eis_genphy_driven = 1;\n1784:\t\t} else if (!phydev-\u003edrv) {\n1785:\t\t\t/* d-\u003edriver outlives phydev-\u003edrv on unbind, precedes it on bind */\n1786:\t\t\terr = -EBUSY;\n1787:\t\t\tgoto error_put_device;\n1788:\t\t}\n1789:\t\n1790:\t\tif (!try_module_get(d-\u003edriver-\u003eowner)) {\n1791:\t\t\tphydev_err(phydev, \"failed to get the device driver module\\n\");\n1792:\t\t\terr = -EIO;\n1793:\t\t\tgoto error_put_device;\n1794:\t\t}\n1795:\t\n1796:\t\tif (phydev-\u003eis_genphy_driven) {\n1797:\t\t\terr = d-\u003edriver-\u003eprobe(d);\n1798:\t\t\tif (err \u003e= 0)\n1799:\t\t\t\terr = device_bind_driver(d);\n1800:\t\n1801:\t\t\tif (err)\n1802:\t\t\t\tgoto error_module_put;\n1803:\t\t}\n1804:\t\n1805:\t\tif (phydev-\u003eattached_dev) {\n1806:\t\t\tdev_err(\u0026dev-\u003edev, \"PHY already attached\\n\");\n1807:\t\t\terr = -EBUSY;\n1808:\t\t\tgoto error;\n1809:\t\t}\n1810:\t\n1811:\t\tphydev-\u003ephy_link_change = phy_link_change;\n1812:\t\tif (dev) {\n1813:\t\t\tphydev-\u003eattached_dev = dev;\n1814:\t\t\tdev-\u003ephydev = phydev;\n1815:\t\n1816:\t\t\tif (phydev-\u003esfp_bus_attached)\n1817:\t\t\t\tdev-\u003esfp_bus = phydev-\u003esfp_bus;\n1818:\t\n1819:\t\t\terr = phy_link_topo_add_phy(dev, phydev, PHY_UPSTREAM_MAC, dev);\n"
}

66/3 2026/09/14 23:10 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 3399
							output: 30
							thoughts: 194
						

Thoughts:
**Analyzing the `phy_attach_direct` Function**

Okay, let's dive into this `phy_attach_direct` function. The first thing I need to understand is *why* this patch was even introduced. Context is king, so let's start there.

Looking at the code snippet, I see a conditional block:

```c
		if (!d->driver) {
			if (phydev->is_c45)
				d->driver = &genphy_c45_driver.mdiodrv.driver;
			else
				d->driver = &genphy_driver.mdiodrv.driver;

			phydev->is_genphy_driven = 1;
		} else if (!phydev->drv) {
			/* d->driver outlives phydev->drv on unbind, precedes it on bind */
			err = -EBUSY;
			goto error_put_device;
		}
```

My initial thought is that this section is probably handling the driver assignment for the PHY device (`phydev`). It looks like it's checking if a driver (`d->driver`) is already assigned. If not, it assigns either `genphy_c45_driver` or `genphy_driver` based on the `is_c45` flag. The second part, the `else if` condition where it checks `!phydev->drv`, seems important, especially with that comment referencing binding/unbinding scenarios. It hints at potential race conditions or synchronization issues related to driver lifetimes. The `-EBUSY` error code suggests a resource conflict of some sort.

Now, let's get a more complete picture. I need to check the Git history of `phy_device.c` or, failing that, search within the same file for all instances of `phydev->drv`. This should provide crucial insights into how this `phydev->drv` field is used, the purpose of this logic, and the context of this specific patch. Understanding this variable and its interactions with the driver is key to getting a clear picture of this code's behaviour.



67/3 2026/09/14 23:10 tool grepper
0m Args:
{
  "Expression": "phydev-\u003edrv",
  "PathPrefix": "drivers/net/phy/"
}

Results:
{
  "Output": "\nFull output is too long, showing 500 out of 829 lines.\nUse more precise expression if possible.\n\ndrivers/net/phy/aquantia/aquantia_main.c=524=static phy_interface_t aqr_translate_interface(struct phy_device *phydev,\n--\ndrivers/net/phy/aquantia/aquantia_main.c-528-\ndrivers/net/phy/aquantia/aquantia_main.c:529:\tif (phy_id_compare(phydev-\u003edrv-\u003ephy_id, PHY_ID_AQR412C, phydev-\u003edrv-\u003ephy_id_mask) \u0026\u0026\ndrivers/net/phy/aquantia/aquantia_main.c-530-\t    priv-\u003efingerprint == AQR_G3_V4_3_C_AQR_NXP_SPF_30841_MUSX_ID40019_VER1198 \u0026\u0026\n--\ndrivers/net/phy/bcm-cygnus.c=128=static int bcm_omega_config_init(struct phy_device *phydev)\n--\ndrivers/net/phy/bcm-cygnus.c-132-\ndrivers/net/phy/bcm-cygnus.c:133:\trev = phydev-\u003ephy_id \u0026 ~phydev-\u003edrv-\u003ephy_id_mask;\ndrivers/net/phy/bcm-cygnus.c-134-\ndrivers/net/phy/bcm-cygnus.c-135-\tpr_info_once(\"%s: %s PHY revision: 0x%02x\\n\",\ndrivers/net/phy/bcm-cygnus.c:136:\t\t     phydev_name(phydev), phydev-\u003edrv-\u003ename, rev);\ndrivers/net/phy/bcm-cygnus.c-137-\n--\ndrivers/net/phy/bcm54140.c=505=static int bcm54140_get_base_addr_and_port(struct phy_device *phydev)\n--\ndrivers/net/phy/bcm54140.c-555-\t\t/* see if it is still the same PHY */\ndrivers/net/phy/bcm54140.c:556:\t\tif ((phy_id \u0026 phydev-\u003edrv-\u003ephy_id_mask) !=\ndrivers/net/phy/bcm54140.c:557:\t\t    (phydev-\u003edrv-\u003ephy_id \u0026 phydev-\u003edrv-\u003ephy_id_mask)) {\ndrivers/net/phy/bcm54140.c-558-\t\t\taddr = phydev-\u003emdio.addr;\n--\ndrivers/net/phy/bcm7xxx.c=143=static int bcm7xxx_28nm_config_init(struct phy_device *phydev)\n--\ndrivers/net/phy/bcm7xxx.c-153-\tif (rev == 0)\ndrivers/net/phy/bcm7xxx.c:154:\t\trev = phydev-\u003ephy_id \u0026 ~phydev-\u003edrv-\u003ephy_id_mask;\ndrivers/net/phy/bcm7xxx.c-155-\ndrivers/net/phy/bcm7xxx.c-156-\tpr_info_once(\"%s: %s PHY revision: 0x%02x, patch: %d\\n\",\ndrivers/net/phy/bcm7xxx.c:157:\t\t     phydev_name(phydev), phydev-\u003edrv-\u003ename, rev, patch);\ndrivers/net/phy/bcm7xxx.c-158-\n--\ndrivers/net/phy/bcm7xxx.c=388=static int bcm7xxx_28nm_ephy_config_init(struct phy_device *phydev)\ndrivers/net/phy/bcm7xxx.c-389-{\ndrivers/net/phy/bcm7xxx.c:390:\tu8 rev = phydev-\u003ephy_id \u0026 ~phydev-\u003edrv-\u003ephy_id_mask;\ndrivers/net/phy/bcm7xxx.c-391-\tint ret = 0;\n--\ndrivers/net/phy/bcm7xxx.c-393-\tpr_info_once(\"%s: %s PHY revision: 0x%02x\\n\",\ndrivers/net/phy/bcm7xxx.c:394:\t\t     phydev_name(phydev), phydev-\u003edrv-\u003ename, rev);\ndrivers/net/phy/bcm7xxx.c-395-\n--\ndrivers/net/phy/broadcom.c=237=static int bcm54xx_phydsp_config(struct phy_device *phydev)\n--\ndrivers/net/phy/broadcom.c-248-\ndrivers/net/phy/broadcom.c:249:\tif (phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM50610) ||\ndrivers/net/phy/broadcom.c:250:\t    phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM50610M)) {\ndrivers/net/phy/broadcom.c-251-\t\t/* Clear bit 9 to fix a phy interop issue. */\n--\ndrivers/net/phy/broadcom.c-256-\ndrivers/net/phy/broadcom.c:257:\t\tif (phydev-\u003edrv-\u003ephy_id == PHY_ID_BCM50610) {\ndrivers/net/phy/broadcom.c-258-\t\t\terr = bcm50610_a0_workaround(phydev);\n--\ndrivers/net/phy/broadcom.c-263-\ndrivers/net/phy/broadcom.c:264:\tif (phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM57780)) {\ndrivers/net/phy/broadcom.c-265-\t\tint val;\n--\ndrivers/net/phy/broadcom.c=285=static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev)\n--\ndrivers/net/phy/broadcom.c-291-\t/* Abort if we are using an untested phy. */\ndrivers/net/phy/broadcom.c:292:\tif (!(phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM57780) ||\ndrivers/net/phy/broadcom.c:293:\t      phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM50610) ||\ndrivers/net/phy/broadcom.c:294:\t      phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM50610M) ||\ndrivers/net/phy/broadcom.c:295:\t      phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM54210E) ||\ndrivers/net/phy/broadcom.c:296:\t      phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM54810) ||\ndrivers/net/phy/broadcom.c:297:\t      phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM54811)))\ndrivers/net/phy/broadcom.c-298-\t\treturn;\n--\ndrivers/net/phy/broadcom.c-305-\ndrivers/net/phy/broadcom.c:306:\tif ((phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM50610) ||\ndrivers/net/phy/broadcom.c:307:\t     phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM50610M)) \u0026\u0026\ndrivers/net/phy/broadcom.c-308-\t    BRCM_PHY_REV(phydev) \u003e= 0x3) {\n--\ndrivers/net/phy/broadcom.c-315-\t\tif (phydev-\u003edev_flags \u0026 PHY_BRCM_RX_REFCLK_UNUSED) {\ndrivers/net/phy/broadcom.c:316:\t\t\tif (!phy_id_compare_model(phydev-\u003edrv-\u003ephy_id,\ndrivers/net/phy/broadcom.c-317-\t\t\t\t\t\t  PHY_ID_BCM54811)) {\n--\ndrivers/net/phy/broadcom.c-330-\tif (phydev-\u003edev_flags \u0026 PHY_BRCM_DIS_TXCRXC_NOENRGY) {\ndrivers/net/phy/broadcom.c:331:\t\tif (phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM54210E) ||\ndrivers/net/phy/broadcom.c:332:\t\t    phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM54810) ||\ndrivers/net/phy/broadcom.c:333:\t\t    phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM54811))\ndrivers/net/phy/broadcom.c-334-\t\t\tval |= BCM54XX_SHD_SCR3_RXCTXC_DIS;\n--\ndrivers/net/phy/broadcom.c=458=static int bcm54xx_config_init(struct phy_device *phydev)\n--\ndrivers/net/phy/broadcom.c-479-\ndrivers/net/phy/broadcom.c:480:\tif ((phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM50610) ||\ndrivers/net/phy/broadcom.c:481:\t     phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM50610M)) \u0026\u0026\ndrivers/net/phy/broadcom.c-482-\t    (phydev-\u003edev_flags \u0026 PHY_BRCM_CLEAR_RGMII_MODE))\n--\ndrivers/net/phy/broadcom.c-486-\ndrivers/net/phy/broadcom.c:487:\tswitch (phydev-\u003edrv-\u003ephy_id \u0026 PHY_ID_MATCH_MODEL_MASK) {\ndrivers/net/phy/broadcom.c-488-\tcase PHY_ID_BCM50610:\n--\ndrivers/net/phy/broadcom.c=687=static int bcm5481x_read_abilities(struct phy_device *phydev)\n--\ndrivers/net/phy/broadcom.c-716-\t\t */\ndrivers/net/phy/broadcom.c:717:\t\tif (phy_id_compare_model(phydev-\u003edrv-\u003ephy_id, PHY_ID_BCM54811))\ndrivers/net/phy/broadcom.c-718-\t\t\taneg = 0;\n--\ndrivers/net/phy/broadcom.c=877=static int brcm_fet_config_init(struct phy_device *phydev)\n--\ndrivers/net/phy/broadcom.c-911-\t/* Unmask events we are interested in and mask interrupts globally. */\ndrivers/net/phy/broadcom.c:912:\tif (phydev-\u003edrv-\u003ephy_id == PHY_ID_BCM5221)\ndrivers/net/phy/broadcom.c-913-\t\treg = MII_BRCM_FET_IR_ENABLE |\n--\ndrivers/net/phy/broadcom.c-940-\ndrivers/net/phy/broadcom.c:941:\tif (phydev-\u003edrv-\u003ephy_id != PHY_ID_BCM5221) {\ndrivers/net/phy/broadcom.c-942-\t\t/* Set the LED mode */\n--\ndrivers/net/phy/broadcom.c=1036=static int brcm_fet_suspend(struct phy_device *phydev)\n--\ndrivers/net/phy/broadcom.c-1061-\ndrivers/net/phy/broadcom.c:1062:\tif (phydev-\u003edrv-\u003ephy_id == PHY_ID_BCM5221)\ndrivers/net/phy/broadcom.c-1063-\t\t/* Force Low Power Mode with clock enabled */\n--\ndrivers/net/phy/cortina.c=46=static int cortina_probe(struct phy_device *phydev)\n--\ndrivers/net/phy/cortina.c-66-\t */\ndrivers/net/phy/cortina.c:67:\tif (phy_id != phydev-\u003edrv-\u003ephy_id) {\ndrivers/net/phy/cortina.c-68-\t\tphydev_err(phydev, \"Error matching phy with %s driver\\n\",\ndrivers/net/phy/cortina.c:69:\t\t\t   phydev-\u003edrv-\u003ename);\ndrivers/net/phy/cortina.c-70-\t\treturn -ENODEV;\n--\ndrivers/net/phy/dp83822.c=732=static int dp83822_phy_reset(struct phy_device *phydev)\n--\ndrivers/net/phy/dp83822.c-739-\ndrivers/net/phy/dp83822.c:740:\treturn phydev-\u003edrv-\u003econfig_init(phydev);\ndrivers/net/phy/dp83822.c-741-}\n--\ndrivers/net/phy/marvell-88q2xxx.c=473=static int mv88q2xxx_config_aneg(struct phy_device *phydev)\n--\ndrivers/net/phy/marvell-88q2xxx.c-480-\ndrivers/net/phy/marvell-88q2xxx.c:481:\treturn phydev-\u003edrv-\u003esoft_reset(phydev);\ndrivers/net/phy/marvell-88q2xxx.c-482-}\n--\ndrivers/net/phy/marvell.c=2873=to_marvell_hwmon_ops(const struct phy_device *phydev)\ndrivers/net/phy/marvell.c-2874-{\ndrivers/net/phy/marvell.c:2875:\treturn phydev-\u003edrv-\u003edriver_data;\ndrivers/net/phy/marvell.c-2876-}\n--\ndrivers/net/phy/marvell10g.c=176=static const struct mv3310_chip *to_mv3310_chip(struct phy_device *phydev)\ndrivers/net/phy/marvell10g.c-177-{\ndrivers/net/phy/marvell10g.c:178:\treturn phydev-\u003edrv-\u003edriver_data;\ndrivers/net/phy/marvell10g.c-179-}\n--\ndrivers/net/phy/marvell10g.c=244=static int mv3310_hwmon_config(struct phy_device *phydev, bool enable)\n--\ndrivers/net/phy/marvell10g.c-248-\ndrivers/net/phy/marvell10g.c:249:\tif (phydev-\u003edrv-\u003ephy_id != MARVELL_PHY_ID_88X3310)\ndrivers/net/phy/marvell10g.c-250-\t\treturn 0;\n--\ndrivers/net/phy/marvell10g.c=310=static int mv3310_power_up(struct phy_device *phydev)\n--\ndrivers/net/phy/marvell10g.c-324-\ndrivers/net/phy/marvell10g.c:325:\tif (phydev-\u003edrv-\u003ephy_id != MARVELL_PHY_ID_88X3310 ||\ndrivers/net/phy/marvell10g.c-326-\t    priv-\u003efirmware_ver \u003c 0x00030000)\n--\ndrivers/net/phy/mediatek/mtk-2p5ge.c=323=static int mt798x_2p5ge_phy_probe(struct phy_device *phydev)\n--\ndrivers/net/phy/mediatek/mtk-2p5ge.c-328-\ndrivers/net/phy/mediatek/mtk-2p5ge.c:329:\tswitch (phydev-\u003edrv-\u003ephy_id) {\ndrivers/net/phy/mediatek/mtk-2p5ge.c-330-\tcase MTK_2P5GPHY_ID_MT7988:\n--\ndrivers/net/phy/mediatek/mtk-ge-soc.c=476=static int tx_amp_fill_result(struct phy_device *phydev, u16 *buf)\n--\ndrivers/net/phy/mediatek/mtk-ge-soc.c-488-\ndrivers/net/phy/mediatek/mtk-ge-soc.c:489:\tswitch (phydev-\u003edrv-\u003ephy_id) {\ndrivers/net/phy/mediatek/mtk-ge-soc.c-490-\tcase MTK_GPHY_ID_MT7981:\n--\ndrivers/net/phy/mediatek/mtk-ge-soc.c=594=static int tx_r50_fill_result(struct phy_device *phydev, u16 tx_r50_cal_val,\n--\ndrivers/net/phy/mediatek/mtk-ge-soc.c-599-\ndrivers/net/phy/mediatek/mtk-ge-soc.c:600:\tif (phydev-\u003edrv-\u003ephy_id == MTK_GPHY_ID_MT7988)\ndrivers/net/phy/mediatek/mtk-ge-soc.c-601-\t\tbias = -1;\n--\ndrivers/net/phy/mediatek/mtk-ge-soc.c=1210=static int mt798x_phy_config_init(struct phy_device *phydev)\ndrivers/net/phy/mediatek/mtk-ge-soc.c-1211-{\ndrivers/net/phy/mediatek/mtk-ge-soc.c:1212:\tswitch (phydev-\u003edrv-\u003ephy_id) {\ndrivers/net/phy/mediatek/mtk-ge-soc.c-1213-\tcase MTK_GPHY_ID_MT7981:\n--\ndrivers/net/phy/mediatek/mtk-phy-lib.c=335=void mtk_phy_leds_state_init(struct phy_device *phydev)\n--\ndrivers/net/phy/mediatek/mtk-phy-lib.c-339-\tfor (i = 0; i \u003c 2; ++i)\ndrivers/net/phy/mediatek/mtk-phy-lib.c:340:\t\tphydev-\u003edrv-\u003eled_hw_control_get(phydev, i, NULL);\ndrivers/net/phy/mediatek/mtk-phy-lib.c-341-}\n--\ndrivers/net/phy/micrel.c=578=static int kszphy_config_intr(struct phy_device *phydev)\ndrivers/net/phy/micrel.c-579-{\ndrivers/net/phy/micrel.c:580:\tconst struct kszphy_type *type = phydev-\u003edrv-\u003edriver_data;\ndrivers/net/phy/micrel.c-581-\tint temp, err;\n--\ndrivers/net/phy/micrel.c=1510=static int ksz9131_config_rgmii_delay(struct phy_device *phydev)\ndrivers/net/phy/micrel.c-1511-{\ndrivers/net/phy/micrel.c:1512:\tconst struct kszphy_type *type = phydev-\u003edrv-\u003edriver_data;\ndrivers/net/phy/micrel.c-1513-\tu16 rxcdll_val, txcdll_val;\n--\ndrivers/net/phy/micrel.c=1788=static int ksz9031_read_status(struct phy_device *phydev)\n--\ndrivers/net/phy/micrel.c-1803-\t\tphydev-\u003elink = 0;\ndrivers/net/phy/micrel.c:1804:\t\tif (phydev-\u003edrv-\u003econfig_intr \u0026\u0026 phy_interrupt_is_valid(phydev))\ndrivers/net/phy/micrel.c:1805:\t\t\tphydev-\u003edrv-\u003econfig_intr(phydev);\ndrivers/net/phy/micrel.c-1806-\t\treturn genphy_config_aneg(phydev);\n--\ndrivers/net/phy/micrel.c=2604=static int kszphy_suspend(struct phy_device *phydev)\n--\ndrivers/net/phy/micrel.c-2608-\t\tphydev-\u003einterrupts = PHY_INTERRUPT_DISABLED;\ndrivers/net/phy/micrel.c:2609:\t\tif (phydev-\u003edrv-\u003econfig_intr)\ndrivers/net/phy/micrel.c:2610:\t\t\tphydev-\u003edrv-\u003econfig_intr(phydev);\ndrivers/net/phy/micrel.c-2611-\t}\n--\ndrivers/net/phy/micrel.c=2616=static void kszphy_parse_led_mode(struct phy_device *phydev)\ndrivers/net/phy/micrel.c-2617-{\ndrivers/net/phy/micrel.c:2618:\tconst struct kszphy_type *type = phydev-\u003edrv-\u003edriver_data;\ndrivers/net/phy/micrel.c-2619-\tconst struct device_node *np = phydev-\u003emdio.dev.of_node;\n--\ndrivers/net/phy/micrel.c=2640=static int kszphy_resume(struct phy_device *phydev)\n--\ndrivers/net/phy/micrel.c-2660-\t\tphydev-\u003einterrupts = PHY_INTERRUPT_ENABLED;\ndrivers/net/phy/micrel.c:2661:\t\tif (phydev-\u003edrv-\u003econfig_intr)\ndrivers/net/phy/micrel.c:2662:\t\t\tphydev-\u003edrv-\u003econfig_intr(phydev);\ndrivers/net/phy/micrel.c-2663-\t}\n--\ndrivers/net/phy/micrel.c=2686=static int ksz9477_resume(struct phy_device *phydev)\n--\ndrivers/net/phy/micrel.c-2714-\t\tphydev-\u003einterrupts = PHY_INTERRUPT_ENABLED;\ndrivers/net/phy/micrel.c:2715:\t\tif (phydev-\u003edrv-\u003econfig_intr)\ndrivers/net/phy/micrel.c:2716:\t\t\tphydev-\u003edrv-\u003econfig_intr(phydev);\ndrivers/net/phy/micrel.c-2717-\t}\n--\ndrivers/net/phy/micrel.c=2722=static int ksz8061_resume(struct phy_device *phydev)\n--\ndrivers/net/phy/micrel.c-2746-\t\tphydev-\u003einterrupts = PHY_INTERRUPT_ENABLED;\ndrivers/net/phy/micrel.c:2747:\t\tif (phydev-\u003edrv-\u003econfig_intr)\ndrivers/net/phy/micrel.c:2748:\t\t\tphydev-\u003edrv-\u003econfig_intr(phydev);\ndrivers/net/phy/micrel.c-2749-\t}\n--\ndrivers/net/phy/micrel.c=2759=static int kszphy_probe(struct phy_device *phydev)\ndrivers/net/phy/micrel.c-2760-{\ndrivers/net/phy/micrel.c:2761:\tconst struct kszphy_type *type = phydev-\u003edrv-\u003edriver_data;\ndrivers/net/phy/micrel.c-2762-\tconst struct device_node *np = phydev-\u003emdio.dev.of_node;\n--\ndrivers/net/phy/micrel.c=2902=static int ksz886x_cable_test_wait_for_completion(struct phy_device *phydev)\ndrivers/net/phy/micrel.c-2903-{\ndrivers/net/phy/micrel.c:2904:\tconst struct kszphy_type *type = phydev-\u003edrv-\u003edriver_data;\ndrivers/net/phy/micrel.c-2905-\tint val, ret;\n--\ndrivers/net/phy/micrel.c=3021=static int ksz886x_cable_test_get_status(struct phy_device *phydev,\n--\ndrivers/net/phy/micrel.c-3023-{\ndrivers/net/phy/micrel.c:3024:\tconst struct kszphy_type *type = phydev-\u003edrv-\u003edriver_data;\ndrivers/net/phy/micrel.c-3025-\tunsigned long pair_mask = type-\u003epair_mask;\n--\ndrivers/net/phy/micrel.c=4562=static int __lan8814_ptp_probe_once(struct phy_device *phydev, char *pin_name,\n--\ndrivers/net/phy/micrel.c-4589-\tshared-\u003eptp_clock_info.owner = THIS_MODULE;\ndrivers/net/phy/micrel.c:4590:\tsnprintf(shared-\u003eptp_clock_info.name, 30, \"%s\", phydev-\u003edrv-\u003ename);\ndrivers/net/phy/micrel.c-4591-\tshared-\u003eptp_clock_info.max_adj = 31249999;\n--\ndrivers/net/phy/micrel.c=4747=static int lan8814_probe(struct phy_device *phydev)\ndrivers/net/phy/micrel.c-4748-{\ndrivers/net/phy/micrel.c:4749:\tconst struct kszphy_type *type = phydev-\u003edrv-\u003edriver_data;\ndrivers/net/phy/micrel.c-4750-\tstruct kszphy_priv *priv;\n--\ndrivers/net/phy/microchip_rds_ptp.c=1242=struct mchp_rds_ptp_clock *mchp_rds_ptp_probe(struct phy_device *phydev, u8 mmd,\n--\ndrivers/net/phy/microchip_rds_ptp.c-1274-\tclock-\u003ecaps.owner          = THIS_MODULE;\ndrivers/net/phy/microchip_rds_ptp.c:1275:\tsnprintf(clock-\u003ecaps.name, 30, \"%s\", phydev-\u003edrv-\u003ename);\ndrivers/net/phy/microchip_rds_ptp.c-1276-\tclock-\u003ecaps.max_adj        = MCHP_RDS_PTP_MAX_ADJ;\n--\ndrivers/net/phy/motorcomm.c=891=static int ytphy_rgmii_clk_delay_config(struct phy_device *phydev)\n--\ndrivers/net/phy/motorcomm.c-922-\tcase PHY_INTERFACE_MODE_GMII:\ndrivers/net/phy/motorcomm.c:923:\t\tif (phydev-\u003edrv-\u003ephy_id != PHY_ID_YT8531S)\ndrivers/net/phy/motorcomm.c-924-\t\t\treturn -EOPNOTSUPP;\n--\ndrivers/net/phy/motorcomm.c=1064=static int yt8521_probe(struct phy_device *phydev)\n--\ndrivers/net/phy/motorcomm.c-1123-\ndrivers/net/phy/motorcomm.c:1124:\tif (phydev-\u003edrv-\u003ephy_id == PHY_ID_YT8521) {\ndrivers/net/phy/motorcomm.c-1125-\t\tswitch (freq) {\n--\ndrivers/net/phy/motorcomm.c-1150-\t\t}\ndrivers/net/phy/motorcomm.c:1151:\t} else if (phydev-\u003edrv-\u003ephy_id == PHY_ID_YT8531S) {\ndrivers/net/phy/motorcomm.c-1152-\t\tswitch (freq) {\n--\ndrivers/net/phy/mscc/mscc_macsec.c=953=int vsc8584_macsec_init(struct phy_device *phydev)\n--\ndrivers/net/phy/mscc/mscc_macsec.c-956-\ndrivers/net/phy/mscc/mscc_macsec.c:957:\tswitch (phydev-\u003ephy_id \u0026 phydev-\u003edrv-\u003ephy_id_mask) {\ndrivers/net/phy/mscc/mscc_macsec.c-958-\tcase PHY_ID_VSC856X:\n--\ndrivers/net/phy/mscc/mscc_main.c=1723=static int vsc8584_config_init(struct phy_device *phydev)\n--\ndrivers/net/phy/mscc/mscc_main.c-1746-\tif (phy_package_init_once(phydev)) {\ndrivers/net/phy/mscc/mscc_main.c:1747:\t\tswitch (phydev-\u003ephy_id \u0026 phydev-\u003edrv-\u003ephy_id_mask) {\ndrivers/net/phy/mscc/mscc_main.c-1748-\t\tcase PHY_ID_VSC8504:\n--\ndrivers/net/phy/mscc/mscc_main.c=1846=static int vsc85xx_config_init(struct phy_device *phydev)\n--\ndrivers/net/phy/mscc/mscc_main.c-1862-\ndrivers/net/phy/mscc/mscc_main.c:1863:\tphy_id = phydev-\u003edrv-\u003ephy_id \u0026 phydev-\u003edrv-\u003ephy_id_mask;\ndrivers/net/phy/mscc/mscc_main.c-1864-\tif (PHY_ID_VSC8531 == phy_id || PHY_ID_VSC8541 == phy_id ||\n--\ndrivers/net/phy/mscc/mscc_ptp.c=1538=int vsc8584_ptp_init(struct phy_device *phydev)\ndrivers/net/phy/mscc/mscc_ptp.c-1539-{\ndrivers/net/phy/mscc/mscc_ptp.c:1540:\tswitch (phydev-\u003ephy_id \u0026 phydev-\u003edrv-\u003ephy_id_mask) {\ndrivers/net/phy/mscc/mscc_ptp.c-1541-\tcase PHY_ID_VSC8572:\n--\ndrivers/net/phy/nxp-c45-tja11xx.c=300=struct nxp_c45_phy_data *nxp_c45_get_data(struct phy_device *phydev)\ndrivers/net/phy/nxp-c45-tja11xx.c-301-{\ndrivers/net/phy/nxp-c45-tja11xx.c:302:\treturn phydev-\u003edrv-\u003edriver_data;\ndrivers/net/phy/nxp-c45-tja11xx.c-303-}\n--\ndrivers/net/phy/nxp-tja11xx.c=211=static int tja11xx_config_aneg_cable_test(struct phy_device *phydev)\n--\ndrivers/net/phy/nxp-tja11xx.c-218-\ndrivers/net/phy/nxp-tja11xx.c:219:\tif (!phydev-\u003edrv-\u003ecable_test_start ||\ndrivers/net/phy/nxp-tja11xx.c:220:\t    !phydev-\u003edrv-\u003ecable_test_get_status)\ndrivers/net/phy/nxp-tja11xx.c-221-\t\treturn 0;\n--\ndrivers/net/phy/nxp-tja11xx.c-226-\ndrivers/net/phy/nxp-tja11xx.c:227:\tret = phydev-\u003edrv-\u003ecable_test_start(phydev);\ndrivers/net/phy/nxp-tja11xx.c-228-\tif (ret)\n--\ndrivers/net/phy/nxp-tja11xx.c-233-\ndrivers/net/phy/nxp-tja11xx.c:234:\tret = phydev-\u003edrv-\u003ecable_test_get_status(phydev, \u0026finished);\ndrivers/net/phy/nxp-tja11xx.c-235-\tif (ret)\n--\ndrivers/net/phy/phy-core.c=468=int __phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum)\n--\ndrivers/net/phy/phy-core.c-472-\ndrivers/net/phy/phy-core.c:473:\tif (phydev-\u003edrv \u0026\u0026 phydev-\u003edrv-\u003eread_mmd)\ndrivers/net/phy/phy-core.c:474:\t\treturn phydev-\u003edrv-\u003eread_mmd(phydev, devad, regnum);\ndrivers/net/phy/phy-core.c-475-\n--\ndrivers/net/phy/phy-core.c=512=int __phy_write_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val)\n--\ndrivers/net/phy/phy-core.c-516-\ndrivers/net/phy/phy-core.c:517:\tif (phydev-\u003edrv \u0026\u0026 phydev-\u003edrv-\u003ewrite_mmd)\ndrivers/net/phy/phy-core.c:518:\t\treturn phydev-\u003edrv-\u003ewrite_mmd(phydev, devad, regnum, val);\ndrivers/net/phy/phy-core.c-519-\n--\ndrivers/net/phy/phy-core.c=723=static int __phy_read_page(struct phy_device *phydev)\ndrivers/net/phy/phy-core.c-724-{\ndrivers/net/phy/phy-core.c:725:\tif (WARN_ONCE(!phydev-\u003edrv-\u003eread_page, \"read_page callback not available, PHY driver not loaded?\\n\"))\ndrivers/net/phy/phy-core.c-726-\t\treturn -EOPNOTSUPP;\ndrivers/net/phy/phy-core.c-727-\ndrivers/net/phy/phy-core.c:728:\treturn phydev-\u003edrv-\u003eread_page(phydev);\ndrivers/net/phy/phy-core.c-729-}\n--\ndrivers/net/phy/phy-core.c=731=static int __phy_write_page(struct phy_device *phydev, int page)\ndrivers/net/phy/phy-core.c-732-{\ndrivers/net/phy/phy-core.c:733:\tif (WARN_ONCE(!phydev-\u003edrv-\u003ewrite_page, \"write_page callback not available, PHY driver not loaded?\\n\"))\ndrivers/net/phy/phy-core.c-734-\t\treturn -EOPNOTSUPP;\ndrivers/net/phy/phy-core.c-735-\ndrivers/net/phy/phy-core.c:736:\treturn phydev-\u003edrv-\u003ewrite_page(phydev, page);\ndrivers/net/phy/phy-core.c-737-}\n--\ndrivers/net/phy/phy.c=64=static void phy_process_state_change(struct phy_device *phydev,\n--\ndrivers/net/phy/phy.c-70-\t\t\t   phy_state_to_str(phydev-\u003estate));\ndrivers/net/phy/phy.c:71:\t\tif (phydev-\u003edrv \u0026\u0026 phydev-\u003edrv-\u003elink_change_notify)\ndrivers/net/phy/phy.c:72:\t\t\tphydev-\u003edrv-\u003elink_change_notify(phydev);\ndrivers/net/phy/phy.c-73-\t}\n--\ndrivers/net/phy/phy.c=146=int phy_get_rate_matching(struct phy_device *phydev,\n--\ndrivers/net/phy/phy.c-150-\ndrivers/net/phy/phy.c:151:\tif (phydev-\u003edrv-\u003eget_rate_matching) {\ndrivers/net/phy/phy.c-152-\t\tmutex_lock(\u0026phydev-\u003elock);\ndrivers/net/phy/phy.c:153:\t\tret = phydev-\u003edrv-\u003eget_rate_matching(phydev, iface);\ndrivers/net/phy/phy.c-154-\t\tmutex_unlock(\u0026phydev-\u003elock);\n--\ndrivers/net/phy/phy.c=168=static int phy_config_interrupt(struct phy_device *phydev, bool interrupts)\n--\ndrivers/net/phy/phy.c-170-\tphydev-\u003einterrupts = interrupts ? 1 : 0;\ndrivers/net/phy/phy.c:171:\tif (phydev-\u003edrv-\u003econfig_intr)\ndrivers/net/phy/phy.c:172:\t\treturn phydev-\u003edrv-\u003econfig_intr(phydev);\ndrivers/net/phy/phy.c-173-\n--\ndrivers/net/phy/phy.c=205=int phy_aneg_done(struct phy_device *phydev)\ndrivers/net/phy/phy.c-206-{\ndrivers/net/phy/phy.c:207:\tif (phydev-\u003edrv \u0026\u0026 phydev-\u003edrv-\u003eaneg_done)\ndrivers/net/phy/phy.c:208:\t\treturn phydev-\u003edrv-\u003eaneg_done(phydev);\ndrivers/net/phy/phy.c-209-\telse if (phydev-\u003eis_c45)\n--\ndrivers/net/phy/phy.c=549=int phy_ethtool_get_strings(struct phy_device *phydev, u8 *data)\ndrivers/net/phy/phy.c-550-{\ndrivers/net/phy/phy.c:551:\tif (!phydev-\u003edrv)\ndrivers/net/phy/phy.c-552-\t\treturn -EIO;\n--\ndrivers/net/phy/phy.c-554-\tmutex_lock(\u0026phydev-\u003elock);\ndrivers/net/phy/phy.c:555:\tphydev-\u003edrv-\u003eget_strings(phydev, data);\ndrivers/net/phy/phy.c-556-\tmutex_unlock(\u0026phydev-\u003elock);\n--\ndrivers/net/phy/phy.c=567=int phy_ethtool_get_sset_count(struct phy_device *phydev)\n--\ndrivers/net/phy/phy.c-570-\ndrivers/net/phy/phy.c:571:\tif (!phydev-\u003edrv)\ndrivers/net/phy/phy.c-572-\t\treturn -EIO;\ndrivers/net/phy/phy.c-573-\ndrivers/net/phy/phy.c:574:\tif (phydev-\u003edrv-\u003eget_sset_count \u0026\u0026\ndrivers/net/phy/phy.c:575:\t    phydev-\u003edrv-\u003eget_strings \u0026\u0026\ndrivers/net/phy/phy.c:576:\t    phydev-\u003edrv-\u003eget_stats) {\ndrivers/net/phy/phy.c-577-\t\tmutex_lock(\u0026phydev-\u003elock);\ndrivers/net/phy/phy.c:578:\t\tret = phydev-\u003edrv-\u003eget_sset_count(phydev);\ndrivers/net/phy/phy.c-579-\t\tmutex_unlock(\u0026phydev-\u003elock);\n--\ndrivers/net/phy/phy.c=595=int phy_ethtool_get_stats(struct phy_device *phydev,\n--\ndrivers/net/phy/phy.c-597-{\ndrivers/net/phy/phy.c:598:\tif (!phydev-\u003edrv)\ndrivers/net/phy/phy.c-599-\t\treturn -EIO;\n--\ndrivers/net/phy/phy.c-601-\tmutex_lock(\u0026phydev-\u003elock);\ndrivers/net/phy/phy.c:602:\tphydev-\u003edrv-\u003eget_stats(phydev, stats, data);\ndrivers/net/phy/phy.c-603-\tmutex_unlock(\u0026phydev-\u003elock);\n--\ndrivers/net/phy/phy.c=619=void __phy_ethtool_get_phy_stats(struct phy_device *phydev,\n--\ndrivers/net/phy/phy.c-622-{\ndrivers/net/phy/phy.c:623:\tif (!phydev-\u003edrv || !phydev-\u003edrv-\u003eget_phy_stats)\ndrivers/net/phy/phy.c-624-\t\treturn;\n--\ndrivers/net/phy/phy.c-626-\tmutex_lock(\u0026phydev-\u003elock);\ndrivers/net/phy/phy.c:627:\tphydev-\u003edrv-\u003eget_phy_stats(phydev, phy_stats, phydev_stats);\ndrivers/net/phy/phy.c-628-\tmutex_unlock(\u0026phydev-\u003elock);\n--\ndrivers/net/phy/phy.c=639=void __phy_ethtool_get_link_ext_stats(struct phy_device *phydev,\n--\ndrivers/net/phy/phy.c-643-\ndrivers/net/phy/phy.c:644:\tif (!phydev-\u003edrv || !phydev-\u003edrv-\u003eget_link_stats)\ndrivers/net/phy/phy.c-645-\t\treturn;\n--\ndrivers/net/phy/phy.c-647-\tmutex_lock(\u0026phydev-\u003elock);\ndrivers/net/phy/phy.c:648:\tphydev-\u003edrv-\u003eget_link_stats(phydev, link_stats);\ndrivers/net/phy/phy.c-649-\tmutex_unlock(\u0026phydev-\u003elock);\n--\ndrivers/net/phy/phy.c=660=int phy_ethtool_get_plca_cfg(struct phy_device *phydev,\n--\ndrivers/net/phy/phy.c-664-\ndrivers/net/phy/phy.c:665:\tif (!phydev-\u003edrv) {\ndrivers/net/phy/phy.c-666-\t\tret = -EIO;\n--\ndrivers/net/phy/phy.c-669-\ndrivers/net/phy/phy.c:670:\tif (!phydev-\u003edrv-\u003eget_plca_cfg) {\ndrivers/net/phy/phy.c-671-\t\tret = -EOPNOTSUPP;\n--\ndrivers/net/phy/phy.c-675-\tmutex_lock(\u0026phydev-\u003elock);\ndrivers/net/phy/phy.c:676:\tret = phydev-\u003edrv-\u003eget_plca_cfg(phydev, plca_cfg);\ndrivers/net/phy/phy.c-677-\n--\ndrivers/net/phy/phy.c=721=int phy_ethtool_set_plca_cfg(struct phy_device *phydev,\n--\ndrivers/net/phy/phy.c-727-\ndrivers/net/phy/phy.c:728:\tif (!phydev-\u003edrv) {\ndrivers/net/phy/phy.c-729-\t\tret = -EIO;\n--\ndrivers/net/phy/phy.c-732-\ndrivers/net/phy/phy.c:733:\tif (!phydev-\u003edrv-\u003eset_plca_cfg ||\ndrivers/net/phy/phy.c:734:\t    !phydev-\u003edrv-\u003eget_plca_cfg) {\ndrivers/net/phy/phy.c-735-\t\tret = -EOPNOTSUPP;\n--\ndrivers/net/phy/phy.c-746-\ndrivers/net/phy/phy.c:747:\tret = phydev-\u003edrv-\u003eget_plca_cfg(phydev, curr_plca_cfg);\ndrivers/net/phy/phy.c-748-\tif (ret)\n--\ndrivers/net/phy/phy.c-803-\ndrivers/net/phy/phy.c:804:\tret = phydev-\u003edrv-\u003eset_plca_cfg(phydev, plca_cfg);\ndrivers/net/phy/phy.c-805-\n--\ndrivers/net/phy/phy.c=821=int phy_ethtool_get_plca_status(struct phy_device *phydev,\n--\ndrivers/net/phy/phy.c-825-\ndrivers/net/phy/phy.c:826:\tif (!phydev-\u003edrv) {\ndrivers/net/phy/phy.c-827-\t\tret = -EIO;\n--\ndrivers/net/phy/phy.c-830-\ndrivers/net/phy/phy.c:831:\tif (!phydev-\u003edrv-\u003eget_plca_status) {\ndrivers/net/phy/phy.c-832-\t\tret = -EOPNOTSUPP;\n--\ndrivers/net/phy/phy.c-836-\tmutex_lock(\u0026phydev-\u003elock);\ndrivers/net/phy/phy.c:837:\tret = phydev-\u003edrv-\u003eget_plca_status(phydev, plca_st);\ndrivers/net/phy/phy.c-838-\n--\ndrivers/net/phy/phy.c=850=int phy_start_cable_test(struct phy_device *phydev,\n--\ndrivers/net/phy/phy.c-855-\ndrivers/net/phy/phy.c:856:\tif (!(phydev-\u003edrv \u0026\u0026\ndrivers/net/phy/phy.c:857:\t      phydev-\u003edrv-\u003ecable_test_start \u0026\u0026\ndrivers/net/phy/phy.c:858:\t      phydev-\u003edrv-\u003ecable_test_get_status)) {\ndrivers/net/phy/phy.c-859-\t\tNL_SET_ERR_MSG(extack,\n--\ndrivers/net/phy/phy.c-887-\tnetif_testing_on(dev);\ndrivers/net/phy/phy.c:888:\terr = phydev-\u003edrv-\u003ecable_test_start(phydev);\ndrivers/net/phy/phy.c-889-\tif (err) {\n--\ndrivers/net/phy/phy.c=920=int phy_start_cable_test_tdr(struct phy_device *phydev,\n--\ndrivers/net/phy/phy.c-926-\ndrivers/net/phy/phy.c:927:\tif (!(phydev-\u003edrv \u0026\u0026\n\n"
}

68/3 2026/09/14 23:10 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 15866
							output: 40
							thoughts: 25
						

Thoughts:
Here's a summary of my thought process, as requested:

**Diving into the `phy_attach_direct` Function**

Okay, let's get down to brass tacks. I need to understand what's happening with `phy_attach_direct`, specifically within the lines 1740-1840 of the relevant code. This is where the magic (or the problems!) are likely happening. I'm going to carefully dissect this section to see how it works. I'm looking for the core logic: the inputs, the processing, the outputs, and any potential points of failure or optimization. My expertise allows me to quickly home in on the relevant data structures and control flow, so I'll be focused on how the `phy_attach_direct` function directly influences the system behavior in this region. This will also give a better context to the surrounding code.



69/3 2026/09/14 23:10 tool read-file
0m Args:
{
  "File": "drivers/net/phy/phy_device.c",
  "FirstLine": 1730,
  "LineCount": 90
}

Results:
{
  "Contents": "1730:\t}\n1731:\t\n1732:\tstatic bool phy_drv_supports_irq(const struct phy_driver *phydrv)\n1733:\t{\n1734:\t\treturn phydrv-\u003econfig_intr \u0026\u0026 phydrv-\u003ehandle_interrupt;\n1735:\t}\n1736:\t\n1737:\t/**\n1738:\t * phy_attach_direct - attach a network device to a given PHY device pointer\n1739:\t * @dev: network device to attach\n1740:\t * @phydev: Pointer to phy_device to attach\n1741:\t * @flags: PHY device's dev_flags\n1742:\t * @interface: PHY device's interface\n1743:\t *\n1744:\t * Description: Called by drivers to attach to a particular PHY\n1745:\t *     device. The phy_device is found, and properly hooked up\n1746:\t *     to the phy_driver.  If no driver is attached, then a\n1747:\t *     generic driver is used.  The phy_device is given a ptr to\n1748:\t *     the attaching device, and given a callback for link status\n1749:\t *     change.  The phy_device is returned to the attaching driver.\n1750:\t *     This function takes a reference on the phy device.\n1751:\t */\n1752:\tint phy_attach_direct(struct net_device *dev, struct phy_device *phydev,\n1753:\t\t\t      u32 flags, phy_interface_t interface)\n1754:\t{\n1755:\t\tstruct mii_bus *bus = phydev-\u003emdio.bus;\n1756:\t\tstruct device *d = \u0026phydev-\u003emdio.dev;\n1757:\t\tstruct module *ndev_owner = NULL;\n1758:\t\tint err;\n1759:\t\n1760:\t\t/* For Ethernet device drivers that register their own MDIO bus, we\n1761:\t\t * will have bus-\u003eowner match ndev_mod, so we do not want to increment\n1762:\t\t * our own module-\u003erefcnt here, otherwise we would not be able to\n1763:\t\t * unload later on.\n1764:\t\t */\n1765:\t\tif (dev)\n1766:\t\t\tndev_owner = dev-\u003edev.parent-\u003edriver-\u003eowner;\n1767:\t\tif (ndev_owner != bus-\u003eowner \u0026\u0026 !try_module_get(bus-\u003eowner)) {\n1768:\t\t\tphydev_err(phydev, \"failed to get the bus module\\n\");\n1769:\t\t\treturn -EIO;\n1770:\t\t}\n1771:\t\n1772:\t\tget_device(d);\n1773:\t\n1774:\t\t/* Assume that if there is no driver, that it doesn't\n1775:\t\t * exist, and we should use the genphy driver.\n1776:\t\t */\n1777:\t\tif (!d-\u003edriver) {\n1778:\t\t\tif (phydev-\u003eis_c45)\n1779:\t\t\t\td-\u003edriver = \u0026genphy_c45_driver.mdiodrv.driver;\n1780:\t\t\telse\n1781:\t\t\t\td-\u003edriver = \u0026genphy_driver.mdiodrv.driver;\n1782:\t\n1783:\t\t\tphydev-\u003eis_genphy_driven = 1;\n1784:\t\t} else if (!phydev-\u003edrv) {\n1785:\t\t\t/* d-\u003edriver outlives phydev-\u003edrv on unbind, precedes it on bind */\n1786:\t\t\terr = -EBUSY;\n1787:\t\t\tgoto error_put_device;\n1788:\t\t}\n1789:\t\n1790:\t\tif (!try_module_get(d-\u003edriver-\u003eowner)) {\n1791:\t\t\tphydev_err(phydev, \"failed to get the device driver module\\n\");\n1792:\t\t\terr = -EIO;\n1793:\t\t\tgoto error_put_device;\n1794:\t\t}\n1795:\t\n1796:\t\tif (phydev-\u003eis_genphy_driven) {\n1797:\t\t\terr = d-\u003edriver-\u003eprobe(d);\n1798:\t\t\tif (err \u003e= 0)\n1799:\t\t\t\terr = device_bind_driver(d);\n1800:\t\n1801:\t\t\tif (err)\n1802:\t\t\t\tgoto error_module_put;\n1803:\t\t}\n1804:\t\n1805:\t\tif (phydev-\u003eattached_dev) {\n1806:\t\t\tdev_err(\u0026dev-\u003edev, \"PHY already attached\\n\");\n1807:\t\t\terr = -EBUSY;\n1808:\t\t\tgoto error;\n1809:\t\t}\n1810:\t\n1811:\t\tphydev-\u003ephy_link_change = phy_link_change;\n1812:\t\tif (dev) {\n1813:\t\t\tphydev-\u003eattached_dev = dev;\n1814:\t\t\tdev-\u003ephydev = phydev;\n1815:\t\n1816:\t\t\tif (phydev-\u003esfp_bus_attached)\n1817:\t\t\t\tdev-\u003esfp_bus = phydev-\u003esfp_bus;\n1818:\t\n1819:\t\t\terr = phy_link_topo_add_phy(dev, phydev, PHY_UPSTREAM_MAC, dev);\n"
}

70/3 2026/09/14 23:10 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 17536
							output: 30
							thoughts: 150
						

Thoughts:
**Analyzing a Driver Binding Issue**

Okay, so I need to understand the problem this patch addresses. First, I'll search the commit messages and git logs. I'll specifically look for occurrences of `d->driver outlives phydev->drv` or variations using just `phydev->drv`. That should give me a good starting point.

Right, so in the Linux device model, `struct device d` – in this case, `phydev->mdio.dev` – has `d->driver`. The core of the issue likely lies in the timing of the driver binding. I know that when a driver gets bound to a device, `d->driver` is set *before* the `probe()` function is called. Or, I should say, it's set in `device_bind_driver`.

Now, I need to get into the details of the specific probe function. Let's see... the code mentions the PHY driver probe, which is `phy_probe`, and that's in `phy_device.c`. Okay, time to dive into that function to trace the flow of execution.



71/3 2026/09/14 23:10 tool grepper
0m Args:
{
  "Expression": "phy_probe\\(",
  "PathPrefix": "drivers/net/phy/"
}

Results:
{
  "Output": "drivers/net/phy/broadcom.c=1150=static int bcm54xx_phy_set_wol(struct phy_device *phydev,\n--\ndrivers/net/phy/broadcom.c-1169-\ndrivers/net/phy/broadcom.c:1170:static int bcm54xx_phy_probe(struct phy_device *phydev)\ndrivers/net/phy/broadcom.c-1171-{\n--\ndrivers/net/phy/intel-xway.c=287=static int xway_gphy_config_init(struct phy_device *phydev)\n--\ndrivers/net/phy/intel-xway.c-315-\ndrivers/net/phy/intel-xway.c:316:static int xway_gphy_probe(struct phy_device *phydev)\ndrivers/net/phy/intel-xway.c-317-{\n--\ndrivers/net/phy/mediatek/mtk-2p5ge.c=314=static int mt798x_2p5ge_phy_led_hw_control_set(struct phy_device *phydev,\n--\ndrivers/net/phy/mediatek/mtk-2p5ge.c-322-\ndrivers/net/phy/mediatek/mtk-2p5ge.c:323:static int mt798x_2p5ge_phy_probe(struct phy_device *phydev)\ndrivers/net/phy/mediatek/mtk-2p5ge.c-324-{\n--\ndrivers/net/phy/mediatek/mtk-ge-soc.c=1332=static int mt7988_phy_probe_shared(struct phy_device *phydev)\n--\ndrivers/net/phy/mediatek/mtk-ge-soc.c-1372-\ndrivers/net/phy/mediatek/mtk-ge-soc.c:1373:static int mt7988_phy_probe(struct phy_device *phydev)\ndrivers/net/phy/mediatek/mtk-ge-soc.c-1374-{\n--\ndrivers/net/phy/mediatek/mtk-ge-soc.c-1413-\ndrivers/net/phy/mediatek/mtk-ge-soc.c:1414:static int mt7981_phy_probe(struct phy_device *phydev)\ndrivers/net/phy/mediatek/mtk-ge-soc.c-1415-{\n--\ndrivers/net/phy/mediatek/mtk-ge-soc.c-1429-\ndrivers/net/phy/mediatek/mtk-ge-soc.c:1430:static int an7581_phy_probe(struct phy_device *phydev)\ndrivers/net/phy/mediatek/mtk-ge-soc.c-1431-{\n--\ndrivers/net/phy/mediatek/mtk-ge.c=37=static void mtk_gephy_config_init(struct phy_device *phydev)\n--\ndrivers/net/phy/mediatek/mtk-ge.c-64-\ndrivers/net/phy/mediatek/mtk-ge.c:65:static int mt7530_phy_probe(struct phy_device *phydev)\ndrivers/net/phy/mediatek/mtk-ge.c-66-{\n--\ndrivers/net/phy/mediatek/mtk-ge.c=77=static int mt7530_phy_config_init(struct phy_device *phydev)\n--\ndrivers/net/phy/mediatek/mtk-ge.c-84-\t * -\u003econfig_init after a PHY reset, with the register back at its\ndrivers/net/phy/mediatek/mtk-ge.c:85:\t * EEE-advertising hardware default, and phy_probe() zeroes\ndrivers/net/phy/mediatek/mtk-ge.c-86-\t * eee_disabled_modes (of_set_phy_eee_broken()) after -\u003eprobe already\n--\ndrivers/net/phy/micrel.c=2754=static int ksz8061_suspend(struct phy_device *phydev)\n--\ndrivers/net/phy/micrel.c-2758-\ndrivers/net/phy/micrel.c:2759:static int kszphy_probe(struct phy_device *phydev)\ndrivers/net/phy/micrel.c-2760-{\n--\ndrivers/net/phy/micrel.c=6040=static int lan8841_probe(struct phy_device *phydev)\n--\ndrivers/net/phy/micrel.c-6045-\ndrivers/net/phy/micrel.c:6046:\terr = kszphy_probe(phydev);\ndrivers/net/phy/micrel.c-6047-\tif (err)\n--\ndrivers/net/phy/phy_device.c=3681=EXPORT_SYMBOL_GPL(fwnode_get_phy_node);\n--\ndrivers/net/phy/phy_device.c-3688- */\ndrivers/net/phy/phy_device.c:3689:static int phy_probe(struct device *dev)\ndrivers/net/phy/phy_device.c-3690-{\n--\ndrivers/net/phy/smsc.c=656=EXPORT_SYMBOL_GPL(smsc_phy_set_tunable);\ndrivers/net/phy/smsc.c-657-\ndrivers/net/phy/smsc.c:658:int smsc_phy_probe(struct phy_device *phydev)\ndrivers/net/phy/smsc.c-659-{\n"
}

72/3 2026/09/14 23:10 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 19378
							output: 40
							thoughts: 23
						

Thoughts:
Here's my attempt at summarizing the thought process, tailored for an expert audience:

**Diving into PHY Probe - Let's See What's Going On**

Alright, time to crack open `phy_device.c` and specifically, dig into that `phy_probe` function. I want to refresh my memory on the PHY initialization sequence, especially how the driver discovers and configures the physical layer interface. I'm assuming there's some interesting stuff in there about probing for different PHY types, handling autonegotiation, and potentially dealing with specific vendor-specific registers or quirks. I need to understand how the system identifies the connected PHY device and gets it up and running. Is it using the standard MII bus, or something more specialized? Are they using DT bindings? I'm anticipating some intricate register manipulation and interrupt handling to get the link up. I'm also curious about error handling and fallback mechanisms if the probe fails. This is often where those annoying edge-case issues tend to lurk. Let's get to it.



73/3 2026/09/14 23:10 tool read-file
0m Args:
{
  "File": "drivers/net/phy/phy_device.c",
  "FirstLine": 3685,
  "LineCount": 80
}

Results:
{
  "Contents": "3685:\t * @dev: device to probe and init\n3686:\t *\n3687:\t * Take care of setting up the phy_device structure, set the state to READY.\n3688:\t */\n3689:\tstatic int phy_probe(struct device *dev)\n3690:\t{\n3691:\t\tstruct phy_device *phydev = to_phy_device(dev);\n3692:\t\tstruct device_driver *drv = phydev-\u003emdio.dev.driver;\n3693:\t\tstruct phy_driver *phydrv = to_phy_driver(drv);\n3694:\t\tint err = 0;\n3695:\t\n3696:\t\tphydev-\u003edrv = phydrv;\n3697:\t\n3698:\t\t/* Disable the interrupt if the PHY doesn't support it\n3699:\t\t * but the interrupt is still a valid one\n3700:\t\t */\n3701:\t\tif (!phy_drv_supports_irq(phydrv) \u0026\u0026 phy_interrupt_is_valid(phydev))\n3702:\t\t\tphydev-\u003eirq = PHY_POLL;\n3703:\t\n3704:\t\tif (phydrv-\u003eflags \u0026 PHY_IS_INTERNAL)\n3705:\t\t\tphydev-\u003eis_internal = true;\n3706:\t\n3707:\t\t/* Deassert the reset signal */\n3708:\t\tphy_device_reset(phydev, 0);\n3709:\t\n3710:\t\tif (phydev-\u003edrv-\u003eprobe) {\n3711:\t\t\terr = phydev-\u003edrv-\u003eprobe(phydev);\n3712:\t\t\tif (err)\n3713:\t\t\t\tgoto out;\n3714:\t\t}\n3715:\t\n3716:\t\tphy_disable_interrupts(phydev);\n3717:\t\n3718:\t\t/* Start out supporting everything. Eventually,\n3719:\t\t * a controller will attach, and may modify one\n3720:\t\t * or both of these values\n3721:\t\t */\n3722:\t\tif (phydrv-\u003efeatures) {\n3723:\t\t\tlinkmode_copy(phydev-\u003esupported, phydrv-\u003efeatures);\n3724:\t\t\tgenphy_c45_read_eee_abilities(phydev);\n3725:\t\t}\n3726:\t\telse if (phydrv-\u003eget_features)\n3727:\t\t\terr = phydrv-\u003eget_features(phydev);\n3728:\t\telse if (phydev-\u003eis_c45)\n3729:\t\t\terr = genphy_c45_pma_read_abilities(phydev);\n3730:\t\telse\n3731:\t\t\terr = genphy_read_abilities(phydev);\n3732:\t\n3733:\t\tif (err)\n3734:\t\t\tgoto out;\n3735:\t\n3736:\t\tif (!linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,\n3737:\t\t\t\t       phydev-\u003esupported))\n3738:\t\t\tphydev-\u003eautoneg = 0;\n3739:\t\n3740:\t\tif (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT,\n3741:\t\t\t\t      phydev-\u003esupported))\n3742:\t\t\tphydev-\u003eis_gigabit_capable = 1;\n3743:\t\tif (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT,\n3744:\t\t\t\t      phydev-\u003esupported))\n3745:\t\t\tphydev-\u003eis_gigabit_capable = 1;\n3746:\t\n3747:\t\tof_set_phy_supported(phydev);\n3748:\t\n3749:\t\terr = phy_setup_ports(phydev);\n3750:\t\tif (err)\n3751:\t\t\tgoto out;\n3752:\t\n3753:\t\tphy_advertise_supported(phydev);\n3754:\t\n3755:\t\t/* Get PHY default EEE advertising modes and handle them as potentially\n3756:\t\t * safe initial configuration.\n3757:\t\t */\n3758:\t\terr = genphy_c45_read_eee_adv(phydev, phydev-\u003eadvertising_eee);\n3759:\t\tif (err)\n3760:\t\t\tgoto out;\n3761:\t\n3762:\t\t/* Get the EEE modes we want to prohibit. */\n3763:\t\tof_set_phy_eee_broken(phydev);\n3764:\t\n"
}

74/3 2026/09/14 23:10 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 20868
							output: 40
							thoughts: 21
						

Thoughts:
Here's my attempt at summarizing the thought process, tailored for an expert audience and written in the first person:

**Investigating `phy_remove`**

Okay, so I'm thinking about the `phy_remove` function, probably located in `phy_device.c`. That's where I need to start. What's the context here? Am I debugging a driver issue? Looking for potential performance bottlenecks? Or maybe just doing some code archaeology? Knowing the reason will focus my investigation. First, I’ll probably need to understand what that function is supposed to *do* specifically in the broad context of the driver and, more broadly, the subsystem it supports. And, of course, I'll need to remember that this function exists in the **PHY** (Physical Layer) device context, so I'll need to know whether the PHY is managed by hardware or software.



75/3 2026/09/14 23:10 tool read-file
0m Args:
{
  "File": "drivers/net/phy/phy_device.c",
  "FirstLine": 3765,
  "LineCount": 40
}

Results:
{
  "Contents": "3765:\t\t/* Some PHYs may advertise, by default, not support EEE modes. So,\n3766:\t\t * we need to clean them. In addition remove all disabled EEE modes.\n3767:\t\t */\n3768:\t\tlinkmode_and(phydev-\u003eadvertising_eee, phydev-\u003esupported_eee,\n3769:\t\t\t     phydev-\u003eadvertising_eee);\n3770:\t\tlinkmode_andnot(phydev-\u003eadvertising_eee, phydev-\u003eadvertising_eee,\n3771:\t\t\t\tphydev-\u003eeee_disabled_modes);\n3772:\t\n3773:\t\t/* There is no \"enabled\" flag. If PHY is advertising, assume it is\n3774:\t\t * kind of enabled.\n3775:\t\t */\n3776:\t\tphydev-\u003eeee_cfg.eee_enabled = !linkmode_empty(phydev-\u003eadvertising_eee);\n3777:\t\n3778:\t\t/* Get master/slave strap overrides */\n3779:\t\tof_set_phy_timing_role(phydev);\n3780:\t\n3781:\t\t/* The Pause Frame bits indicate that the PHY can support passing\n3782:\t\t * pause frames. During autonegotiation, the PHYs will determine if\n3783:\t\t * they should allow pause frames to pass.  The MAC driver should then\n3784:\t\t * use that result to determine whether to enable flow control via\n3785:\t\t * pause frames.\n3786:\t\t *\n3787:\t\t * Normally, PHY drivers should not set the Pause bits, and instead\n3788:\t\t * allow phylib to do that.  However, there may be some situations\n3789:\t\t * (e.g. hardware erratum) where the driver wants to set only one\n3790:\t\t * of these bits.\n3791:\t\t */\n3792:\t\tif (!test_bit(ETHTOOL_LINK_MODE_Pause_BIT, phydev-\u003esupported) \u0026\u0026\n3793:\t\t    !test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, phydev-\u003esupported)) {\n3794:\t\t\tlinkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT,\n3795:\t\t\t\t\t phydev-\u003esupported);\n3796:\t\t\tlinkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,\n3797:\t\t\t\t\t phydev-\u003esupported);\n3798:\t\t}\n3799:\t\n3800:\t\t/* Set the state to READY by default */\n3801:\t\tphydev-\u003estate = PHY_READY;\n3802:\t\n3803:\t\t/* Register the PHY LED triggers */\n3804:\t\tif (!phydev-\u003eis_on_sfp_module)\n"
}

76/3 2026/09/14 23:10 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 21823
							output: 40
							thoughts: 16
						

Thoughts:
Okay, let's dive into those lines.

**Deconstructing Lines 3805-3840: A Deep Dive**

Alright, lines 3805 through 3840, eh? My initial thought is, what are we dealing with here? What context are we operating within? Based on my extensive experience, I need to immediately understand the broader framework – is this a proof, an argument, a section of code, a segment of prose? The specific keywords or subject matter will inform how I approach it. My expertise allows me to quickly sift through any extraneous data.

I'm mentally preparing to scrutinize each line for its core contribution. I'll be looking for logical fallacies, potential inconsistencies, areas of ambiguity, or instances where the author might be taking shortcuts or making assumptions. Given the scope of these lines, I'll be looking to identify the high-level concept or claim and then quickly get to the underlying mechanisms. Are there any novel approaches within these lines? Does it leverage an existing framework?

If this is a proof or an argument, I'll be looking for the structure: premises, intermediate steps, and the final conclusion. Is the logic sound? Are the premises well-established or assumptions? If it's code, I'll be analyzing the control flow, the data structures used, and the computational complexity. Are there any potential bottlenecks or areas for optimization? Does it introduce new classes or functions? Is it well-documented? If this is prose, I will attempt to identify the tone and writing style, as these details often give important context to the passage.

I'll be paying close attention to any details that might seem minor at first, because my experience tells me that these details often hold the key to a deeper understanding. I'll be testing its validity by applying my own theoretical understanding and empirical knowledge, looking for the weaknesses or strengths. It's time to get to work.



77/3 2026/09/14 23:10 tool read-file
0m Args:
{
  "File": "drivers/net/phy/phy_device.c",
  "FirstLine": 3805,
  "LineCount": 40
}

Results:
{
  "Contents": "3805:\t\t\tphy_led_triggers_register(phydev);\n3806:\t\n3807:\t\t/* Get the LEDs from the device tree, and instantiate standard\n3808:\t\t * LEDs for them.\n3809:\t\t */\n3810:\t\tif (IS_ENABLED(CONFIG_PHYLIB_LEDS) \u0026\u0026 !phy_driver_is_genphy(phydev)) {\n3811:\t\t\terr = of_phy_leds(phydev);\n3812:\t\t\tif (err)\n3813:\t\t\t\tgoto out;\n3814:\t\t}\n3815:\t\n3816:\t\treturn 0;\n3817:\t\n3818:\tout:\n3819:\t\tsfp_bus_del_upstream(phydev-\u003esfp_bus);\n3820:\t\tphydev-\u003esfp_bus = NULL;\n3821:\t\n3822:\t\tphy_cleanup_ports(phydev);\n3823:\t\n3824:\t\tif (!phydev-\u003eis_on_sfp_module)\n3825:\t\t\tphy_led_triggers_unregister(phydev);\n3826:\t\n3827:\t\t/* Re-assert the reset signal on error */\n3828:\t\tphy_device_reset(phydev, 1);\n3829:\t\n3830:\t\treturn err;\n3831:\t}\n3832:\t\n3833:\tstatic int phy_remove(struct device *dev)\n3834:\t{\n3835:\t\tstruct phy_device *phydev = to_phy_device(dev);\n3836:\t\n3837:\t\tcancel_delayed_work_sync(\u0026phydev-\u003estate_queue);\n3838:\t\n3839:\t\tif (IS_ENABLED(CONFIG_PHYLIB_LEDS) \u0026\u0026 !phy_driver_is_genphy(phydev))\n3840:\t\t\tphy_leds_unregister(phydev);\n3841:\t\n3842:\t\tif (!phydev-\u003eis_on_sfp_module)\n3843:\t\t\tphy_led_triggers_unregister(phydev);\n3844:\t\n"
}

78/3 2026/09/14 23:10 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 22854
							output: 40
							thoughts: 18
						

Thoughts:
Okay, here's my interpretation of that request, formatted as requested:

**Analyzing the Relevant Section**

Right, let's zero in on lines 3845 through 3870, shall we? I've got a feeling something interesting is going to pop up in that segment. My initial analysis is that this specific block of code or text likely contains a key element to the subject matter. Given my expertise, my first instinct is to see how this fits into the larger picture, so I will analyze the lines in the given range.



79/3 2026/09/14 23:10 tool read-file
0m Args:
{
  "File": "drivers/net/phy/phy_device.c",
  "FirstLine": 3845,
  "LineCount": 35
}

Results:
{
  "Contents": "3845:\t\tphydev-\u003estate = PHY_DOWN;\n3846:\t\n3847:\t\tsfp_bus_del_upstream(phydev-\u003esfp_bus);\n3848:\t\tphydev-\u003esfp_bus = NULL;\n3849:\t\n3850:\t\tphy_cleanup_ports(phydev);\n3851:\t\n3852:\t\tif (phydev-\u003edrv \u0026\u0026 phydev-\u003edrv-\u003eremove)\n3853:\t\t\tphydev-\u003edrv-\u003eremove(phydev);\n3854:\t\n3855:\t\t/* Assert the reset signal */\n3856:\t\tphy_device_reset(phydev, 1);\n3857:\t\n3858:\t\tphydev-\u003edrv = NULL;\n3859:\t\n3860:\t\treturn 0;\n3861:\t}\n3862:\t\n3863:\t/**\n3864:\t * phy_driver_register - register a phy_driver with the PHY layer\n3865:\t * @new_driver: new phy_driver to register\n3866:\t * @owner: module owning this PHY\n3867:\t */\n3868:\tstatic int phy_driver_register(struct phy_driver *new_driver,\n3869:\t\t\t\t       struct module *owner)\n3870:\t{\n3871:\t\tint retval;\n3872:\t\n3873:\t\t/* Either the features are hard coded, or dynamically\n3874:\t\t * determined. It cannot be both.\n3875:\t\t */\n3876:\t\tif (WARN_ON(new_driver-\u003efeatures \u0026\u0026 new_driver-\u003eget_features)) {\n3877:\t\t\tpr_err(\"%s: features and get_features must not both be set\\n\",\n3878:\t\t\t       new_driver-\u003ename);\n3879:\t\t\treturn -EINVAL;\n"
}

80/3 2026/09/14 23:10 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 23521
							output: 192
							thoughts: 1563
						

Thoughts:
**Analysis of PHY Device Binding and Unbinding with Respect to KMSAN and KASAN**

Okay, so I've been looking at the interaction between `phy_remove` and the device core unbinding process, specifically the race conditions that can occur. The key thing I've noticed is that in `phy_remove`, `phydev->drv` is set to `NULL`. This is important. In the device core, when unbinding a device (using `device_release_driver_internal`), the bus/driver's `remove` callback (like `phy_remove`) gets called, where `phydev->drv` gets set to NULL. Afterwards, the `dev->driver` is set to NULL within the device core. Conversely, during binding, `dev->driver` gets set *before* the `probe` function is called, and `phydev->drv` gets set *inside* `phy_probe`.

The problem arises during concurrent operations. If `phy_attach_direct` is called at the same time a device is binding or unbinding, a window opens where `d->driver` might be non-NULL (because the device core hasn't cleared `dev->driver` yet, or has already set it during bind), but `phydev->drv` is still NULL! The existing logic in `phy_attach_direct` *used* to check `d->driver` and potentially assign `genphy_c45_driver` or `genphy_driver` to `d->driver` if it was NULL, before later assuming that `phydev->drv` was valid when it wasn't.

This patch addresses this dangerous scenario. It introduces a check: if `d->driver` is set, but `phydev->drv` is NULL, then return `-EBUSY`, preventing the attachment. This ensures that a PHY device isn't used while it's in a partially bound/unbound state.

Now, let's consider the KMSAN question. I need to justify if `NeedsKMSAN` should be set to true. The rules for KMSAN versus KASAN are critical. KMSAN is for *uninitialized* memory reads, kernel-to-user info leaks, and is a dedicated fuzzing session that adds resource costs. Standard KASAN and other tools handle out-of-bounds accesses, use-after-free, double frees, invalid frees, locking bugs, and memory corruption.

This patch does not introduce any of those situations! It doesn't modify kernel structures being sent to userspace, doesn't depend on uninitialized variables, doesn't introduce complex data structures with uninitialized fields, and doesn't alter bounds checks in a way that would expose uninitialized bytes. Instead, it prevents NULL pointer dereferences and race conditions during device binding and unbinding. The `phydev->drv` pointer, which is the concern here, is *initialized* using `kzalloc`. The patch only adds a sanity check.

Therefore, since this patch primarily deals with state validation and preventing NULL pointer dereferences which would trigger KASAN, and doesn't expose or introduce uninitialized memory risks, `NeedsKMSAN` *must* be set to false. No dedicated KMSAN fuzzing is needed here.



81/3 2026/09/14 23:10 tool set-results
0m Args:
{
  "KMSANReasoning": "The patch adds a validation check `else if (!phydev-\u003edrv)` in `phy_attach_direct()` to prevent attaching to a PHY device whose underlying device driver (`d-\u003edriver`) is set but whose PHY driver pointer (`phydev-\u003edrv`) is NULL (which occurs during transient bind or unbind operations). Without this check, callers could attach to a PHY in an incomplete state and subsequently trigger NULL pointer dereferences when invoking driver callbacks via `phydev-\u003edrv`.\n\nThis change is purely control-flow and state-validation logic addressing race conditions and potential NULL pointer dereferences. It does not introduce, modify, or read any uninitialized stack or heap memory, nor does it affect buffers copied to user space. Therefore, KMSAN is not applicable, and standard bug detectors and KASAN are sufficient.",
  "NeedsKMSAN": false
}

Results:
{
  "KMSANReasoning": "The patch adds a validation check `else if (!phydev-\u003edrv)` in `phy_attach_direct()` to prevent attaching to a PHY device whose underlying device driver (`d-\u003edriver`) is set but whose PHY driver pointer (`phydev-\u003edrv`) is NULL (which occurs during transient bind or unbind operations). Without this check, callers could attach to a PHY in an incomplete state and subsequently trigger NULL pointer dereferences when invoking driver callbacks via `phydev-\u003edrv`.\n\nThis change is purely control-flow and state-validation logic addressing race conditions and potential NULL pointer dereferences. It does not introduce, modify, or read any uninitialized stack or heap memory, nor does it affect buffers copied to user space. Therefore, KMSAN is not applicable, and standard bug detectors and KASAN are sufficient.",
  "NeedsKMSAN": false
}

LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)