RE: [PATCH V2 2/4] watchdog: Add i.MX7ULP watchdog support

From: Anson Huang
Date: Tue Aug 20 2019 - 22:27:43 EST


Hi, Guenter

> On Tue, Aug 20, 2019 at 08:31:55AM -0700, Guenter Roeck wrote:
> > On Mon, Aug 12, 2019 at 04:53:19PM +0800, Anson.Huang@xxxxxxx
> wrote:
> > > From: Anson Huang <Anson.Huang@xxxxxxx>
> > >
> > > The i.MX7ULP Watchdog Timer (WDOG) module is an independent timer
> > > that is available for system use.
> > > It provides a safety feature to ensure that software is executing as
> > > planned and that the CPU is not stuck in an infinite loop or
> > > executing unintended code. If the WDOG module is not serviced
> > > (refreshed) within a certain period, it resets the MCU.
> > >
> > > Add driver support for i.MX7ULP watchdog.
> > >
> > > Signed-off-by: Anson Huang <Anson.Huang@xxxxxxx>
> >
> > Reviewed-by: Guenter Roeck <linux@xxxxxxxxxxxx>
> >
>
> Wait, I have to withdraw that.
>
> With clk_prepare_enable(), you'll also need to call clk_disable_unprepare()
> on remove. An easy way to do this and keep the code simple would be:
>
> static void imx7ulp_wdt_clk_disable_unprepare(void *data) {
> clk_disable_unprepare(data);
> }
>
> static int imx7ulp_wdt_probe(...)
> {
> ...
> ret = clk_prepare_enable(imx7ulp_wdt->clk);
> if (ret)
> return ret;
> ret = devm_add_action_or_reset(dev,
> imx7ulp_wdt_clk_disable_unprepare);
> if (ret)
> return ret;
> ...
>

Ah, yes, I added the error handle but missed the remove case, thanks for your kindly
suggestion, please help review V3.

Thanks,
Anson.