Thread (31 messages) 31 messages, 6 authors, 2017-11-07

[PATCH 07/12] hwrng: bcm2835-rng: Manage an optional clock

From: linux@armlinux.org.uk (Russell King - ARM Linux)
Date: 2017-11-04 20:08:39
Also in: linux-crypto, linux-devicetree, lkml

On Sat, Nov 04, 2017 at 08:37:31PM +0100, Andrew Lunn wrote:
Hi Florian
quoted
quoted
quoted
quoted
+	/* Clock is optional on most platforms */
+	priv->clk = devm_clk_get(dev, NULL);
+	if (IS_ERR(priv->clk))
+		priv->clk = NULL;
at least in case of EPROBE_DEFERED this isn't the expected behavior. Maybe we should better trigger on non-existing clock?
Good point, so more like:

if (IS_ERR(priv->clk) && PTR_ERR(priv->clk) == -ENODEV)?
quoted
Unfortunately we need to return the error in all other cases. Please
take a look at devm_usb_get_phy in dwc2 [1]. AFAIK we don't need to
take care of ENXIO in our case.
A few subsystems have a get_optional() call, e.g.
devm_phy_optional_get(). It does not return an error when the phy is
not supposed to exist, but in all other cases, it does.

Maybe consider adding devm_clk_get_optional()?
The clk API outside of DT doesn't have knowledge of when it's "complete"
to be able to determine whether the clock is not present or temporarily
missing.  I've already NAK'd this suggestion.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help