All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Guenter Roeck <linux@roeck-us.net>,
	Sergey Semin <Sergey.Semin@baikalelectronics.ru>
Cc: Michael Turquette <mturquette@baylibre.com>,
	Wim Van Sebroeck <wim@linux-watchdog.org>,
	Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Paul Burton <paulburton@kernel.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/7] watchdog: dw_wdt: Support devices with asynch clocks
Date: Mon, 13 Apr 2020 13:52:51 -0700	[thread overview]
Message-ID: <158681117129.84447.14839907555361565766@swboyd.mtv.corp.google.com> (raw)
In-Reply-To: <20200410185934.o4aucef2xhbradlp@ubsrv2.baikal.int>

Quoting Sergey Semin (2020-04-10 11:59:34)
> Michael, Stephen, could you take a look at the issue we've got here?
> 
> Guenter, my comment is below.
> 
> On Sun, Mar 15, 2020 at 07:22:07AM -0700, Guenter Roeck wrote:
> > On Fri, Mar 06, 2020 at 04:27:45PM +0300, Sergey.Semin@baikalelectronics.ru wrote:
> > > @@ -358,10 +375,27 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
> > >             goto out_disable_clk;
> > >     }
> > >  
> > > +   /*
> > > +    * Request APB clocks if device is configured with async clocks mode.
> > > +    * In this case both tclk and pclk clocks are supposed to be specified.
> > > +    * Alas we can't know for sure whether async mode was really activated,
> > > +    * so the pclk reference is left optional. If it it's failed to be
> > > +    * found we consider the device configured in synchronous clocks mode.
> > > +    */
> > > +   dw_wdt->pclk = devm_clk_get_optional(dev, "pclk");
> > > +   if (IS_ERR(dw_wdt->pclk)) {
> > > +           ret = PTR_ERR(dw_wdt->pclk);
> > > +           goto out_disable_clk;
> > > +   }
> > > +
> > > +   ret = clk_prepare_enable(dw_wdt->pclk);
> > 
> > Not every implementation of clk_enable() checks for a NULL parameter.
> > Some return an error. This can not be trusted to work on all platforms /
> > architectures.
> 
> Hm, this was unexpected twist. I've submitted not a single patch with optional
> clock API usage. It was first time I've got a comment like this, that the
> API isn't cross-platform. As I see it this isn't the patch problem, but the
> platforms/common clock bug. The platforms code must have been submitted before
> the optional clock API was introduced or the API hasn't been properly
> implemented or we don't understand something.
> 
> Stephen, Michael could you clarify the situation with the
> cross-platformness of the optional clock API.
> 

NULL is a valid clk to return from clk_get(). And the documentation of
clk_enable() says that "If the clock can not be enabled/disabled, this
should return success". Given that a NULL pointer can't do much of
anything I think any platform that returns an error in this situation is
deviating from the documentation of the clk API.

Does any platform that uses this driver use one of these non-common clk
framework implementations? All of this may not matter if they all use
the CCF.

  reply	other threads:[~2020-04-13 20:52 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200306132747.14701-1-Sergey.Semin@baikalelectronics.ru>
2020-03-06 13:27 ` [PATCH 1/7] dt-bindings: watchdog: dw-wdt: Replace legacy bindings file with YAML-based one Sergey.Semin
2020-03-06 15:18   ` Guenter Roeck
     [not found]   ` <20200306151839.374AA80307C2@mail.baikalelectronics.ru>
2020-04-07 17:48     ` Sergey Semin
2020-03-06 13:27 ` [PATCH 2/7] dt-bindings: watchdog: dw-wdt: Add watchdog TOPs array property Sergey.Semin
2020-03-12 22:22   ` Rob Herring
2020-03-06 13:27 ` [PATCH 3/7] watchdog: watchdog_dev: Use generic msec-per-sec macro Sergey.Semin
2020-03-06 15:20   ` Guenter Roeck
     [not found]   ` <20200306152033.4444780307C4@mail.baikalelectronics.ru>
2020-04-09 18:56     ` Sergey Semin
2020-03-06 13:27 ` [PATCH 4/7] watchdog: dw_wdt: Support devices with non-fixed TOP values Sergey.Semin
2020-03-15 14:12   ` Guenter Roeck
2020-04-10 12:59     ` Sergey Semin
2020-04-10 16:21       ` Guenter Roeck
2020-04-10 19:45         ` Sergey Semin
2020-04-11  1:15           ` Guenter Roeck
2020-04-11 11:10             ` Sergey Semin
2020-03-06 13:27 ` [PATCH 5/7] watchdog: dw_wdt: Support devices with asynch clocks Sergey.Semin
2020-03-15 14:22   ` Guenter Roeck
2020-04-10 18:59     ` Sergey Semin
2020-04-13 20:52       ` Stephen Boyd [this message]
2020-04-14  2:55         ` Guenter Roeck
2020-04-14 10:01           ` Sergey Semin
2020-03-06 13:27 ` [PATCH 6/7] watchdog: dw_wdt: Add pre-timeouts support Sergey.Semin
2020-03-06 15:14   ` Guenter Roeck
     [not found]   ` <20200306151455.7470180307C4@mail.baikalelectronics.ru>
2020-04-10 19:04     ` Sergey Semin
2020-03-06 13:27 ` [PATCH 7/7] watchdog: dw_wdt: Add DebugFS files Sergey.Semin
2020-03-06 15:12   ` Guenter Roeck
     [not found]   ` <20200306151248.DE1EC80307C4@mail.baikalelectronics.ru>
2020-04-10 19:12     ` Sergey Semin
2020-03-10  0:32 ` [PATCH 0/7] watchdog: dw_wdt: Take Baikal-T1 DW WDT peculiarities into account Sergey Semin

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=158681117129.84447.14839907555361565766@swboyd.mtv.corp.google.com \
    --to=sboyd@kernel.org \
    --cc=Alexey.Malahov@baikalelectronics.ru \
    --cc=Sergey.Semin@baikalelectronics.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mturquette@baylibre.com \
    --cc=paulburton@kernel.org \
    --cc=ralf@linux-mips.org \
    --cc=tsbogend@alpha.franken.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.