linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leonard Crestez <leonard.crestez@nxp.com>
To: "festevam@gmail.com" <festevam@gmail.com>
Cc: dl-linux-imx <linux-imx@nxp.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Fabio Estevam <fabio.estevam@nxp.com>,
	Aymen Sghaier <aymen.sghaier@nxp.com>,
	Franck Lenormand <franck.lenormand@nxp.com>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	Horia Geanta <horia.geanta@nxp.com>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"herbert@gondor.apana.org.au" <herbert@gondor.apana.org.au>,
	"marek.vasut@gmail.com" <marek.vasut@gmail.com>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>
Subject: Re: [PATCH v3 2/4] crypto: mxs-dcp - Add support for dcp clk
Date: Tue, 16 Oct 2018 17:23:11 +0000	[thread overview]
Message-ID: <f88233e6a76e99f95f6611bccdf234681e84f7ce.camel@nxp.com> (raw)
In-Reply-To: <CAOMZO5Ck846zd_Xo=9sVK0EAxNLsUsWiC59H2Ms6x8xoD8iwWw@mail.gmail.com>

On Tue, 2018-10-16 at 13:03 -0300, Fabio Estevam wrote:
> > +       /* DCP clock is optional, only used on some SOCs */
> > +       sdcp->dcp_clk = devm_clk_get(dev, "dcp");
> > +       if (IS_ERR(sdcp->dcp_clk)) {
> > +               if (sdcp->dcp_clk != ERR_PTR(-ENOENT))
> > +                       return PTR_ERR(sdcp->dcp_clk);
> > +               sdcp->dcp_clk = NULL;
> 
> This dcp_clk assignment to NULL does not seem to be necessary.

The clk API ignores all calls if clk == NULL (which is very nice) but
not if IS_ERR(clk). Setting dcp_clk to NULL avoids sprinkling other
checks.

> > +       ret = clk_prepare_enable(sdcp->dcp_clk);
> > +       if (ret)
> > +               return ret;
> > 
> >         ret = devm_request_irq(dev, dcp_vmi_irq, mxs_dcp_irq, 0,
> >                                "dcp-vmi-irq", sdcp);
> >         if (ret) {
> >                 dev_err(dev, "Failed to claim DCP VMI IRQ!\n");
> 
> In case of subsequent errors you should call
> clk_disable_unprepare(sdcp->dcp_clk).

Yes, will resend. Maybe some day clk consumer will automatically undo
pending prepare/enables on release?

  reply	other threads:[~2018-10-16 17:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-16 15:57 [PATCH v3 0/4] Port mxs-dcp to imx6ull and imx6sll Leonard Crestez
2018-10-16 15:57 ` [PATCH v3 1/4] dt-bindings: crypto: Mention clocks for mxs-dcp Leonard Crestez
2018-10-16 15:57 ` [PATCH v3 2/4] crypto: mxs-dcp - Add support for dcp clk Leonard Crestez
2018-10-16 16:03   ` Fabio Estevam
2018-10-16 17:23     ` Leonard Crestez [this message]
2018-10-16 15:57 ` [PATCH v3 3/4] ARM: dts: imx6ull: Add dcp node Leonard Crestez
2018-10-16 16:04   ` Fabio Estevam
2018-10-16 15:57 ` [PATCH v3 4/4] ARM: imx_v6_v7_defconfig: Enable CRYPTO_DEV_MXS_DCP Leonard Crestez

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=f88233e6a76e99f95f6611bccdf234681e84f7ce.camel@nxp.com \
    --to=leonard.crestez@nxp.com \
    --cc=aymen.sghaier@nxp.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=fabio.estevam@nxp.com \
    --cc=festevam@gmail.com \
    --cc=franck.lenormand@nxp.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=horia.geanta@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marek.vasut@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=shawnguo@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;
as well as URLs for NNTP newsgroup(s).