lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHQ1cqFCraDXFr4DYCE5XHM-fM=xQ5VrZkTVdV1NyrtdDyoR_A@mail.gmail.com>
Date:   Mon, 15 Jul 2019 11:14:43 -0700
From:   Andrey Smirnov <andrew.smirnov@...il.com>
To:     Iuliana Prodan <iuliana.prodan@....com>
Cc:     "linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
        Chris Spencer <christopher.spencer@....co.uk>,
        Cory Tusar <cory.tusar@....aero>,
        Chris Healy <cphealy@...il.com>,
        Lucas Stach <l.stach@...gutronix.de>,
        Horia Geanta <horia.geanta@....com>,
        Aymen Sghaier <aymen.sghaier@....com>,
        Leonard Crestez <leonard.crestez@....com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 02/16] crypto: caam - simplify clock initialization

On Thu, Jul 4, 2019 at 8:43 AM Iuliana Prodan <iuliana.prodan@....com> wrote:
>
> On 7/3/2019 11:15 AM, 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.
> >
> > Signed-off-by: Andrey Smirnov <andrew.smirnov@...il.com>
> > Cc: Chris Spencer <christopher.spencer@....co.uk>
> > Cc: Cory Tusar <cory.tusar@....aero>
> > Cc: Chris Healy <cphealy@...il.com>
> > Cc: Lucas Stach <l.stach@...gutronix.de>
> > Cc: Horia Geantă <horia.geanta@....com>
> > Cc: Aymen Sghaier <aymen.sghaier@....com>
> > Cc: Leonard Crestez <leonard.crestez@....com>
> > Cc: linux-crypto@...r.kernel.org
> > Cc: linux-kernel@...r.kernel.org
> > ---
> >   drivers/crypto/caam/ctrl.c   | 203 +++++++++++++++++------------------
> >   drivers/crypto/caam/intern.h |   7 +-
> >   2 files changed, 98 insertions(+), 112 deletions(-)
> >
> > diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
> > index e674d8770cdb..908d3ecf6d1c 100644
> > --- a/drivers/crypto/caam/ctrl.c
> > +++ b/drivers/crypto/caam/ctrl.c
> > @@ -25,16 +25,6 @@ EXPORT_SYMBOL(caam_dpaa2);
> >   #include "qi.h"
> >   #endif
> >
> > -/*
> > - * i.MX targets tend to have clock control subsystems that can
> > - * enable/disable clocking to our device.
> > - */
> > -static inline struct clk *caam_drv_identify_clk(struct device *dev,
> > -                                             char *clk_name)
> > -{
> > -     return caam_imx ? devm_clk_get(dev, clk_name) : NULL;
> > -}
> > -
> >   /*
> >    * Descriptor to instantiate RNG State Handle 0 in normal mode and
> >    * load the JDKEK, TDKEK and TDSK registers
> > @@ -342,13 +332,6 @@ static int caam_remove(struct platform_device *pdev)
> >       /* Unmap controller region */
> >       iounmap(ctrl);
> >
> > -     /* shut clocks off before finalizing shutdown */
> > -     clk_disable_unprepare(ctrlpriv->caam_ipg);
> > -     if (ctrlpriv->caam_mem)
> > -             clk_disable_unprepare(ctrlpriv->caam_mem);
> > -     clk_disable_unprepare(ctrlpriv->caam_aclk);
> > -     if (ctrlpriv->caam_emi_slow)
> > -             clk_disable_unprepare(ctrlpriv->caam_emi_slow);
> >       return 0;
> >   }
> >
> > @@ -497,20 +480,102 @@ static const struct of_device_id caam_match[] = {
> >   };
> >   MODULE_DEVICE_TABLE(of, caam_match);
> >
> > +struct caam_imx_data {
> > +     const struct clk_bulk_data *clks;
> > +     int num_clks;
> > +};
> > +
> > +static const struct clk_bulk_data caam_imx6_clks[] = {
> > +     { .id = "ipg" },
> > +     { .id = "mem" },
> > +     { .id = "aclk" },
> > +     { .id = "emi_slow" },
> > +};
> > +
> > +static const struct caam_imx_data caam_imx6_data = {
> > +     .clks = caam_imx6_clks,
> > +     .num_clks = ARRAY_SIZE(caam_imx6_clks),
> > +};
> > +
> > +static const struct clk_bulk_data caam_imx7_clks[] = {
> > +     { .id = "ipg" },
> > +     { .id = "aclk" },
> > +};
> > +
> > +static const struct caam_imx_data caam_imx7_data = {
> > +     .clks = caam_imx7_clks,
> > +     .num_clks = ARRAY_SIZE(caam_imx7_clks),
> > +};
> > +
> > +static const struct clk_bulk_data caam_imx6ul_clks[] = {
> > +     { .id = "ipg" },
> > +     { .id = "mem" },
> > +     { .id = "aclk" },
> > +};
> > +
> > +static const struct caam_imx_data caam_imx6ul_data = {
> > +     .clks = caam_imx6ul_clks,
> > +     .num_clks = ARRAY_SIZE(caam_imx6ul_clks),
> > +};
> > +
> > +static const struct soc_device_attribute caam_imx_soc_table[] = {
> > +     { .soc_id = "i.MX6UL", .data = &caam_imx6ul_data },
> > +     { .soc_id = "i.MX6*",  .data = &caam_imx6_data },
> > +     { .soc_id = "i.MX7*",  .data = &caam_imx7_data },
> > +     { .family = "Freescale i.MX" },
> > +};
>
> You need to add a {/* sentinel */} in caam_imx_soc_table, otherwise will
> crash for other than i.MX targets, when trying to identify the SoC.
>

Ugh, definitely, my bad. Thanks for catching this!

Thanks,
Andrey Smirnov

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ