Skip to content

Commit

Permalink
hwrng: cctrng - merge cc_trng_clk_init into its only caller
Browse files Browse the repository at this point in the history
cc_trng_clk_init is called only from the probe function. Merge the two
functions, this saves some lines of code.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
martin-kaiser authored and herbertx committed Jul 28, 2023
1 parent 8bcd968 commit 80a34c0
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions drivers/char/hw_random/cctrng.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,21 +455,6 @@ static void cc_trng_startwork_handler(struct work_struct *w)
cc_trng_hw_trigger(drvdata);
}


static int cc_trng_clk_init(struct cctrng_drvdata *drvdata)
{
struct clk *clk;
struct device *dev = &(drvdata->pdev->dev);

clk = devm_clk_get_optional_enabled(dev, NULL);
if (IS_ERR(clk))
return dev_err_probe(dev, PTR_ERR(clk),
"Failed to get or enable the clock\n");

drvdata->clk = clk;
return 0;
}

static int cctrng_probe(struct platform_device *pdev)
{
struct cctrng_drvdata *drvdata;
Expand Down Expand Up @@ -517,11 +502,10 @@ static int cctrng_probe(struct platform_device *pdev)
return rc;
}

rc = cc_trng_clk_init(drvdata);
if (rc) {
dev_err(dev, "cc_trng_clk_init failed\n");
return rc;
}
drvdata->clk = devm_clk_get_optional_enabled(dev, NULL);
if (IS_ERR(drvdata->clk))
return dev_err_probe(dev, PTR_ERR(drvdata->clk),
"Failed to get or enable the clock\n");

INIT_WORK(&drvdata->compwork, cc_trng_compwork_handler);
INIT_WORK(&drvdata->startwork, cc_trng_startwork_handler);
Expand Down

0 comments on commit 80a34c0

Please sign in to comment.