Re: [PATCH] mmc: omap: synchronize clock timer before disabling fclk

From: Runyu Xiao

Date: Sun Oct 04 2026 - 05:32:36 EST


Hi Ulf,

On Wed, Sep 30, 2026 at 06:01:02PM +0200, Ulf Hansson wrote:

> On Tue, Sep 29, 2026 at 08:45:22PM +0800, Runyu Xiao wrote:
>
> > @@ -214,7 +214,7 @@ static void mmc_omap_select_slot(struct mmc_omap_slot *slot, int claimed)
> > - timer_delete(&host->clk_timer);
> > + timer_delete_sync(&host->clk_timer);
>
> At a first glance this looks fine, but I am slightly worried that this
> could deadlock. Have you verified that?
>
> > @@ -273,7 +273,7 @@ static void mmc_omap_release_slot(struct mmc_omap_slot *slot, int clk_enabled)
> > - timer_delete(&host->clk_timer);
> > + timer_delete_sync(&host->clk_timer);
>
> Ditto.

I checked the locking and calling contexts for both changes.

mmc_omap_clk_timer() only takes host->clk_lock. Neither timer_delete_sync()
call site holds that lock; mmc_omap_select_slot() has released slot_lock,
and mmc_omap_release_slot() calls it before taking slot_lock.

The interrupt completion paths pass clk_enabled == 1 and use mod_timer(), so
timer_delete_sync() is reached only from process or workqueue context. I do
not see a lock inversion or a timer_delete_sync() deadlock in these paths.

Kind regards,
Runyu