From: Lokesh Vutla <lokeshvutla@ti.com>
To: Olof Johansson <olof@lixom.net>
Cc: <herbert@gondor.hengli.com.au>,
<linux-arm-kernel@lists.infradead.org>,
<linux-crypto@vger.kernel.org>, <linux-omap@vger.kernel.org>
Subject: Re: [PATCH] hwrng: reorder OMAP TRNG driver code
Date: Wed, 21 Aug 2013 10:51:16 +0530 [thread overview]
Message-ID: <52144E4C.4050405@ti.com> (raw)
In-Reply-To: <1377022073-28198-1-git-send-email-olof@lixom.net>
Hi Olof,
On Tuesday 20 August 2013 11:37 PM, Olof Johansson wrote:
> The newly added omap4 support in the driver was added without
> consideration for building older configs. When building omap1_defconfig,
> it resulted in:
>
> drivers/char/hw_random/omap-rng.c:190:12: warning: 'omap4_rng_init' defined but not used [-Wunused-function]
> drivers/char/hw_random/omap-rng.c:215:13: warning: 'omap4_rng_cleanup' defined but not used [-Wunused-function]
> drivers/char/hw_random/omap-rng.c:251:20: warning: 'omap4_rng_irq' defined but not used [-Wunused-function]
>
> Move the code around so it is grouped with its operations struct, which
> for the omap4 case means also under the #ifdef CONFIG_OF, where it needs
> to be.
>
Missed testing this. Thanks for the patch.
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Regards,
Lokesh
> Signed-off-by: Olof Johansson <olof@lixom.net>
> Cc: Lokesh Vutla <lokeshvutla@ti.com>
> ---
> drivers/char/hw_random/omap-rng.c | 108 ++++++++++++++++++-------------------
> 1 file changed, 54 insertions(+), 54 deletions(-)
>
> diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
> index f3f7142..9b89ff4 100644
> --- a/drivers/char/hw_random/omap-rng.c
> +++ b/drivers/char/hw_random/omap-rng.c
> @@ -140,16 +140,6 @@ static inline void omap_rng_write(struct omap_rng_dev *priv, u16 reg,
> __raw_writel(val, priv->base + priv->pdata->regs[reg]);
> }
>
> -static inline u32 omap2_rng_data_present(struct omap_rng_dev *priv)
> -{
> - return omap_rng_read(priv, RNG_STATUS_REG) ? 0 : 1;
> -}
> -
> -static inline u32 omap4_rng_data_present(struct omap_rng_dev *priv)
> -{
> - return omap_rng_read(priv, RNG_STATUS_REG) & RNG_REG_STATUS_RDY;
> -}
> -
> static int omap_rng_data_present(struct hwrng *rng, int wait)
> {
> struct omap_rng_dev *priv;
> @@ -187,6 +177,60 @@ static int omap_rng_data_read(struct hwrng *rng, u32 *data)
> return data_size;
> }
>
> +static int omap_rng_init(struct hwrng *rng)
> +{
> + struct omap_rng_dev *priv;
> +
> + priv = (struct omap_rng_dev *)rng->priv;
> + return priv->pdata->init(priv);
> +}
> +
> +static void omap_rng_cleanup(struct hwrng *rng)
> +{
> + struct omap_rng_dev *priv;
> +
> + priv = (struct omap_rng_dev *)rng->priv;
> + priv->pdata->cleanup(priv);
> +}
> +
> +static struct hwrng omap_rng_ops = {
> + .name = "omap",
> + .data_present = omap_rng_data_present,
> + .data_read = omap_rng_data_read,
> + .init = omap_rng_init,
> + .cleanup = omap_rng_cleanup,
> +};
> +
> +static inline u32 omap2_rng_data_present(struct omap_rng_dev *priv)
> +{
> + return omap_rng_read(priv, RNG_STATUS_REG) ? 0 : 1;
> +}
> +
> +static int omap2_rng_init(struct omap_rng_dev *priv)
> +{
> + omap_rng_write(priv, RNG_SYSCONFIG_REG, 0x1);
> + return 0;
> +}
> +
> +static void omap2_rng_cleanup(struct omap_rng_dev *priv)
> +{
> + omap_rng_write(priv, RNG_SYSCONFIG_REG, 0x0);
> +}
> +
> +static struct omap_rng_pdata omap2_rng_pdata = {
> + .regs = (u16 *)reg_map_omap2,
> + .data_size = OMAP2_RNG_OUTPUT_SIZE,
> + .data_present = omap2_rng_data_present,
> + .init = omap2_rng_init,
> + .cleanup = omap2_rng_cleanup,
> +};
> +
> +#if defined(CONFIG_OF)
> +static inline u32 omap4_rng_data_present(struct omap_rng_dev *priv)
> +{
> + return omap_rng_read(priv, RNG_STATUS_REG) & RNG_REG_STATUS_RDY;
> +}
> +
> static int omap4_rng_init(struct omap_rng_dev *priv)
> {
> u32 val;
> @@ -221,33 +265,6 @@ static void omap4_rng_cleanup(struct omap_rng_dev *priv)
> omap_rng_write(priv, RNG_CONFIG_REG, val);
> }
>
> -static int omap2_rng_init(struct omap_rng_dev *priv)
> -{
> - omap_rng_write(priv, RNG_SYSCONFIG_REG, 0x1);
> - return 0;
> -}
> -
> -static void omap2_rng_cleanup(struct omap_rng_dev *priv)
> -{
> - omap_rng_write(priv, RNG_SYSCONFIG_REG, 0x0);
> -}
> -
> -static int omap_rng_init(struct hwrng *rng)
> -{
> - struct omap_rng_dev *priv;
> -
> - priv = (struct omap_rng_dev *)rng->priv;
> - return priv->pdata->init(priv);
> -}
> -
> -static void omap_rng_cleanup(struct hwrng *rng)
> -{
> - struct omap_rng_dev *priv;
> -
> - priv = (struct omap_rng_dev *)rng->priv;
> - priv->pdata->cleanup(priv);
> -}
> -
> static irqreturn_t omap4_rng_irq(int irq, void *dev_id)
> {
> struct omap_rng_dev *priv = dev_id;
> @@ -275,23 +292,6 @@ static irqreturn_t omap4_rng_irq(int irq, void *dev_id)
> return IRQ_HANDLED;
> }
>
> -static struct hwrng omap_rng_ops = {
> - .name = "omap",
> - .data_present = omap_rng_data_present,
> - .data_read = omap_rng_data_read,
> - .init = omap_rng_init,
> - .cleanup = omap_rng_cleanup,
> -};
> -
> -static struct omap_rng_pdata omap2_rng_pdata = {
> - .regs = (u16 *)reg_map_omap2,
> - .data_size = OMAP2_RNG_OUTPUT_SIZE,
> - .data_present = omap2_rng_data_present,
> - .init = omap2_rng_init,
> - .cleanup = omap2_rng_cleanup,
> -};
> -
> -#if defined(CONFIG_OF)
> static struct omap_rng_pdata omap4_rng_pdata = {
> .regs = (u16 *)reg_map_omap4,
> .data_size = OMAP4_RNG_OUTPUT_SIZE,
>
next prev parent reply other threads:[~2013-08-21 5:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-20 18:07 [PATCH] hwrng: reorder OMAP TRNG driver code Olof Johansson
2013-08-21 5:21 ` Lokesh Vutla [this message]
2013-08-21 11:51 ` Herbert Xu
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=52144E4C.4050405@ti.com \
--to=lokeshvutla@ti.com \
--cc=herbert@gondor.hengli.com.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=olof@lixom.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox