linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Linux Watchdog Mailing List <linux-watchdog@vger.kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Chris Paterson <Chris.Paterson2@renesas.com>,
	Biju Das <biju.das@bp.renesas.com>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH v4 4/6] watchdog: rzg2l_wdt: Add error check for reset_control_deassert
Date: Thu, 24 Feb 2022 10:34:42 +0100	[thread overview]
Message-ID: <CAMuHMdV80cvBCP-zOH-opy5hviXZiO6Xf43RCF-ah9kZXgPdAQ@mail.gmail.com> (raw)
In-Reply-To: <20220223160100.23543-5-biju.das.jz@bp.renesas.com>

Hi Biju,

On Wed, Feb 23, 2022 at 5:01 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> If reset_control_deassert() fails, then we won't be able to
> access the device registers. Therefore check the return code of
> reset_control_deassert() and bailout in case of error.
>
> While at it change reset_control_assert->reset_control_reset in
> rzg2l_wdt_stop() and remove unnecessary reset_control_deassert()
> from rzg2l_wdt_start().
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>

Thanks for your patch!

> --- a/drivers/watchdog/rzg2l_wdt.c
> +++ b/drivers/watchdog/rzg2l_wdt.c
> @@ -88,7 +88,6 @@ static int rzg2l_wdt_start(struct watchdog_device *wdev)
>  {
>         struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
>
> -       reset_control_deassert(priv->rstc);

So before, we had a reset control imbalance?
  - After probe, reset was deasserted.
  - After start, reset was deasserted twice. Oops.
You probably want to mention this in the commit description, too.

>         pm_runtime_get_sync(wdev->parent);
>
>         /* Initialize time out */
> @@ -108,7 +107,7 @@ static int rzg2l_wdt_stop(struct watchdog_device *wdev)
>         struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
>
>         pm_runtime_put(wdev->parent);
> -       reset_control_assert(priv->rstc);
> +       reset_control_reset(priv->rstc);

As the reset is now deasserted after probe(), stop(), and start(),
I think the reset_control_reset() in .restart() can now be removed?

>
>         return 0;
>  }
> @@ -204,7 +203,10 @@ static int rzg2l_wdt_probe(struct platform_device *pdev)
>                 return dev_err_probe(&pdev->dev, PTR_ERR(priv->rstc),
>                                      "failed to get cpg reset");
>
> -       reset_control_deassert(priv->rstc);
> +       ret = reset_control_deassert(priv->rstc);
> +       if (ret)
> +               return dev_err_probe(dev, ret, "failed to deassert");
> +
>         pm_runtime_enable(&pdev->dev);
>
>         priv->wdev.info = &rzg2l_wdt_ident;

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2022-02-24  9:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-23 16:00 [PATCH v4 0/6] RZG2L_WDT Fixes and Improvements Biju Das
2022-02-23 16:00 ` [PATCH v4 1/6] watchdog: rzg2l_wdt: Fix 32bit overflow issue Biju Das
2022-02-23 16:00 ` [PATCH v4 2/6] watchdog: rzg2l_wdt: Fix Runtime PM usage Biju Das
2022-02-24  9:24   ` Geert Uytterhoeven
2022-02-23 16:00 ` [PATCH v4 3/6] watchdog: rzg2l_wdt: Fix 'BUG: Invalid wait context' Biju Das
2022-02-24  9:45   ` Geert Uytterhoeven
2022-02-23 16:00 ` [PATCH v4 4/6] watchdog: rzg2l_wdt: Add error check for reset_control_deassert Biju Das
2022-02-24  9:34   ` Geert Uytterhoeven [this message]
2022-02-24 11:03     ` Biju Das
2022-02-23 16:00 ` [PATCH v4 5/6] watchdog: rzg2l_wdt: Use force reset for WDT reset Biju Das
2022-02-24  9:37   ` Geert Uytterhoeven
2022-02-24  9:51     ` Biju Das
2022-02-24  9:54       ` Geert Uytterhoeven
2022-02-23 16:01 ` [PATCH v4 6/6] watchdog: rzg2l_wdt: Add set_timeout callback Biju Das
2022-02-24  9:41   ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMuHMdV80cvBCP-zOH-opy5hviXZiO6Xf43RCF-ah9kZXgPdAQ@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=Chris.Paterson2@renesas.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=biju.das@bp.renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=p.zabel@pengutronix.de \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).