[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171104193731.GA751@lunn.ch>
Date: Sat, 4 Nov 2017 20:37:31 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Stefan Wahren <stefan.wahren@...e.com>
Cc: Florian Fainelli <f.fainelli@...il.com>,
Mark Rutland <mark.rutland@....com>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@...r.kernel.org>, Sean Wang <sean.wang@...iatek.com>,
Martin Kaiser <martin@...ser.cx>,
Herbert Xu <herbert@...dor.apana.org.au>,
Scott Branden <sbranden@...adcom.com>,
Ray Jui <rjui@...adcom.com>, Matt Mackall <mpm@...enic.com>,
Russell King <rmk+kernel@...linux.org.uk>,
Krzysztof Kozlowski <krzk@...nel.org>,
linux-kernel@...r.kernel.org, Eric Anholt <eric@...olt.net>,
Harald Freudenberger <freude@...ux.vnet.ibm.com>,
Rob Herring <robh+dt@...nel.org>,
"maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE..."
<bcm-kernel-feedback-list@...adcom.com>,
"open list:HARDWARE RANDOM NUMBER GENERATOR CORE"
<linux-crypto@...r.kernel.org>,
PrasannaKumar Muralidharan <prasannatsmkumar@...il.com>,
Steffen Trumtrar <s.trumtrar@...gutronix.de>,
"moderated list:BROADCOM BCM2835 ARM ARCHITECTURE"
<linux-arm-kernel@...ts.infradead.org>,
"moderated list:BROADCOM BCM2835 ARM ARCHITECTURE"
<linux-rpi-kernel@...ts.infradead.org>
Subject: Re: [PATCH 07/12] hwrng: bcm2835-rng: Manage an optional clock
Hi Florian
> > >> + /* 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)?
>
> 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()?
Andrew
Powered by blists - more mailing lists