From: Felipe Balbi <balbi@ti.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Felipe Balbi <balbi@ti.com>, Greg KH <gregkh@linuxfoundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux ARM Kernel Mailing List
<linux-arm-kernel@lists.infradead.org>,
<linux-pm@vger.kernel.org>,
Linux OMAP Mailing List <linux-omap@vger.kernel.org>,
Tony Lindgren <tony@atomide.com>,
Kevin Hilman <khilman@linaro.org>, Tero Kristo <t-kristo@ti.com>
Subject: Re: [RFC/PATCH] base: platform: add generic clock handling for platform-bus
Date: Fri, 31 Jan 2014 15:32:05 -0600 [thread overview]
Message-ID: <20140131213205.GB2502@saruman.home> (raw)
In-Reply-To: <20140131200434.GR27282@n2100.arm.linux.org.uk>
[-- Attachment #1: Type: text/plain, Size: 1637 bytes --]
Hi,
On Fri, Jan 31, 2014 at 08:04:35PM +0000, Russell King - ARM Linux wrote:
> On Fri, Jan 31, 2014 at 12:12:45PM -0600, Felipe Balbi wrote:
> > diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> > index 3a94b79..86aeb5b 100644
> > --- a/drivers/base/platform.c
> > +++ b/drivers/base/platform.c
> > @@ -484,6 +484,21 @@ static int platform_drv_probe(struct device *_dev)
> > if (ACPI_HANDLE(_dev))
> > acpi_dev_pm_attach(_dev, true);
> >
> > + dev->fck = devm_clk_get(_dev, "fck");
> > + dev->ick = devm_clk_get(_dev, "ick");
> > +
> > + if (!IS_ERR(dev->fck))
> > + clk_prepare_enable(dev->fck);
> > + else
> > + dev->fck = NULL;
> > +
> > + if (!IS_ERR(dev->ick))
> > + clk_prepare_enable(dev->ick);
> > + else
> > + dev->ick = NULL;
>
> If people are going to continue doing this (converting error values to
> NULL) can we please have a check in devm_clk_get() which prevents it
> returning NULL if the implementation happens to do so?
>
> It's either that or we force all users to conform to the API which
> specifies that the error values are defined by IS_ERR() returning
> true and everything else must be considered as a potential valid return.
The idea here was just to avoid IS_ERR() checks every time we want to
enable/disable a clock since clk API already copes with NULL pointers.
This also helps with the fact that platform_bus is also used with
platforms which don't have (or otherwise don't need) any clock control
whatsoever, thus made it optional.
If everybody prefers duplication of IS_ERR() all over the place, that's
fine too.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2014-01-31 21:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-31 18:12 [RFC/PATCH] base: platform: add generic clock handling for platform-bus Felipe Balbi
2014-01-31 20:04 ` Russell King - ARM Linux
2014-01-31 21:32 ` Felipe Balbi [this message]
2014-01-31 21:34 ` Alan Stern
2014-01-31 21:44 ` Felipe Balbi
2014-03-12 15:37 ` Laurent Pinchart
2014-03-28 13:20 ` Geert Uytterhoeven
2014-03-28 14:41 ` Felipe Balbi
2014-03-28 14:42 ` Felipe Balbi
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=20140131213205.GB2502@saruman.home \
--to=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=khilman@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=t-kristo@ti.com \
--cc=tony@atomide.com \
/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).