From: Russell King - ARM Linux <linux@armlinux.org.uk>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: question about clk_get_parent
Date: Thu, 10 Nov 2016 23:53:51 +0000 [thread overview]
Message-ID: <20161110235350.GC1041@n2100.armlinux.org.uk> (raw)
In-Reply-To: <alpine.DEB.2.20.1611102149500.1970@hadrien>
On Thu, Nov 10, 2016 at 09:55:16PM +0100, Julia Lawall wrote:
> As far as I can see in the various definitions of clk_get_parent, they all
> return either NULL or a value stored in a structure field. But the
> documentation with the prototype in includ/linux/clk.h says that it
> returns a valid IS_ERR() condition containing errno. Are ERR_PTR values
> stored in the structure fields?
The API documentation (in clk.h) is correct. The API (from the user
perspective) considers invalid clocks to be the set of pointers for
which IS_ERR() is true.
By implication, valid clocks are those for which IS_ERR() returns
false.
Hence, in order for clk_get_parent() to indicate an error, it has to
return a pointer value which corresponds with IS_ERR() being true.
The question over the NULL clock pointer is left to the implementation
to decide whether it's an error or not as far as the API design goes,
but practically everyone treats it as "there is no clock" which is
entirely reasonable.
Also, remember from the clk API design point of view, users of the
API should never dereference the clk pointer, it is a cookie as far
as users should be concerned. (The clk structure was not available to
drivers in the early days.) Only clk implementations and clk drivers
should dereference, and these should not dereference anything but
their own clocks.
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
next prev parent reply other threads:[~2016-11-10 23:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-10 20:55 question about clk_get_parent Julia Lawall
2016-11-10 23:53 ` Russell King - ARM Linux [this message]
2016-11-11 7:19 ` Julia Lawall
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=20161110235350.GC1041@n2100.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=julia.lawall@lip6.fr \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox