Re: [PATCH/RFC v3 1/7] leds: Add led_set_brightness_sync to the public LED subsystem API

From: Jacek Anaszewski
Date: Mon Jul 06 2015 - 02:31:36 EST


On 07/05/2015 02:34 PM, Pavel Machek wrote:
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?

Right, thanks.

--
Best Regards,
Jacek Anaszewski
--
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/