From: Leela Krishna Amudala <l.krishna@samsung.com>
To: Doug Anderson <dianders@chromium.org>, Wim Van Sebroeck <wim@iguana.be>
Cc: Leela Krishna Amudala <l.krishna@samsung.com>,
linux-samsung-soc <linux-samsung-soc@vger.kernel.org>,
Kukjin Kim <kgene.kim@samsung.com>,
Tomasz Figa <t.figa@samsung.com>,
devicetree@vger.kernel.org, linux-watchdog@vger.kernel.org,
"cpgs ." <cpgs@samsung.com>,
Sachin Kamat <sachin.kamat@linaro.org>,
Guenter Roeck <linux@roeck-us.net>
Subject: Re: [PATCH V9 2/3] watchdog: s3c2410_wdt: use syscon regmap interface to configure pmu register
Date: Tue, 26 Nov 2013 18:01:02 +0530 [thread overview]
Message-ID: <CAL1wa8eAUKkDA41A-9HTc+=iPbGFrkQUXPMtkNFbH4Y9y-b0tA@mail.gmail.com> (raw)
In-Reply-To: <CAD=FV=W+PNhUY+KC6DoMqRuEQFsgdffP466x=VTdGR-3L8ibFQ@mail.gmail.com>
Hi Doug,
Thanks for reviewing the patch series.
On Tue, Nov 26, 2013 at 4:14 AM, Doug Anderson <dianders@chromium.org> wrote:
>
> Hi Leela Krishna,
>
> On Mon, Nov 18, 2013 at 1:49 AM, Leela Krishna Amudala
> <l.krishna@samsung.com> wrote:
> > Add device tree support for exynos5250 and 5420 SoCs and use syscon regmap interface
> > to configure AUTOMATIC_WDT_RESET_DISABLE and MASK_WDT_RESET_REQUEST registers of PMU
> > to mask/unmask enable/disable of watchdog in probe and s2r scenarios.
> >
> > Signed-off-by: Leela Krishna Amudala <l.krishna@samsung.com>
> > ---
> > .../devicetree/bindings/watchdog/samsung-wdt.txt | 21 ++-
> > drivers/watchdog/Kconfig | 1 +
> > drivers/watchdog/s3c2410_wdt.c | 145 ++++++++++++++++++--
> > 3 files changed, 157 insertions(+), 10 deletions(-)
>
> ...
>
> > +struct s3c2410_wdt_variant {
> > + int disable_reg;
> > + int mask_reset_reg;
> > + int mask_bit;
> > + u32 quirks;
> > +};
>
> Ideally you could add descriptions. I added them in a patch based on
> yours <https://chromium-review.googlesource.com/#/c/177935/1/drivers/watchdog/s3c2410_wdt.c>,
> but since yours hasn't landed perhaps you can do it directly?
>
> /**
> * struct s3c2410_wdt_variant - Per-variant config data
> *
> * @disable_reg: Offset in pmureg for the register that disables the watchdog
> * timer reset functionality.
> * @mask_reset_reg: Offset in pmureg for the register that masks the watchdog
> * timer reset functionality.
> * @mask_bit: Bit number for the watchdog timer in the disable register and the
> * mask reset register.
> * @quirks: A bitfield of quirks.
> */
>
Okay, Added the above descriptions
> > +
> > struct s3c2410_wdt {
> > struct device *dev;
> > struct clk *clock;
> > @@ -94,7 +107,49 @@ struct s3c2410_wdt {
> > unsigned long wtdat_save;
> > struct watchdog_device wdt_device;
> > struct notifier_block freq_transition;
> > + struct s3c2410_wdt_variant *drv_data;
> > + struct regmap *pmureg;
>
> Total nit, but everything else in this structure is tab aligned and
> your new elements are not.
>
Me and Tomasz had a discussion about it and he replied for this comment
> > static int s3c2410wdt_probe(struct platform_device *pdev)
> > {
> > struct device *dev;
> > @@ -354,6 +443,16 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
> > spin_lock_init(&wdt->lock);
> > wdt->wdt_device = s3c2410_wdd;
> >
> > + wdt->drv_data = get_wdt_drv_data(pdev);
> > + if (wdt->drv_data->quirks & QUIRK_NEEDS_PMU_CONFIG) {
> > + wdt->pmureg = syscon_regmap_lookup_by_phandle(dev->of_node,
> > + "samsung,syscon-phandle");
> > + if (IS_ERR(wdt->pmureg)) {
> > + dev_err(dev, "syscon regmap lookup failed.\n");
> > + return PTR_ERR(wdt->pmureg);
>
> nit: this function appears to never call "return" directly. You'll
> match other error handling better if you do:
>
> ret = PTR_ERR(wdt->pmureg);
> goto err;
>
> (if someone else has already said they don't like that, just ignore me).
>
Will consider Tomasz suggestion for this
> > + }
> > + }
> > +
> > wdt_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> > if (wdt_irq == NULL) {
> > dev_err(dev, "no irq resource specified\n");
> > @@ -444,6 +543,14 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
> > (wtcon & S3C2410_WTCON_RSTEN) ? "en" : "dis",
> > (wtcon & S3C2410_WTCON_INTEN) ? "en" : "dis");
> >
> > + if (wdt->drv_data->quirks & QUIRK_NEEDS_PMU_CONFIG) {
> > + ret = s3c2410wdt_mask_and_disable_reset(wdt, false);
> > + if (ret < 0) {
> > + dev_err(wdt->dev, "failed to update pmu register");
> > + goto err_cpufreq;
> > + }
> > + }
>
> There are a few minor problems here:
>
> 1. You're putting a potential failure condition _after_ printing that
> the watchdog is enabled. You should put your code above the
> "dev_info".
>
Yes moved it like below
static int s3c2410wdt_probe(struct platform_device *pdev)
{
[snip]
if (tmr_atboot && started == 0) {
dev_info(dev, "starting watchdog timer\n");
s3c2410wdt_start(&wdt->wdt_device);
}
[snip]
> 2. Error handling doesn't seem quite right. If you fail here you'll
> be returning an error but you might have started the watchdog already.
> Perhaps you should be moving the "mask_and_disable" up a little and
> then you an undo it if needed?
>
Above mentioned comment will take care of this
> 3. I think it would be fine to put the "dev_err" directly in the
> s3c2410wdt_mask_and_disable_reset() as per Guenter, but still return
> the error code. You'll still use the error code here, right?
>
Yes, used dev_err and moved it into s3c2410wdt_mask_and_disable_reset()
and removed the dev_err message in the if (ret < 0) check
> > +
> > return 0;
> >
> > err_cpufreq:
> > @@ -459,8 +566,15 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
> >
> > static int s3c2410wdt_remove(struct platform_device *dev)
> > {
> > + int ret;
> > struct s3c2410_wdt *wdt = platform_get_drvdata(dev);
> >
> > + if (wdt->drv_data->quirks & QUIRK_NEEDS_PMU_CONFIG) {
> > + ret = s3c2410wdt_mask_and_disable_reset(wdt, true);
>
> This function does return an error. Why not pass the error on
> through? The system wouldn't be in such a stellar state, but if
> regmap is failing it's probably pretty bad anyway...
>
>
Yes, returning the error here and doing the same in other functions also
like suspend and resume
Will post the next version tomorrow
Best Wishes,
Leela Krishna.
>
> Nothing here is terrible and I wouldn't be upset if you landed these
> as-is, but since it seems that Guenter is requesting a spin. Perhaps
> you could address my comments, too?
>
>
> -Doug
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-11-26 12:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-18 9:49 [PATCH V9 0/3] Add watchdog DT nodes and use syscon regmap interface to configure pmu registers Leela Krishna Amudala
2013-11-18 9:49 ` [PATCH V9 1/3] ARM: dts: Add pmu sysreg node to exynos5250 and exynos5420 dtsi files Leela Krishna Amudala
2013-11-25 22:24 ` Doug Anderson
2013-11-18 9:49 ` [PATCH V9 2/3] watchdog: s3c2410_wdt: use syscon regmap interface to configure pmu register Leela Krishna Amudala
2013-11-18 16:42 ` Guenter Roeck
2013-11-19 4:36 ` Leela Krishna Amudala
2013-11-19 5:00 ` Guenter Roeck
2013-11-19 5:26 ` Leela Krishna Amudala
2013-11-19 7:02 ` Guenter Roeck
2013-11-25 22:44 ` Doug Anderson
2013-11-26 0:12 ` Tomasz Figa
2013-11-26 12:31 ` Leela Krishna Amudala [this message]
2013-11-18 9:49 ` [PATCH V9 3/3] ARM: dts: update watchdog device nodes for Exynos5250 and Exynos5420 Leela Krishna Amudala
[not found] ` <1384768189-2839-4-git-send-email-l.krishna-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-11-25 22:46 ` Doug Anderson
2013-11-18 11:05 ` [PATCH V9 0/3] Add watchdog DT nodes and use syscon regmap interface to configure pmu registers Tomasz Figa
2013-11-21 5:19 ` Leela Krishna Amudala
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='CAL1wa8eAUKkDA41A-9HTc+=iPbGFrkQUXPMtkNFbH4Y9y-b0tA@mail.gmail.com' \
--to=l.krishna@samsung.com \
--cc=cpgs@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=dianders@chromium.org \
--cc=kgene.kim@samsung.com \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=sachin.kamat@linaro.org \
--cc=t.figa@samsung.com \
--cc=wim@iguana.be \
/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).