Sashiko says: > commit 76ded6c0290bdb192c2ae1af9a2e6a47fc39c9a1 > Author: Vladimir Oltean > > scsi: ufs: exynos: stop poking into struct phy guts > This commit modifies the Exynos UFS driver to stop directly accessing the > generic PHY's power_count. Instead, it tracks the PHY power state internally > using a new phy_powered_on flag to properly handle link retries and > suspend/resume operations. > > > diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c > > --- a/drivers/ufs/host/ufs-exynos.c > > +++ b/drivers/ufs/host/ufs-exynos.c > [ ... ] > > @@ -1513,6 +1516,9 @@ static void exynos_ufs_exit(struct ufs_hba *hba) > > { > > struct exynos_ufs *ufs = ufshcd_get_variant(hba); > > > > + if (!ufs->phy_powered_on) > > + return; > > + > > phy_power_off(ufs->phy); > > phy_exit(ufs->phy); > > } > > Does this introduce a regression where initialization resources are leaked > if the driver is unbound while suspended? > Looking at exynos_ufs_suspend(), the PHY is powered off and phy_powered_on > is set to false, but phy_exit() is intentionally not called so the PHY > remains initialized: > exynos_ufs_suspend() > if (!ufshcd_is_link_active(hba) && ufs->phy_powered_on) { > phy_power_off(ufs->phy); > ufs->phy_powered_on = false; > } > If an unbind or fatal error occurs while in this suspended state, > exynos_ufs_exit() will see phy_powered_on as false and return immediately. > The initialization reference and any resources allocated by phy_init() > would never be released since phy_exit() is completely skipped. > [ ... ] I think I've been looking at this issue all wrong, not considering why the UFS HCD driver calls phy_exit() -> phy_init() at runtime and what can be done about that. I have replaced this patch with the one attached, which I will be sending for v8.