Re: [PATCH v6 02/14] crypto: caam - simplfy clock initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 23, 2019 at 7:17 AM Horia Geanta <horia.geanta@xxxxxxx> 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



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux