hwrng: manage resource allocation in amd driver
PATCH 1/2 hwrng: manage resource allocation in amd driver
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(-)
drivers/char/hw_random/amd-rng.c +9 -0
@@ -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); }
Signature · 1 line
1.7.4.4
PATCH 2/2 hwrnd: enable AMD hw rnd driver for Maple PPC boards
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(-)
drivers/char/hw_random/Kconfig +1 -1
@@ -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
Signature · 1 line
1.7.4.4
Quoted 2 lines · Dmitry Eremin-Solenikov
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]>
Quoted 39 lines
Signed-off-by Dmitry Eremin-Solenikov <[email protected]>--- drivers/char/hw_random/amd-rng.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)drivers/char/hw_random/amd-rng.c +9
-0@@ -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); }
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
Quoted 7 lines · Matt Mackall
Quoted 2 lines · Dmitry Eremin-Solenikov
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.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt