[PATCH] [2.6.22] pasemi: hardware rng driver
Olof Johansson
olof at lixom.net
Thu Apr 26 10:09:56 EST 2007
On Thu, Apr 26, 2007 at 01:38:31AM +0200, Arnd Bergmann wrote:
> 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.
Good point.
> > +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.
Yup. Leftover from pre-of_platform
> > +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.
Yup, will fix.
Thanks.
-Olof
More information about the Linuxppc-dev
mailing list