All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Vinod Koul <vinod.koul@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	dmaengine@vger.kernel.org
Subject: Re: [PATCH] dmaengine: dw: support for clockless platforms
Date: Wed, 11 Feb 2015 14:19:37 +0200	[thread overview]
Message-ID: <1423657177.31903.505.camel@linux.intel.com> (raw)
In-Reply-To: <20150211120727.GQ8656@n2100.arm.linux.org.uk>

On Wed, 2015-02-11 at 12:07 +0000, Russell King - ARM Linux wrote:
> On Wed, Feb 11, 2015 at 02:02:39PM +0200, Andy Shevchenko wrote:
> > On Wed, 2015-02-11 at 10:10 +0800, Viresh Kumar wrote:
> > > >         chip->clk = devm_clk_get(chip->dev, "hclk");
> > > > -       if (IS_ERR(chip->clk))
> > > > -               return PTR_ERR(chip->clk);
> > > > +       if (IS_ERR(chip->clk)) {
> > > > +               if (PTR_ERR(chip->clk) == -ENOENT)
> > > > +                       chip->clk = NULL;
> > > 
> > > You don't need to set it to NULL, if CONFIG_HAVE_CLK isn't set
> > > the dummy routines would take care of it.
> > 
> > Yeah, but in our case we have CONFIG_HAVE_CLK=y and no clk is provided
> > since IP is clockless. What could you suggest to do in such case?
> 
> 	chip->clk = devm_clk_get(chip->dev, "hclk");
> 	if (IS_ERR(chip->clk) && PTR_ERR(chip->clk) != -ENOENT)
> 		return PTR_ERR(chip->clk);
> 
> You can then test for the presence of a clk via IS_ERR(chip->clk).
> 
> I'm just debating whether we should add a clk_is_valid() inline function
> to linux/clk.h to avoid these shouting tests, and make it easier for
> people test this in a generic manner.

I guess clock framework may handle whatever is gotten from clk_get(). 
In driver much cleaner to use direct calls with exceptions (like you
can't get a valid clock rate from non-existing clock).
So, what about just passing by the error code and doing nothing?

-- 
Andy Shevchenko <andriy.shevchenko@intel.com>
Intel Finland Oy


      reply	other threads:[~2015-02-11 12:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-20 12:57 [PATCH] dmaengine: dw: support for clockless platforms Heikki Krogerus
2015-01-20 14:18 ` Andy Shevchenko
2015-02-11  1:20 ` Vinod Koul
2015-02-11  2:10 ` Viresh Kumar
2015-02-11 12:02   ` Andy Shevchenko
2015-02-11 12:07     ` Russell King - ARM Linux
2015-02-11 12:19       ` Andy Shevchenko [this message]

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=1423657177.31903.505.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=vinod.koul@intel.com \
    --cc=viresh.kumar@linaro.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.