lkml.org 
[lkml]   [2018]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH RESEND 2/3] leds: upboard: Add LED support
On Sat 2018-04-21 09:50:08, Javier Arteaga wrote:
> Allow userspace to use the on-board LEDs as "upboard:<color>:".
>
> Signed-off-by: Javier Arteaga <javier@emutex.com>

> +static enum led_brightness upboard_led_brightness_get(struct led_classdev *cdev)
> +{
> + struct upboard_led *led = container_of(cdev, struct upboard_led, cdev);
> + int brightness = 0;
> +
> + regmap_field_read(led->field, &brightness);
> +
> + return brightness;
> +};

I'm slightly confused here. Is each led controlled by single bit?

> +static void upboard_led_brightness_set(struct led_classdev *cdev,
> + enum led_brightness brightness)
> +{
> + struct upboard_led *led = container_of(cdev, struct upboard_led, cdev);
> +
> + regmap_field_write(led->field, brightness != LED_OFF);
> +};

What is going on with ";" at end of function? We don't do that.

If it is single bit, max_brightness should be one, and != LED_OFF test
should not be needed.

Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2018-04-25 08:41    [W:0.356 / U:1.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site