From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>,
Mark Rutland <mark.rutland@arm.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Herbert Xu <herbert@gondor.apana.org.au>,
Pawel Moll <pawel.moll@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
Rob Herring <robh+dt@kernel.org>,
linux-crypto@vger.kernel.org,
Sascha Hauer <kernel@pengutronix.de>,
Matt Mackall <mpm@selenic.com>, Shawn Guo <shawnguo@kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 3/3] hwrng: mxc-fsl - add support for Freescale RNGC
Date: Mon, 7 Mar 2016 14:03:04 +0100 [thread overview]
Message-ID: <20160307130304.GA791@pengutronix.de> (raw)
In-Reply-To: <20160301074937.GU2613@pengutronix.de>
Hi!
On Tue, Mar 01, 2016 at 08:49:37AM +0100, Uwe Kleine-König wrote:
> Hello Fabio,
>
> On Mon, Feb 29, 2016 at 08:54:19PM -0300, Fabio Estevam wrote:
> > On Mon, Feb 29, 2016 at 6:38 PM, Uwe Kleine-König
> > <u.kleine-koenig@pengutronix.de> wrote:
> > > On Mon, Feb 29, 2016 at 06:16:50PM -0300, Fabio Estevam wrote:
> > >> On Mon, Feb 29, 2016 at 12:52 PM, Steffen Trumtrar
> > >> <s.trumtrar@pengutronix.de> wrote:
> > >>
> > >> > + ret = clk_prepare_enable(rngc->clk);
> > >> > + if (ret)
> > >> > + return ret;
> > >> > +
> > >> > + rngc->irq = platform_get_irq(pdev, 0);
> > >> > + if (!rngc->irq) {
> > >> > + dev_err(&pdev->dev, "FSL RNGC couldn't get irq\n");
> > >> > + clk_disable_unprepare(rngc->clk);
> > >> > +
> > >> > + return ret;
> > >>
> > >> You are returning the wrong error code here:
> > >>
> > >> Better do like this:
> > >>
> > >> rngc->irq = platform_get_irq(pdev, 0);
> > >> if (rngc->irq < 0) {
> > >
> > > rngc->irq is unsigned, so this is never true.
> > >
> > >> dev_err(&pdev->dev, "FSL RNGC couldn't get irq\n");
> > >> clk_disable_unprepare(rngc->clk);
> > >> return rngc->irq;
> > >> }
> > >
> > > So here comes my better approach:
> >
> > As irq is only used inside probe it can be removed from struct mxc_rngc.
>
> Good idea.
>
Actually it is currently used in the mxc_rngc_init function, but I think I can
just move the call there into the probe function and get rid of the irq in the
struct.
> > Or maybe like this:
> >
> > ret = platform_get_irq(pdev, 0);
> > if (ret < 0) {
> > dev_err(&pdev->dev, "FSL RNGC couldn't get irq\n");
> > clk_disable_unprepare(rngc->clk);
> > return ret;
> > }
>
This looks better, yes. I will change that, of course.
> Some people think platform_get_irq returning 0 should be handled as
> error.
And who is right? drivers/of/unittest.c checks for irq < 0 for example.
Thanks,
Steffen
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2016-03-07 13:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-29 15:52 [PATCH 1/3] Documentation: devicetree: add Freescale RNGC binding Steffen Trumtrar
2016-02-29 15:52 ` [PATCH 2/3] ARM: i.MX25: add RNGC node to dtsi Steffen Trumtrar
2016-03-01 13:37 ` Shawn Guo
2016-02-29 15:52 ` [PATCH 3/3] hwrng: mxc-fsl - add support for Freescale RNGC Steffen Trumtrar
2016-02-29 21:16 ` Fabio Estevam
2016-02-29 21:38 ` Uwe Kleine-König
[not found] ` <20160229213850.GS2613-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2016-02-29 23:54 ` Fabio Estevam
2016-03-01 7:49 ` Uwe Kleine-König
2016-03-07 13:03 ` Steffen Trumtrar [this message]
2016-03-03 23:56 ` [PATCH 1/3] Documentation: devicetree: add Freescale RNGC binding Rob Herring
-- strict thread matches above, loose matches on Subject: below --
2016-03-11 14:06 [PATCH v2 " Steffen Trumtrar
2017-07-17 21:16 ` [PATCH v3 " Martin Kaiser
[not found] ` <1500326163-4556-1-git-send-email-martin-XxZfDwE/svGeZLLa646FqQ@public.gmane.org>
2017-07-17 21:16 ` [PATCH 3/3] hwrng: mxc-fsl - add support for Freescale RNGC Martin Kaiser
2017-07-18 5:49 ` PrasannaKumar Muralidharan
2017-07-19 21:22 ` Martin Kaiser
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=20160307130304.GA791@pengutronix.de \
--to=s.trumtrar@pengutronix.de \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=galak@codeaurora.org \
--cc=herbert@gondor.apana.org.au \
--cc=ijc+devicetree@hellion.org.uk \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mpm@selenic.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=shawnguo@kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
/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).