struct pic32_rng {
void __iomem *base;
struct hwrng rng;
- struct clk *clk;
};
/*
static int pic32_rng_probe(struct platform_device *pdev)
{
struct pic32_rng *priv;
+ struct clk *clk;
u32 v;
int ret;
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
- priv->clk = devm_clk_get(&pdev->dev, NULL);
- if (IS_ERR(priv->clk))
- return PTR_ERR(priv->clk);
-
- ret = clk_prepare_enable(priv->clk);
- if (ret)
- return ret;
+ clk = devm_clk_get_enabled(&pdev->dev, NULL);
+ if (IS_ERR(clk))
+ return PTR_ERR(clk);
/* enable TRNG in enhanced mode */
v = TRNGEN | TRNGMOD;
ret = devm_hwrng_register(&pdev->dev, &priv->rng);
if (ret)
- goto err_register;
+ return ret;
platform_set_drvdata(pdev, priv);
return 0;
-
-err_register:
- clk_disable_unprepare(priv->clk);
- return ret;
}
static int pic32_rng_remove(struct platform_device *pdev)
struct pic32_rng *rng = platform_get_drvdata(pdev);
writel(0, rng->base + RNGCON);
- clk_disable_unprepare(rng->clk);
return 0;
}