[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHQ1cqE7ivNQLYrHo1Jt4S-z7traCJr=NYNTUxmTHHtJJjyNwQ@mail.gmail.com>
Date: Mon, 24 Feb 2020 08:40:52 -0800
From: Andrey Smirnov <andrew.smirnov@...il.com>
To: Horia Geanta <horia.geanta@....com>
Cc: "linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
Chris Healy <cphealy@...il.com>,
Lucas Stach <l.stach@...gutronix.de>,
Herbert Xu <herbert@...dor.apana.org.au>,
Iuliana Prodan <iuliana.prodan@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
dl-linux-imx <linux-imx@....com>
Subject: Re: [PATCH v7 4/9] crypto: caam - drop global context pointer and init_done
On Tue, Feb 11, 2020 at 12:57 PM Horia Geanta <horia.geanta@....com> wrote:
>
> On 1/27/2020 6:57 PM, Andrey Smirnov wrote:
> > @@ -70,6 +70,7 @@ struct buf_data {
> >
> > /* rng per-device context */
> > struct caam_rng_ctx {
> > + struct hwrng rng;
> > struct device *jrdev;
> > dma_addr_t sh_desc_dma;
> > u32 sh_desc[DESC_RNG_LEN];
> > @@ -78,13 +79,10 @@ struct caam_rng_ctx {
> > struct buf_data bufs[2];
> > };
> >
> > -static struct caam_rng_ctx *rng_ctx;
> > -
> > -/*
> > - * Variable used to avoid double free of resources in case
> > - * algorithm registration was unsuccessful
> > - */
> > -static bool init_done;
> > +static struct caam_rng_ctx *to_caam_rng_ctx(struct hwrng *r)
> > +{
> > + return container_of(r, struct caam_rng_ctx, rng);
> > +}
> [...]
> > -static struct hwrng caam_rng = {
> > - .name = "rng-caam",
> > - .init = caam_init,
> > - .cleanup = caam_cleanup,
> > - .read = caam_read,
> > -};
> [...]> + ctx->rng.name = "rng-caam";
> > + ctx->rng.init = caam_init;
> > + ctx->rng.cleanup = caam_cleanup;
> > + ctx->rng.read = caam_read;
> An alternative (probably better) for storing caamrng context
> is to use what is already available in struct hwrng:
> * @priv: Private data, for use by the RNG driver.
>
OK, will do in v8.
Thanks,
Andrey Smirnov
Powered by blists - more mailing lists