[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1423657177.31903.505.camel@linux.intel.com>
Date: Wed, 11 Feb 2015 14:19:37 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Russell King - ARM Linux <linux@....linux.org.uk>
Cc: Viresh Kumar <viresh.kumar@...aro.org>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Vinod Koul <vinod.koul@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
dmaengine@...r.kernel.org
Subject: Re: [PATCH] dmaengine: dw: support for clockless platforms
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@...el.com>
Intel Finland Oy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists