[PATCH v17 2/6] spi: pxa2xx: introduce clock enable and disable helper functions

Andy Shevchenko andriy.shevchenko at linux.intel.com
Thu Oct 1 00:13:17 PDT 2026


On Thu, Oct 01, 2026 at 12:06:25AM +0800, Shih-Yuan Lee wrote:
> The driver enables and disables the SOC clock during probe, teardown,

The correct spelling of this acronym is SoC (System on Chip).

> and power management callbacks. Directly calling clk_disable_unprepare()
> when the clock is already disabled—such as when removing a device that
> is runtime-suspended—causes an unbalanced clock disable warning from the
> Common Clock Framework.
> 
> Introduce pxa2xx_spi_clk_enable() and pxa2xx_spi_clk_disable() helper
> functions that track the clock state with a 'clk_enabled' boolean flag
> protected by a 'clk_lock' mutex in struct driver_data. These helpers
> make clock toggling idempotent: repeated enable or disable invocations
> are safe no-ops serialized by clk_lock.
> 
> Convert probe, remove, suspend, resume, and runtime PM callbacks to use
> these helpers instead of direct clk_prepare_enable() and
> clk_disable_unprepare() calls.
> 
> Pack 'clk_enabled' immediately after 'n_bytes' into the existing
> padding hole in struct driver_data, avoiding additional alignment
> padding.
> 
> Assisted-by: Antigravity:gemini-3.8-flash sparse

Assisted-by: LLM

...

Yeah, as Mark asked this change is quite doubtful. Is this a hallucination of
LLM?

-- 
With Best Regards,
Andy Shevchenko





More information about the linux-arm-kernel mailing list