Re: [PATCH v2 2/2] hwrng: msm - Add support for prng v2

From: Vinod
Date: Tue Jun 19 2018 - 08:31:42 EST


On 19-06-18, 15:11, Stanimir Varbanov wrote:

Hi Stan,

> On 06/19/2018 12:54 PM, Vinod Koul wrote:

> > rng->hwrng.name = KBUILD_MODNAME,
> > - rng->hwrng.init = msm_rng_init,
> > - rng->hwrng.cleanup = msm_rng_cleanup,
> > - rng->hwrng.read = msm_rng_read,
> > + rng->hwrng.read = msm_rng_read;
> > + skip_init = (unsigned long)of_device_get_match_data(&pdev->dev);
>
> skip_init is unsigned int, despite I think you don't need to cast it.

This is needed. of_device_get_match_data returns void *, so an explicit
cast is required for integer warning, otherwise it shows up as
-Wint-conversion warning

> > static const struct of_device_id msm_rng_of_match[] = {
> > - { .compatible = "qcom,prng", },
> > + { .compatible = "qcom,prng", .data = (void *)0},
> > + { .compatible = "qcom,prng-v2", .data = (void *)1},
>
> No need to cast. IMO it'd be better to create defines for these numbers:

again driver_data is void * and we need a cast

>
> #define PRNG_V1 0
> #define PRNG_V2 1

That can be done. Since it is more used as flag and not version number
here to skip init, it doesn't really mean versions now

Thanks
--
~Vinod