mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matt Mackall <mpm@selenic.com>
To: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: linux-kernel@vger.kernel.org, Herbert Xu <herbert@gondor.hengli.com.au>
Subject: Re: [PATCH 1/2] hwrng: manage resource allocation in amd driver
Date: Thu, 28 Apr 2011 14:51:53 -0500	[thread overview]
Message-ID: <1304020313.20288.1.camel@calx> (raw)
In-Reply-To: <1303932076-7428-1-git-send-email-dbaryshkov@gmail.com>

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@selenic.com>

> 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);
>  }
>  


-- 
Mathematics is the supreme nostalgia of our time.



  parent reply	other threads:[~2011-04-28 20:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-27 19:21 Dmitry Eremin-Solenikov
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 ` Matt Mackall [this message]
2011-05-04  5:13   ` [PATCH 1/2] hwrng: manage resource allocation in amd driver 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=1304020313.20288.1.camel@calx \
    --to=mpm@selenic.com \
    --cc=dbaryshkov@gmail.com \
    --cc=herbert@gondor.hengli.com.au \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome