[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cb85942d-1f41-ee8c-c777-0c47336fb36c@collabora.com>
Date: Tue, 30 Aug 2022 11:46:05 +0200
From: AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>,
broonie@...nel.org, matthias.bgg@...il.com,
gregkh@...uxfoundation.org, neil@...wn.name, blogic@...nwrt.org
Cc: linux-spi@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 2/4] spi: mt7621: Use the devm_clk_get_enabled() helper to
simplify error handling
Il 27/08/22 13:42, Christophe JAILLET ha scritto:
> The devm_clk_get_enabled() helper:
> - calls devm_clk_get()
> - calls clk_prepare_enable() and registers what is needed in order to
> call clk_disable_unprepare() when needed, as a managed resource.
>
> This helper is well suited for cases where the clock would be kept
> prepared or enabled for the whole lifetime of the driver.
>
> This simplifies the error handling a lot.
>
> The order between spi_unregister_controller() (in the remove function) and
> the clk_disable_unprepare() (now handle by a managed resource) is kept
> the same.
> (see commit 46b5c4fb87ce ("spi: mt7621: Don't leak SPI master in probe
> error path") to see why it matters)
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> Reviewed-by: Matthias Brugger <matthias.bgg@...il.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
Powered by blists - more mailing lists