[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <VI1PR0402MB3485E4DDB5E3BDCBC2AAAFE398C70@VI1PR0402MB3485.eurprd04.prod.outlook.com>
Date: Tue, 23 Jul 2019 14:17:23 +0000
From: Horia Geanta <horia.geanta@....com>
To: Andrey Smirnov <andrew.smirnov@...il.com>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>
CC: 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 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.
Horia
Powered by blists - more mailing lists