Generic PHY "unload" crash

From: Alan Cooper
Date: Tue May 21 2019 - 14:43:21 EST


I'm seeing an issue on a system where I have a generic PHY that is
used by a USB XHCI driver. The XHCI driver does the phy_init() in
probe and the phy_exit() in remove. The problem happens when I use
sysfs to "unload" the PHY driver before doing an unload of the XHCI
driver. This is a result of the XHCI driver calling into the PHY
driver's phy_exit routine after it's been removed. It seems like this
issue will exist for other PHY provider/user pairs and I don't see an
easy solution. I was wondering if anyone had any suggestions on how to
solve this problem.

Al