HomeFreeBSD

e6000sw: Fix locking in miibus_{read,write}reg implementations

Description

e6000sw: Fix locking in miibus_{read,write}reg implementations

Commit 469290648005e13b819a19353032ca53dda4378f made e6000sw's
implementation of miibus_(read|write)reg assume that the softc lock is
held. I presume that is to avoid lock recursion in e6000sw_attach() ->
e6000sw_attach_miibus() -> mii_attach() -> MIIBUS_READREG().

However, the lock assertion in e6000sw_readphy_locked() can fail if a
different driver uses the interface to probe registers. Work around the
problem by providing implementations which lock the softc if it is not
already locked.

PR: 274795
Fixes: 469290648005 ("e6000sw: add readphy and writephy wrappers")
Reviewed by: kp, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42466

Details

Provenance
markjAuthored on Nov 6 2023, 7:57 PM
Reviewer
kp
Differential Revision
D42466: e6000sw: Fix locking in miibus_{read,write}reg implementations
Parents
rG2ffd30f7ee15: cam: Remove left-over sys/cdefs.h in sys/cam
Branches
Unknown
Tags
Unknown