opnsense-src/sys/dev/etherswitch
Mark Johnston 766cceba19 e6000sw: Fix locking in miibus_{read,write}reg implementations
Commit 4692906480 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:		4692906480 ("e6000sw: add readphy and writephy wrappers")
Reviewed by:	kp, imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42466

(cherry picked from commit 725962a9f4c050b21488edd58d317e87c76d6f66)
2023-11-13 09:41:50 -05:00
..
ar40xx spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
arswitch sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
e6000sw e6000sw: Fix locking in miibus_{read,write}reg implementations 2023-11-13 09:41:50 -05:00
felix sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
infineon sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ip17x sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
micrel sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
mtkswitch sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
rtl8366 sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ukswitch sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
etherswitch.c sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
etherswitch.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
etherswitch_if.m sys: Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:54:58 -06:00
miiproxy.c sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
miiproxy.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00