[PATCH v2 10/12] [POWERPC] Motion-PRO: Add LED support.
Stephen Rothwell
sfr at canb.auug.org.au
Sun Nov 4 15:27:16 EST 2007
Hi Marian,
On Sun, 04 Nov 2007 00:53:11 +0100 Marian Balakowicz <m8 at semihalf.com> wrote:
>
> +++ b/drivers/leds/leds-motionpro.c
> @@ -0,0 +1,240 @@
> +
> +#include <linux/module.h>
> +#include <linux/types.h>
> +#include <linux/kernel.h>
> +#include <linux/platform_device.h>
> +#include <linux/leds.h>
> +#include <linux/vmalloc.h>
> +
> +#include <asm/mpc52xx.h>
> +#include <asm/io.h>
> +#include <asm/of_platform.h>
You want <linux/of_platform.h> instead of <asm/..> and probably not
<linux/platform_device.h> above.
> +static void mpled_timer_toggle(unsigned long data)
> +{
> + struct motionpro_led *mpled = (struct motionpro_led *) data;
^
Unnecessary space.
> +static int __devinit mpled_probe(struct of_device *op, const struct of_device_id *match)
Split this line.
> +{
> + struct motionpro_led *mpled;
> + const unsigned int *of_blink_delay = NULL;
You don't need to initialise this as you assign it before you use it.
> + int err = 0;
Same here.
> + if ((err = led_classdev_register(NULL, &mpled->mpled_cdev))) {
We would normally do the assignment separately from the check, so:
err = led_classdev_register(NULL, &mpled->mpled_cdev);
if (err) {
> +static struct of_platform_driver mpled_driver = {
> + .owner = THIS_MODULE,
> + .name = "leds-motionpro",
> + .match_table = mpled_match,
> + .probe = mpled_probe,
> + .remove = mpled_remove,
> +};
You should now use the name and owner fields of the embedded struct
device_driver, so:
static struct of_platform_driver mpled_driver = {
.match_table = mpled_match,
.probe = mpled_probe,
.remove = mpled_remove,
.driver = {
.owner = THIS_MODULE,
.name = "leds-motionpro",
},
};
--
Cheers,
Stephen Rothwell sfr at canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20071104/95fbb83d/attachment.pgp>
More information about the Linuxppc-dev
mailing list