From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Matt Mackall <mpm@selenic.com>,
Herbert Xu <herbert@gondor.hengli.com.au>
Subject: [PATCH 1/2] hwrng: manage resource allocation in amd driver
Date: Wed, 27 Apr 2011 23:21:15 +0400 [thread overview]
Message-ID: <1303932076-7428-1-git-send-email-dbaryshkov@gmail.com> (raw)
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 <dbaryshkov@gmail.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);
}
--
1.7.4.4
next reply other threads:[~2011-04-27 19:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-27 19:21 Dmitry Eremin-Solenikov [this message]
2011-04-27 19:21 ` [PATCH 2/2] hwrnd: enable AMD hw rnd driver for Maple PPC boards Dmitry Eremin-Solenikov
2011-04-28 19:51 ` [PATCH 1/2] hwrng: manage resource allocation in amd driver Matt Mackall
2011-05-04 5:13 ` 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=1303932076-7428-1-git-send-email-dbaryshkov@gmail.com \
--to=dbaryshkov@gmail.com \
--cc=herbert@gondor.hengli.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).