[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1304020313.20288.1.camel@calx>
Date: Thu, 28 Apr 2011 14:51:53 -0500
From: Matt Mackall <mpm@...enic.com>
To: Dmitry Eremin-Solenikov <dbaryshkov@...il.com>
Cc: linux-kernel@...r.kernel.org,
Herbert Xu <herbert@...dor.apana.org.au>
Subject: Re: [PATCH 1/2] hwrng: manage resource allocation in amd driver
On Wed, 2011-04-27 at 23:21 +0400, Dmitry Eremin-Solenikov wrote:
> As amd driver doesn't bind to PCI device, we'd better manage reource
> allocation on our own to disallow (possible) conflicts.
These two look good to me.
Acked-by: Matt Mackall <mpm@...enic.com>
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@...il.com>
> ---
> drivers/char/hw_random/amd-rng.c | 9 +++++++++
> 1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/char/hw_random/amd-rng.c b/drivers/char/hw_random/amd-rng.c
> index 0d8c578..c6af038 100644
> --- a/drivers/char/hw_random/amd-rng.c
> +++ b/drivers/char/hw_random/amd-rng.c
> @@ -133,6 +133,12 @@ found:
> pmbase &= 0x0000FF00;
> if (pmbase == 0)
> goto out;
> + if (!request_region(pmbase + 0xF0, 8, "AMD HWRNG")) {
> + dev_err(&pdev->dev, "AMD HWRNG region 0x%x already in use!\n",
> + pmbase + 0xF0);
> + err = -EBUSY;
> + goto out;
> + }
> amd_rng.priv = (unsigned long)pmbase;
> amd_pdev = pdev;
>
> @@ -141,6 +147,7 @@ found:
> if (err) {
> printk(KERN_ERR PFX "RNG registering failed (%d)\n",
> err);
> + release_region(pmbase + 0xF0, 8);
> goto out;
> }
> out:
> @@ -149,6 +156,8 @@ out:
>
> static void __exit mod_exit(void)
> {
> + u32 pmbase = (unsigned long)amd_rng.priv;
> + release_region(pmbase + 0xF0, 8);
> hwrng_unregister(&amd_rng);
> }
>
--
Mathematics is the supreme nostalgia of our time.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists