Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d0d480cc authored by Johan Hovold's avatar Johan Hovold Committed by Bryan Wu
Browse files

leds: add led-class attribute-group support



Allow led-class devices to be created with optional attribute groups.

This is needed in order to allow led drivers to create custom device
attributes in a race-free manner.

Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarBryan Wu <cooloney@gmail.com>
parent a497c3ba
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -210,7 +210,8 @@ static const struct dev_pm_ops leds_class_dev_pm_ops = {
 */
int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
{
	led_cdev->dev = device_create(leds_class, parent, 0, led_cdev,
	led_cdev->dev = device_create_with_groups(leds_class, parent, 0,
					led_cdev, led_cdev->groups,
					"%s", led_cdev->name);
	if (IS_ERR(led_cdev->dev))
		return PTR_ERR(led_cdev->dev);
+2 −0
Original line number Diff line number Diff line
@@ -63,6 +63,8 @@ struct led_classdev {
				     unsigned long *delay_off);

	struct device		*dev;
	const struct attribute_group	**groups;

	struct list_head	 node;			/* LED Device list */
	const char		*default_trigger;	/* Trigger to use */