linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linuxppc-dev@ozlabs.org
Cc: Olof Johansson <olof@lixom.net>, egor@pasemi.com, mb@bu3sch.de
Subject: Re: [PATCH] [2.6.22] pasemi: hardware rng driver
Date: Thu, 26 Apr 2007 01:38:31 +0200	[thread overview]
Message-ID: <200704260138.32220.arnd@arndb.de> (raw)
In-Reply-To: <20070425204512.GB19781@lixom.net>

On Wednesday 25 April 2007, Olof Johansson wrote:

> +static void __iomem *rng_regs;
> +
> +static int pasemi_rng_data_present(struct hwrng *rng)
> +{
> +	return (in_le32(rng_regs + SDCRNG_CTL_REG)
> +		& SDCRNG_CTL_FVLD_M) ? 1 : 0;
> +}

It would be nicer to get rid of the global rng_regs variable by sticking
it into rng->priv.

> +static int __devinit rng_probe(struct of_device *ofdev,
> +				     const struct of_device_id *match)
> +{
> +	struct device_node *rng_np;
> +	struct resource res;
> +	int err = 0;
> +
> +	rng_np = of_find_compatible_node(NULL, "rng", "1682m-rng");
> +	if (!rng_np)
> +		return -ENODEV;

I would guess that the call to of_find_compatible_node is entirely bogus
here, because the device is already passed in as ofdev in to the probe
function.

> +int rng_init(void)
> +{
> +       return of_register_platform_driver(&rng_driver);
> +}
> +
> +void rng_exit(void)
> +{
> +       of_unregister_platform_driver(&rng_driver);
> +}
> +
> +device_initcall(rng_init);

rng_init and rng_exit should be static
rng_init should be __init
rng_exit should be __exit
Since the driver is tristate in Kconfig, it would be more conventional to
use module_init() instead of device_initcall().
rng_exit needs to be marked as module_exit() to allow unloading the driver.

	Arnd <><

  reply	other threads:[~2007-04-25 23:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-25 20:45 [PATCH] [2.6.22] pasemi: hardware rng driver Olof Johansson
2007-04-25 23:38 ` Arnd Bergmann [this message]
2007-04-26  0:09   ` Olof Johansson
2007-04-26  9:23   ` Michael Buesch
2007-04-26  5:37 ` [PATCH v2] " Olof Johansson
2007-04-26  8:50   ` Arnd Bergmann
2007-04-26 20:59   ` [PATCH v3] " Olof Johansson
2007-04-26  9:22 ` [PATCH] " Michael Buesch
2007-04-26 20:46   ` Olof Johansson
  -- strict thread matches above, loose matches on Subject: below --
2007-04-27 10:54 [PATCH 2.6.22] " Michael Buesch

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=200704260138.32220.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=egor@pasemi.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mb@bu3sch.de \
    --cc=olof@lixom.net \
    /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).