[PATCH] [2.6.22] pasemi: hardware rng driver
Arnd Bergmann
arnd at arndb.de
Thu Apr 26 09:38:31 EST 2007
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 <><
More information about the Linuxppc-dev
mailing list