lkml.org 
[lkml]   [2012]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] add led driver for Bachmann's ot200
On 01/09/2012 11:24 AM, Christian Gmeiner wrote:
> From a7fecf3426ef98fdd19e9d2610665b9d1ce358a0 Mon Sep 17 00:00:00 2001
> From: Sebastian Andrzej Siewior <bigeasy@linutronix.de
> <mailto:bigeasy@linutronix.de>>
> Date: Mon, 9 Jan 2012 10:09:50 +0100
> Subject: [PATCH v2] add led driver for Bachmann's ot200
>
> This patch adds support for leds on Bachmann's ot200 visualisation device.
> The device has three leds on the back panel (led_err, led_init and led_run)
> and can handle up to seven leds on the front panel.
>
> The driver was written by Linutronix on behalf of
> Bachmann electronic GmbH.
>
> Changes in v2:
> - *incorporated* feedback from Andrew Morton and Lars-Peter Clausen
>

looks good to me except some minor style issues and the <mailto:...> tags.

> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de
> <mailto:bigeasy@linutronix.de>>
> Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com
> <mailto:christian.gmeiner@gmail.com>>
> ---
> [...]
> diff --git a/drivers/leds/leds-ot200.c b/drivers/leds/leds-ot200.c
> new file mode 100644
> index 0000000..4d000ac
> --- /dev/null
> +++ b/drivers/leds/leds-ot200.c
> @@ -0,0 +1,177 @@
> [...]
> +
> +static int __devinit ot200_led_probe(struct platform_device *pdev)
> +{
> + int i;
> + int ret;
> +
> + for (i = 0; i < ARRAY_SIZE(leds); i++) {
> +
> + leds[i].cdev.name = leds[i].name;
> + leds[i].cdev.default_trigger = NULL;
> + leds[i].cdev.blink_set = NULL;

No need to initialize to NULL.

> + leds[i].cdev.brightness_set = ot200_led_brightness_set;
> +
> + ret = led_classdev_register(&pdev->dev, &leds[i].cdev);
> + if (ret < 0)
> + goto err;
> +
> + dev_set_drvdata(leds[i].cdev.dev, &leds[i]);

Neither this ...

> + }
> +
> + platform_set_drvdata(pdev, leds);

nor this is ever used.

> +
> + outb(0x0, 0x49); /* turn off all front leds */
> + outb(0x2, 0x5a); /* turn on init led */
> + leds_front = 0;
> + leds_back = BIT(1);

Maybe initialize leds_front and leds_back first and pass it to outb.

> +
> + return 0;
> +
> +err:
> + for (i = i - 1; i >= 0; i--)
> + led_classdev_unregister(&leds[i].cdev);
> +
> + return ret;
> +}
> +


\
 
 \ /
  Last update: 2012-01-09 13:53    [W:4.404 / U:1.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site