Re: [PATCH] fpga: xilinx-pr-decoupler: Use devm_clk_get_prepared()

From: Xu Yilun

Date: Fri Jun 26 2026 - 13:23:15 EST


On Tue, Jun 23, 2026 at 04:31:28PM +0530, Pandey, Radhey Shyam wrote:
> > The driver keeps the "aclk" clock prepared but disabled in its idle
> > state, toggling only the atomic clk_enable()/clk_disable() around
> > register accesses in the bridge enable_set/enable_show callbacks.
> >
> > At probe time this was open-coded as clk_prepare_enable() immediately
> > followed by clk_disable(), leaving the clock prepared, with a matching
> > clk_unprepare() in the error path and in remove().
> >
> > devm_clk_get_prepared() expresses exactly this: it gets and prepares the
> > clock and unprepares it automatically on driver detach.
> >
> > Use it to drop the manual prepare/disable dance, the error-path
> > unprepare, and the now-empty clock teardown in remove().
> >
> > Signed-off-by: Michal Simek <michal.simek@xxxxxxx>
>
> Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xxxxxxx>

Reviewed-by: Xu Yilun <yilun.xu@xxxxxxxxx>

Will apply to for-next when 7.2-rc1 comes.