mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergey Vlasov <vsu@altlinux.ru>
To: Michael Buesch <mb@bu3sch.de>
Cc: akpm@osdl.org, Deepak Saxena <dsaxena@plexity.net>,
	bcm43xx-dev@lists.berlios.de, linux-kernel@vger.kernel.org
Subject: Re: [patch 3/6] New Generic HW RNG (#2)
Date: Sun, 7 May 2006 19:22:06 +0400	[thread overview]
Message-ID: <20060507152206.GC14704@procyon.home> (raw)
In-Reply-To: <20060507144257.311084000@pc1>

[-- Attachment #1: Type: text/plain, Size: 1846 bytes --]

On Sun, May 07, 2006 at 04:38:09PM +0200, Michael Buesch wrote:
> Add a driver for the x86 RNG.
> This driver is ported from the old hw_random.c
> 
[skip]
> +static int __init intel_init(struct hwrng *rng)

Cannot be __init anymore - now rng->init could be called at any time.

Also, there is another problem with putting this function into
rng->init - if another RNG has been registered when this module is
loaded, ->init will not be called during hwrng_register(), so the
module load will succeed even if the chipset does not have RNG
hardware.

> +{
> +	void __iomem *rng_mem;
> +	int rc;
> +	u8 hw_status;
> +
> +	DPRINTK ("ENTER\n");
> +
> +	rng_mem = ioremap (INTEL_RNG_ADDR, INTEL_RNG_ADDR_LEN);
> +	if (rng_mem == NULL) {
> +		printk (KERN_ERR PFX "cannot ioremap RNG Memory\n");
> +		rc = -EBUSY;
> +		goto err_out;
> +	}
> +	rng->priv = (unsigned long)rng_mem;
> +
> +	/* Check for Intel 82802 */
> +	hw_status = intel_hwstatus (rng_mem);
> +	if ((hw_status & INTEL_RNG_PRESENT) == 0) {
> +		printk (KERN_ERR PFX "RNG not detected\n");
> +		rc = -ENODEV;
> +		goto err_out_free_map;
> +	}
> +
> +	/* turn RNG h/w on, if it's off */
> +	if ((hw_status & INTEL_RNG_ENABLED) == 0)
> +		hw_status = intel_hwstatus_set (rng_mem, hw_status | INTEL_RNG_ENABLED);
> +	if ((hw_status & INTEL_RNG_ENABLED) == 0) {
> +		printk (KERN_ERR PFX "cannot enable RNG, aborting\n");
> +		rc = -EIO;
> +		goto err_out_free_map;
> +	}
> +
> +	DPRINTK ("EXIT, returning 0\n");
> +	return 0;
> +
> +err_out_free_map:
> +	iounmap (rng_mem);
> +err_out:
> +	DPRINTK ("EXIT, returning %d\n", rc);
> +	return rc;
> +}
> +
[skip]
> +static int __init amd_init(struct hwrng *rng)

Again, __init is wrong.

[skip]
> +static int __init via_init(struct hwrng *rng)

This __init is wrong too.

[skip]

[-- Attachment #2: Type: application/pgp-signature, Size: 191 bytes --]

  reply	other threads:[~2006-05-07 15:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-07 14:38 [patch 0/6] " Michael Buesch
2006-05-07 14:38 ` [patch 1/6] " Michael Buesch
2006-05-07 14:38 ` [patch 2/6] " Michael Buesch
2006-05-07 14:38 ` [patch 3/6] " Michael Buesch
2006-05-07 15:22   ` Sergey Vlasov [this message]
2006-05-07 15:39     ` Michael Buesch
2006-05-07 16:24       ` Sergey Vlasov
2006-05-07 14:38 ` [patch 4/6] " Michael Buesch
2006-05-07 14:38 ` [patch 5/6] " Michael Buesch
2006-05-07 14:38 ` [patch 6/6] " Michael Buesch
2006-05-07 18:39 ` [patch 0/6] " Arnd Bergmann
2006-05-07 18:50   ` Michael Buesch
2006-05-07 18:47     ` Arnd Bergmann

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=20060507152206.GC14704@procyon.home \
    --to=vsu@altlinux.ru \
    --cc=akpm@osdl.org \
    --cc=bcm43xx-dev@lists.berlios.de \
    --cc=dsaxena@plexity.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mb@bu3sch.de \
    /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