As amd driver doesn't bind to PCI device, we'd better manage reource
allocation on our own to disallow (possible) conflicts.
Signed-off-by: Dmitry Eremin-Solenikov <[email protected]>
---
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);
}
--
1.7.4.4
PPC 970FX Evaluation kit (Maple) boards bear AMD8111 southbridge.
Allow this driver to be compiled in if PPC_MAPLE is selected.
Signed-off-by: Dmitry Eremin-Solenikov <[email protected]>
---
drivers/char/hw_random/Kconfig | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
index beecd1c..a60043b 100644
--- a/drivers/char/hw_random/Kconfig
+++ b/drivers/char/hw_random/Kconfig
@@ -49,7 +49,7 @@ config HW_RANDOM_INTEL
config HW_RANDOM_AMD
tristate "AMD HW Random Number Generator support"
- depends on HW_RANDOM && X86 && PCI
+ depends on HW_RANDOM && (X86 || PPC_MAPLE) && PCI
default HW_RANDOM
---help---
This driver provides kernel-side support for the Random Number
--
1.7.4.4
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 <[email protected]>
> Signed-off-by: Dmitry Eremin-Solenikov <[email protected]>
> ---
> 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.
On Thu, Apr 28, 2011 at 02:51:53PM -0500, Matt Mackall wrote:
> 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 <[email protected]>
All applied. Thanks a lot.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt