From: Stephen Boyd <sboyd@codeaurora.org>
To: Jonghwa Lee <jonghwa3.lee@samsung.com>
Cc: linux-kernel@vger.kernel.org, Matt Mackall <mpm@selenic.com>,
Herbert Xu <herbert@gondor.hengli.com.au>,
Nicolas Ferre <nicolas.ferre@atmel.com>,
Julia Lawall <Julia.Lawall@lip6.fr>,
Jamie Iles <jamie@jamieiles.com>,
Kyungmin Park <kyungmin.park@samsung.com>
Subject: Re: [PATCH v2] Exynos : Add support for Exynos random number generator
Date: Wed, 27 Jun 2012 10:52:44 -0700 [thread overview]
Message-ID: <4FEB486C.7000408@codeaurora.org> (raw)
In-Reply-To: <1340793061-14260-1-git-send-email-jonghwa3.lee@samsung.com>
Some minor comments, otherwise this looks much better than the previous
patch.
On 06/27/12 03:31, Jonghwa Lee wrote:
> This patch supports Exynos SOC's PRNG driver. Exynos's PRNG has 5 seeds and
> 5 random number outputs. Module is excuted under runtime power management control,
> so it activates only while it's in use. Otherwise it will be suspended generally.
> It was tested on PQ board by rngtest program.
>
> Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
This is an incorrect signoff chain. Kyungmin is not sending this so why
are you not the last one to sign off? Who is the author, Kyungmin or
yourself?
> +
> +config HW_RANDOM_EXYNOS
> + tristate "EXYNOS HW random number generator support"
> + depends on HW_RANDOM && ARCH_EXYNOS && HAS_IOMEM && PM_RUNTIME
There is no need to depend on PM_RUNTIME or ARCH_EXYNOS.
> +
> +static int exynos_read(struct hwrng *rng, void *buf,
> + size_t max, bool wait)
> +{
> + struct exynos_rng *exynos_rng = container_of(rng,
> + struct exynos_rng, rng);
> + u32 *data = buf;
> +
> + pm_runtime_get_sync(exynos_rng->dev);
> +
> + exynos_rng_writel(exynos_rng, PRNG_START, 0);
> +
> + do {
> + cpu_relax();
> + } while (!(exynos_rng_readl(exynos_rng,
> + EXYNOS_PRNG_STATUS_OFFSET) & PRNG_DONE));
> +
> + exynos_rng_writel(exynos_rng, PRNG_DONE, EXYNOS_PRNG_STATUS_OFFSET);
Curious, is this actually required? You poll for the status to say done
and the hardware requires you to write back the done bit after it
signals done?
> +
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!res) {
> + clk_put(exynos_rng->clk);
> + return -ENODEV;
> + }
Pass this through directly to devm_request_and_ioremap() without
checking the return value to save some lines.
> +
> + exynos_rng->mem = devm_request_and_ioremap(&pdev->dev, res);
> + if (!exynos_rng->mem) {
> + dev_err(&pdev->dev, "Ioremap failed.\n");
devm_request_and_ioremap() already prints a message on failure to remap
so this is unnecessary printk.
> + return -EBUSY;
> + }
> +
> + platform_set_drvdata(pdev, exynos_rng);
> +
> + pm_runtime_enable(&pdev->dev);
> +
> + ret = hwrng_register(&exynos_rng->rng);
> + if (ret)
> + return ret;
> +
> + return 0;
Why not just 'return hwrng_register()'?
> +
> +static int exynos_rng_runtime_resume(struct device *dev)
> +{
> + struct platform_device *pdev = to_platform_device(dev);
> + struct exynos_rng *exynos_rng = platform_get_drvdata(pdev);
> +
> + clk_prepare_enable(exynos_rng->clk);
> + return 0;
Perhaps return the value of clk_prepare_enable() in case it fails for
some reason?
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
next prev parent reply other threads:[~2012-06-27 17:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-27 10:31 [PATCH v2] Exynos : Add support for Exynos random number generator Jonghwa Lee
2012-06-27 11:07 ` Jamie Iles
2012-06-27 11:21 ` jonghwa3.lee
2012-06-27 11:29 ` Jamie Iles
2012-06-27 17:27 ` Stephen Boyd
2012-06-27 17:52 ` Stephen Boyd [this message]
2012-06-28 0:20 ` jonghwa3.lee
2012-06-28 0:58 ` jonghwa3.lee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FEB486C.7000408@codeaurora.org \
--to=sboyd@codeaurora.org \
--cc=Julia.Lawall@lip6.fr \
--cc=herbert@gondor.hengli.com.au \
--cc=jamie@jamieiles.com \
--cc=jonghwa3.lee@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.com \
--cc=nicolas.ferre@atmel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.