Commit c49d6cab authored by Marek Behún's avatar Marek Behún Committed by Pavel Machek
Browse files

leds: parse linux,default-trigger DT property in LED core



Do the parsing of `linux,default-trigger` DT property to LED core.
Currently it is done in many different drivers and the code is repeated.

This patch removes the parsing from 23 drivers:
  an30259a, aw2013, bcm6328, bcm6358, cr0014114, el15203000, gpio,
  is31fl32xx, lm3532, lm36274, lm3692x, lm3697, lp50xx, lp8860, lt3593,
  max77650, mt6323, ns2, pm8058, pwm, syscon, tlc591xx and turris-omnia.

There is one driver in drivers/input which parses this property on it's
own. I shall send a separate patch there after this is applied.

There are still 8 drivers that parse this property on their own because
they do not pass the led_init_data structure to the registering
function. I will try to refactor those in the future.

Signed-off-by: default avatarMarek Behún <marek.behun@nic.cz>
Signed-off-by: default avatarPavel Machek <pavel@ucw.cz>
parent 00663196
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -354,6 +354,11 @@ int led_classdev_register_ext(struct device *parent,
		ret = led_compose_name(parent, init_data, composed_name);
		if (ret < 0)
			return ret;

		if (init_data->fwnode)
			fwnode_property_read_string(init_data->fwnode,
				"linux,default-trigger",
				&led_cdev->default_trigger);
	} else {
		proposed_name = led_cdev->name;
	}
+0 −3
Original line number Diff line number Diff line
@@ -238,9 +238,6 @@ static int an30259a_dt_init(struct i2c_client *client,
				led->default_state = STATE_OFF;
		}

		of_property_read_string(child, "linux,default-trigger",
					&led->cdev.default_trigger);

		i++;
	}

+0 −3
Original line number Diff line number Diff line
@@ -297,9 +297,6 @@ static int aw2013_probe_dt(struct aw2013 *chip)
				 "DT property led-max-microamp is missing\n");
		}

		of_property_read_string(child, "linux,default-trigger",
					&led->cdev.default_trigger);

		led->cdev.brightness_set_blocking = aw2013_brightness_set;
		led->cdev.blink_set = aw2013_blink_set;

+0 −4
Original line number Diff line number Diff line
@@ -346,10 +346,6 @@ static int bcm6328_led(struct device *dev, struct device_node *nc, u32 reg,
	if (of_property_read_bool(nc, "active-low"))
		led->active_low = true;

	led->cdev.default_trigger = of_get_property(nc,
						    "linux,default-trigger",
						    NULL);

	if (!of_property_read_string(nc, "default-state", &state)) {
		if (!strcmp(state, "on")) {
			led->cdev.brightness = LED_FULL;
+0 −4
Original line number Diff line number Diff line
@@ -110,10 +110,6 @@ static int bcm6358_led(struct device *dev, struct device_node *nc, u32 reg,
	if (of_property_read_bool(nc, "active-low"))
		led->active_low = true;

	led->cdev.default_trigger = of_get_property(nc,
						    "linux,default-trigger",
						    NULL);

	if (!of_property_read_string(nc, "default-state", &state)) {
		if (!strcmp(state, "on")) {
			led->cdev.brightness = LED_FULL;
Loading