Re: [PATCH/RFC v3 1/7] leds: Add led_set_brightness_sync to the public LED subsystem API
From: Pavel Machek
Date: Sun Jul 05 2015 - 08:34:59 EST
Hi!
> extern void led_set_brightness(struct led_classdev *led_cdev,
> enum led_brightness brightness);
> +
> +/**
> + * led_set_brightness_sync - set LED brightness synchronously
> + * @led_cdev: the LED to set
> + * @brightness: the brightness to set it to
> + *
> + * Set an LED's brightness immediately. This function will block
> + * the caller for the time required for accessing device register,
> + * and it can sleep.
> + */
> +static inline int led_set_brightness_sync(struct led_classdev *led_cdev,
> + enum led_brightness value)
> +{
> + int ret = 0;
> +
> + led_cdev->brightness = min(value, led_cdev->max_brightness);
> +
> + if (led_cdev->flags & LED_SUSPENDED)
> + return 0;
> +
> + if (led_cdev->brightness_set_sync)
> + ret = led_cdev->brightness_set_sync(led_cdev,
> + led_cdev->brightness);
> + else
> + led_cdev->brightness_set(led_cdev, led_cdev->brightness);
> +
> + return 0;
> +}
return ret, AFAICT?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/