Re: [PATCH v4 02/26] leds: class: Improve LED and LED flash class registration API

From: Jacek Anaszewski
Date: Wed Apr 24 2019 - 14:05:07 EST

Hi Pavel,

Thanks for the review.

On 4/24/19 3:46 PM, Pavel Machek wrote:

Signed-off-by: Jacek Anaszewski <jacek.anaszewski@xxxxxxxxx>
Cc: Baolin Wang <>

Acked-by: Pavel Machek <pavel@xxxxxx>

+ * led_classdev_register_ext - register a new object of LED class with
+ * init data
+ * @parent: LED controller device this LED is driven by
+ * @led_cdev: the led_classdev structure for this device
+ * @init_data: the LED class device initialization data
+ *
+ * Returns: 0 on success or negative error value on failure
+ */
+extern int led_classdev_register_ext(struct device *parent,
+ struct led_classdev *led_cdev,
+ struct led_init_data *init_data);
+#define led_classdev_register(parent, led_cdev) \
+ led_classdev_register_ext(parent, led_cdev, NULL)
+extern int devm_led_classdev_register_ext(struct device *parent,
+ struct led_classdev *led_cdev,
+ struct led_init_data *init_data);
+#define devm_led_classdev_register(parent, led_cdev) \
+ devm_led_classdev_register_ext(parent, led_cdev, NULL)

Static inline (instead of macro) might be preffered. More type safety
and less confusing behaviour in case of errors...

This is kind of alias. You have type control in the function being
mapped. With inline we'd have to nest the function calls, i.e.
it will worsen performance by this one additional call level.

Best regards,
Jacek Anaszewski