Netdev List
 help / color / mirror / Atom feed
* [PATCH net v4 0/4] net: phy: dp83640: fix shared clock lifetime and probe error cleanup
@ 2026-08-07  7:07 xuanqiang.luo
  2026-08-07  7:07 ` [PATCH net v4 1/4] net: phy: add PHY package locking helpers xuanqiang.luo
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: xuanqiang.luo @ 2026-08-07  7:07 UTC (permalink / raw)
  To: netdev, andrew, kuba, richardcochran, hkallweit1
  Cc: linux, davem, edumazet, pabeni, maxime.chevallier, luoxuanqiang,
	Xuanqiang Luo

From: Xuanqiang Luo <xuanqiang.luo@linux.dev>

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:
v4:
  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/20260805072725.169431-1-xuanqiang.luo@linux.dev/
  - 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/20260730064451.32261-1-xuanqiang.luo@linux.dev/
  - 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/20260724023532.14583-1-xuanqiang.luo@linux.dev/

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     | 191 +++++++++++++---------------------
 drivers/net/phy/phy_package.c |  23 ++++
 drivers/net/phy/phylib.h      |   2 +
 drivers/ptp/Kconfig           |   1 +
 4 files changed, 98 insertions(+), 119 deletions(-)

-- 
2.43.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-08-07 13:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-07  7:07 [PATCH net v4 0/4] net: phy: dp83640: fix shared clock lifetime and probe error cleanup xuanqiang.luo
2026-08-07  7:07 ` [PATCH net v4 1/4] net: phy: add PHY package locking helpers xuanqiang.luo
2026-08-07 13:36   ` Andrew Lunn
2026-08-07  7:07 ` [PATCH net v4 2/4] net: phy: dp83640: embed pin configuration in clock xuanqiang.luo
2026-08-07 13:38   ` Andrew Lunn
2026-08-07  7:07 ` [PATCH net v4 3/4] net: phy: dp83640: clear state after PTP registration failure xuanqiang.luo
2026-08-07 13:42   ` Andrew Lunn
2026-08-07  7:07 ` [PATCH net v4 4/4] net: phy: dp83640: fix per-bus clock lifetime xuanqiang.luo
2026-08-07 13:59   ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox