devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: "bjorn.andersson@linaro.org" <bjorn.andersson@linaro.org>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"dinguyen@kernel.org" <dinguyen@kernel.org>,
	"enric.balletbo@collabora.com" <enric.balletbo@collabora.com>,
	"festevam@gmail.com" <festevam@gmail.com>,
	"horms+renesas@verge.net.au" <horms+renesas@verge.net.au>,
	"jagan@amarulasolutions.com" <jagan@amarulasolutions.com>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"l.stach@pengutronix.de" <l.stach@pengutronix.de>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>
Cc: dl-linux-imx <linux-imx@nxp.com>
Subject: RE: [PATCH V3 3/4] clk: imx: Add support for i.MX8MN clock driver
Date: Tue, 25 Jun 2019 15:34:56 -0700	[thread overview]
Message-ID: <20190625223457.1FCBF205ED@mail.kernel.org> (raw)
In-Reply-To: <DB3PR0402MB3916F7F7D7CA801F5C0D0610F5ED0@DB3PR0402MB3916.eurprd04.prod.outlook.com>

Quoting Anson Huang (2019-06-10 19:06:22)
> > >
> > > Sorry, I am still a little confused, all the clock
> > > register(clk_register()) are via each different clock types like
> > > imx_clk_gate4/imx_clk_pll14xx, if using clk_hw_register, means we need
> > > to re-write the clock driver using different clk register method, that
> > > will make the driver completely different from i.mx8mq/i.mx8mm, they
> > > are actually same series of SoC as i.mx8mn, it will introduce many
> > confusion, is my understanding correct? And is it OK to just keep what it is
> > and make them all aligned?
> > >
> > 
> > Ok, the problem I'm trying to point out is that clk registrations need to be
> > undone, i.e. clk_unregister() needs to be called, when the driver fails to
> > probe. devm_*() is one way to do this, but if you have other ways of
> > removing all the registered clks then that works too. Makes sense?
> 
> Yes, it makes sense. Do you think it is OK to add an imx_unregister_clocks() API, then
> call it in every place of returning failure in .probe function? If yes, I will add it and also
> fix it in i.MX8MQ driver which uses platform driver model but does NOT handle this case. 
> 
>         base = devm_platform_ioremap_resource(pdev, 0);
> -       if (WARN_ON(IS_ERR(base)))
> -               return PTR_ERR(base);
> +       if (WARN_ON(IS_ERR(base))) {
> +               ret = PTR_ERR(base);
> +               goto unregister_clks;
> +       }
> 
>                 pr_err("failed to register clks for i.MX8MN\n");
> -               return -EINVAL;
> +               goto unregister_clks;
>         }
> 
>         return 0;
> +
> +unregister_clks:
> +       imx_unregister_clocks(clks, ARRAY_SIZE(clks));
> +
> +       return ret;
> 
> +void imx_unregister_clocks(struct clk *clks[], unsigned int count)
> +{
> +       unsigned i;
> +
> +       for (i = 0; i < count; i++)
> +               clk_unregister(clks[i]);
> +}
> +
> 

Yes, looks better.

  reply	other threads:[~2019-06-25 22:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-04  1:59 [PATCH V3 1/4] dt-bindings: imx: Add clock binding doc for i.MX8MN Anson.Huang
2019-06-04  1:59 ` [PATCH V3 2/4] clk: imx8mm: Make 1416X/1443X PLL macro definitions common for usage Anson.Huang
2019-06-04  1:59 ` [PATCH V3 3/4] clk: imx: Add support for i.MX8MN clock driver Anson.Huang
2019-06-06 16:25   ` Stephen Boyd
2019-06-07  0:50     ` Anson Huang
2019-06-07 18:00       ` Stephen Boyd
2019-06-08  9:58         ` Anson Huang
2019-06-10 15:14           ` Stephen Boyd
2019-06-11  2:06             ` Anson Huang
2019-06-25 22:34               ` Stephen Boyd [this message]
2019-06-04  1:59 ` [PATCH V3 4/4] arm64: defconfig: Select CONFIG_CLK_IMX8MN by default Anson.Huang
2019-06-05 23:33 ` [PATCH V3 1/4] dt-bindings: imx: Add clock binding doc for i.MX8MN Stephen Boyd
2019-06-06  1:14   ` Anson Huang

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=20190625223457.1FCBF205ED@mail.kernel.org \
    --to=sboyd@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dinguyen@kernel.org \
    --cc=enric.balletbo@collabora.com \
    --cc=festevam@gmail.com \
    --cc=horms+renesas@verge.net.au \
    --cc=jagan@amarulasolutions.com \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    /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).