lkml.org 
[lkml]   [2018]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 7/8] net: phy: Add support to configure clock in Broadcom iProc mdio mux
On Wed, Aug 01, 2018 at 09:23:14PM +0100, Russell King - ARM Linux wrote:
> On Wed, Aug 01, 2018 at 10:07:12PM +0200, Andrew Lunn wrote:
> > You might want to consider adding clk_optional_get() and
> > devm_clk_optional_get().
>
> I think there's attempts to add such APIs but I don't think it's
> trivial - it seems to require a _lot_ of discussion.
>
> I think part of that is because of the quirky use of error codes.
> If you look at clk_get(), it calls __of_clk_get_by_name() which
> returns:
>
> -ENOENT if DT is disabled
> -ENOENT if the device has no DT node
> -EPROBE_DEFER if the lookup in DT succeeds but there's no registered
> clock
> -EINVAL if the device has a DT node but the lookup of the name
> failed (in otherwords, the optional clock was omitted)
> -ENOENT if the clocks = property has not enough clocks for the
> clock-names property
> -ENOMEM if we fail to allocate the clk
> -ENOENT if __clk_get() fails

That makes it hard. I added phy_optional_get() early on, when the
error cases were simple. Hopefully they remain simple...

Andrew

\
 
 \ /
  Last update: 2018-08-01 22:39    [W:0.123 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site