Skip to content

net: phy: dp83640: fix shared clock lifetime and probe error cleanup

Xuanqiang Luo netdev 3 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest4 patches 0 repliesApplied 4/4
  2. v54 patches 3 repliesSuperseded
  3. v44 patches 11 repliesSuperseded

Changes in v6 from the cover letter

Patch 4:
- Correct the author and Signed-off-by email address.
- Add Reviewed-by tag. (Andrew Lunn.)

Patches in v6 All 4 applied

#Subject and filesSizeRepliesApplied
1/4net: phy: add PHY package locking helpersdrivers/net/phy/phy_package.c drivers/net/phy/phylib.h+25 -00 repliesApplied
2/4net: phy: dp83640: embed pin configuration in clockdrivers/net/phy/dp83640.c+4 -110 repliesApplied
3/4net: phy: dp83640: clear state after PTP registration failuredrivers/net/phy/dp83640.c+4 -00 repliesApplied
4/4net: phy: dp83640: fix per-bus clock lifetimedrivers/net/phy/dp83640.c drivers/ptp/Kconfig+28 -850 repliesApplied

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchAndrew Lunn
1/4R-b
2/4R-b
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH net v6 0/4] net: phy: dp83640: fix shared clock lifetime and probe error cleanup

From: Xuanqiang Luo <[email protected]>

The DP83640 driver shares one PTP clock between all PHYs on the same MII bus.

Its driver-local clock lookup and removal scheme can leak the shared clock on probe failure or free it while another probe is acquiring it.

This series moves the shared clock to the PHY package infrastructure.

Patch 1 adds PHY package locking helpers.

Patch 2 embeds the pin configuration in the shared clock.

Patch 3 clears per-PHY state when PTP clock registration fails.

Patch 4 fixes the shared clock lifetime using the PHY package infrastructure.

---
Changes:
v6:
Patch 4:
- Correct the author and Signed-off-by email address.
- Add Reviewed-by tag. (Andrew Lunn.)

v5: https://lore.kernel.org/all/[email protected]/
Patch 1 ~ 3:
- Add Reviewed-by tags. (Andrew Lunn.)

Patch 4:
- Replace devm_phy_package_join() with explicit phy_package_join() and phy_package_leave(). (Andrew Lunn.)

v4: https://lore.kernel.org/all/[email protected]/
Patch 1 (new):
- Add PHY package locking helpers for shared package data. (Andrew Lunn.)

Patch 2 (new):
- Split the pin configuration storage change into a separate patch and clarify that the pin functions remain configurable at runtime. (Andrew Lunn.)
- Clarify the locking comments for pin_config. (Sashiko.)

Patch 3 (new):
- Split the PTP registration failure cleanup into a separate patch.

Patch 4:
- Use the PHY package locking helpers instead of accessing the MII bus shared lock directly. (Andrew Lunn.)
- Adapt the lifetime fix to the preparatory changes split into separate patches. (Andrew Lunn.)

v3: https://lore.kernel.org/all/[email protected]/
- Drop the Suggested-by tag. (Jakub Kicinski.)
- Set err to -ENOMEM on the kzalloc_obj() failure path. (Sashiko.)
- Let devres handle cleanup on driver detach instead of explicitly releasing the action from .remove(). (Jakub Kicinski.)

v2: https://lore.kernel.org/all/[email protected]/
- Replace the driver-local clock list and kref with the PHY package API. (Jakub Kicinski.)
- Use devres to avoid leaking the new package reference on later PHY core initialization failures.
- Embed the pin configuration in the package private data to simplify lifetime management.

v1: https://lore.kernel.org/all/[email protected]/

Xuanqiang Luo (4):
net: phy: add PHY package locking helpers
net: phy: dp83640: embed pin configuration in clock
net: phy: dp83640: clear state after PTP registration failure
net: phy: dp83640: fix per-bus clock lifetime

 drivers/net/phy/dp83640.c     | 131 +++++++++-------------------------
 drivers/net/phy/phy_package.c |  23 ++++++
 drivers/net/phy/phylib.h      |   2 +
 drivers/ptp/Kconfig           |   1 +
 4 files changed, 61 insertions(+), 96 deletions(-)
Signature · 1 line
2.43.0