[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHQ1cqF=7h=mcKSBNRoYX5mkRetEbvb8dGkDyqHcDf1TCpr40w@mail.gmail.com>
Date: Mon, 12 Aug 2019 10:56:11 -0700
From: Andrey Smirnov <andrew.smirnov@...il.com>
To: Horia Geanta <horia.geanta@....com>
Cc: "linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
Leonard Crestez <leonard.crestez@....com>,
Iuliana Prodan <iuliana.prodan@....com>,
Chris Spencer <christopher.spencer@....co.uk>,
Cory Tusar <cory.tusar@....aero>,
Chris Healy <cphealy@...il.com>,
Lucas Stach <l.stach@...gutronix.de>,
Aymen Sghaier <aymen.sghaier@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v6 02/14] crypto: caam - simplfy clock initialization
On Tue, Jul 23, 2019 at 7:17 AM Horia Geanta <horia.geanta@....com> wrote:
>
> On 7/17/2019 6:25 PM, Andrey Smirnov wrote:
> > Simplify clock initialization code by converting it to use clk-bulk,
> > devres and soc_device_match() match table. No functional change
> > intended.
> >
> Thanks.
> Two nitpicks below.
>
> > +static int init_clocks(struct device *dev,
> > + struct caam_drv_private *ctrlpriv,
> > + const struct caam_imx_data *data)
> > +{
> > + int ret;
> > +
> > + ctrlpriv->num_clks = data->num_clks;
> > + ctrlpriv->clks = devm_kmemdup(dev, data->clks,
> > + data->num_clks * sizeof(data->clks[0]),
> > + GFP_KERNEL);
> > + if (!ctrlpriv->clks)
> > + return -ENOMEM;
> > +
> > + ret = devm_clk_bulk_get(dev, ctrlpriv->num_clks, ctrlpriv->clks);
> > + if (ret) {
> > + dev_err(dev,
> > + "Failed to request all necessary clocks\n");
> > + return ret;
> > + }
> > +
> > + ret = clk_bulk_prepare_enable(ctrlpriv->num_clks, ctrlpriv->clks);
> > + if (ret) {
> > + dev_err(dev,
> > + "Failed to prepare/enable all necessary clocks\n");
> > + return ret;
> > + }
> > +
> > + ret = devm_add_action_or_reset(dev, disable_clocks, ctrlpriv);
> > + if (ret)
> > + return ret;
> > +
> > + return 0;
> Or directly:
> return devm_add_action_or_reset(dev, disable_clocks, ctrlpriv);
>
> > + imx_soc_match = soc_device_match(caam_imx_soc_table);
> > + if (imx_soc_match) {
> > + if (!imx_soc_match->data) {
> > + dev_err(dev, "No clock data provided for i.MX SoC");
> > + return -EINVAL;
> [...]
> > + ret = init_clocks(dev, ctrlpriv, imx_soc_match->data);
> ctrlpriv can be retrieved using dev_get_drvdata(dev), thus there's no need
> to pass it as parameter.
>
Will fix in v7.
Thanks,
Andrey Smirnov
Powered by blists - more mailing lists