Re: [PATCH 1/3] hwrng: msm - Move hwrng to a table

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

 



Quoting Vinod Koul (2018-06-18 07:12:57)
> @@ -127,6 +125,13 @@ static void msm_rng_cleanup(struct hwrng *hwrng)
>         msm_rng_enable(hwrng, 0);
>  }
>  
> +static struct hwrng msm_rng = {
> +       .name = KBUILD_MODNAME,
> +       .init = msm_rng_init,
> +       .cleanup = msm_rng_cleanup,
> +       .read = msm_rng_read,
> +};
> +
>  static int msm_rng_probe(struct platform_device *pdev)
>  {
>         struct resource *res;
> @@ -148,12 +153,10 @@ static int msm_rng_probe(struct platform_device *pdev)
>         if (IS_ERR(rng->clk))
>                 return PTR_ERR(rng->clk);
>  
> -       rng->hwrng.name = KBUILD_MODNAME,
> -       rng->hwrng.init = msm_rng_init,
> -       rng->hwrng.cleanup = msm_rng_cleanup,

Wouldn't it be a lot easier to skip assigning the init and cleanup
functions on v2 devices with an if statement? It would be smaller size
wise too because then we don't have two structs for v1 and v2 hwrngs.
Plus the patch would be smaller overall because we would do everything
else pretty much the same besides the if condition in probe.

> -       rng->hwrng.read = msm_rng_read,
> +       rng->hwrng = &msm_rng;
>  
> -       ret = devm_hwrng_register(&pdev->dev, &rng->hwrng);
> +       rng->hwrng->priv = (unsigned long)rng;
> +       ret = devm_hwrng_register(&pdev->dev, rng->hwrng);
>         if (ret) {
>                 dev_err(&pdev->dev, "failed to register hwrng\n");
>                 return ret;
> -- 
> 2.14.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux