diff mbox series

leds: lt3593: Move GPIO node from child to device node

Message ID 20180626202252.6127-1-daniel@zonque.org
State Changes Requested, archived
Headers show
Series leds: lt3593: Move GPIO node from child to device node | expand

Commit Message

Daniel Mack June 26, 2018, 8:22 p.m. UTC
Move the GPIO node from the child node to the device node as it
is a property of the chip, not of the LED.

Reported-by: Rob Herring <robh@kernel.org>
Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 .../devicetree/bindings/leds/leds-lt3593.txt         | 10 ++++------
 drivers/leds/leds-lt3593.c                           | 12 ++++--------
 2 files changed, 8 insertions(+), 14 deletions(-)

Comments

Jacek Anaszewski June 27, 2018, 5:59 p.m. UTC | #1
Hi Daniel,

Thank you for the patch.

Could you please just squash these changes to the original patch set
and resend?
There is no reason to come up with the incremental patch
if the original ones are not in the mainline yet.

Best regards,
Jacek Anaszewski

On 06/26/2018 10:22 PM, Daniel Mack wrote:
> Move the GPIO node from the child node to the device node as it
> is a property of the chip, not of the LED.
> 
> Reported-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Daniel Mack <daniel@zonque.org>
> ---
>   .../devicetree/bindings/leds/leds-lt3593.txt         | 10 ++++------
>   drivers/leds/leds-lt3593.c                           | 12 ++++--------
>   2 files changed, 8 insertions(+), 14 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/leds/leds-lt3593.txt b/Documentation/devicetree/bindings/leds/leds-lt3593.txt
> index b31d427448f8..6b2cabc36c0c 100644
> --- a/Documentation/devicetree/bindings/leds/leds-lt3593.txt
> +++ b/Documentation/devicetree/bindings/leds/leds-lt3593.txt
> @@ -1,15 +1,13 @@
>   Bindings for Linear Technologies LT3593 LED controller
>   
>   Required properties:
> -- compatible:	Should be "lltc,lt3593".
> +- compatible:		Should be "lltc,lt3593".
> +- lltc,ctrl-gpios:	A handle to the GPIO that is connected to the 'CTRL'
> +			pin of the chip.
>   
>   The hardware supports only one LED. The properties of this LED are
>   configured in a sub-node in the device node.
>   
> -Required sub-node properties:
> -- gpios:	A handle to the GPIO that is connected to the 'CTRL'
> -		pin of the chip.
> -
>   Optional sub-node properties:
>   - label:	A label for the LED. If none is given, the LED will be
>   		named "lt3595::".
> @@ -25,10 +23,10 @@ Example:
>   
>   led-controller {
>   	compatible = "lltc,lt3593";
> +	lltc,ctrl-gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
>   
>   	led {
>   		label = "white:backlight";
> -		gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
>   		default-state = "on";
>   	};
>   };
> diff --git a/drivers/leds/leds-lt3593.c b/drivers/leds/leds-lt3593.c
> index f6aae616242e..9d4896aa8475 100644
> --- a/drivers/leds/leds-lt3593.c
> +++ b/drivers/leds/leds-lt3593.c
> @@ -133,6 +133,10 @@ static int lt3593_led_probe(struct platform_device *pdev)
>   		return -EINVAL;
>   	}
>   
> +	led_data->gpiod = devm_gpiod_get(dev, "lltc,ctrl", 0);
> +	if (IS_ERR(led_data->gpiod))
> +		return PTR_ERR(led_data->gpiod);
> +
>   	child = device_get_next_child_node(dev, NULL);
>   
>   	ret = fwnode_property_read_string(child, "label", &tmp);
> @@ -156,14 +160,6 @@ static int lt3593_led_probe(struct platform_device *pdev)
>   		}
>   	}
>   
> -	led_data->gpiod = devm_fwnode_get_gpiod_from_child(dev, NULL, child,
> -							   flags,
> -							   led_data->name);
> -	if (IS_ERR(led_data->gpiod)) {
> -		fwnode_handle_put(child);
> -		return PTR_ERR(led_data->gpiod);
> -	}
> -
>   	led_data->cdev.name = led_data->name;
>   	led_data->cdev.brightness_set_blocking = lt3593_led_set;
>   	led_data->cdev.brightness = state ? LED_FULL : LED_OFF;
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Daniel Mack June 27, 2018, 6:47 p.m. UTC | #2
Hi,

On Wednesday, June 27, 2018 07:59 PM, Jacek Anaszewski wrote:
> Hi Daniel,
> 
> Thank you for the patch.
> 
> Could you please just squash these changes to the original patch set
> and resend?
> There is no reason to come up with the incremental patch
> if the original ones are not in the mainline yet.

Ah, sure. Will resend. The series will also contain a squashed fix for 
that "GPL v2" in the module information block.


Thanks,
Daniel
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/leds/leds-lt3593.txt b/Documentation/devicetree/bindings/leds/leds-lt3593.txt
index b31d427448f8..6b2cabc36c0c 100644
--- a/Documentation/devicetree/bindings/leds/leds-lt3593.txt
+++ b/Documentation/devicetree/bindings/leds/leds-lt3593.txt
@@ -1,15 +1,13 @@ 
 Bindings for Linear Technologies LT3593 LED controller
 
 Required properties:
-- compatible:	Should be "lltc,lt3593".
+- compatible:		Should be "lltc,lt3593".
+- lltc,ctrl-gpios:	A handle to the GPIO that is connected to the 'CTRL'
+			pin of the chip.
 
 The hardware supports only one LED. The properties of this LED are
 configured in a sub-node in the device node.
 
-Required sub-node properties:
-- gpios:	A handle to the GPIO that is connected to the 'CTRL'
-		pin of the chip.
-
 Optional sub-node properties:
 - label:	A label for the LED. If none is given, the LED will be
 		named "lt3595::".
@@ -25,10 +23,10 @@  Example:
 
 led-controller {
 	compatible = "lltc,lt3593";
+	lltc,ctrl-gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
 
 	led {
 		label = "white:backlight";
-		gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
 		default-state = "on";
 	};
 };
diff --git a/drivers/leds/leds-lt3593.c b/drivers/leds/leds-lt3593.c
index f6aae616242e..9d4896aa8475 100644
--- a/drivers/leds/leds-lt3593.c
+++ b/drivers/leds/leds-lt3593.c
@@ -133,6 +133,10 @@  static int lt3593_led_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
+	led_data->gpiod = devm_gpiod_get(dev, "lltc,ctrl", 0);
+	if (IS_ERR(led_data->gpiod))
+		return PTR_ERR(led_data->gpiod);
+
 	child = device_get_next_child_node(dev, NULL);
 
 	ret = fwnode_property_read_string(child, "label", &tmp);
@@ -156,14 +160,6 @@  static int lt3593_led_probe(struct platform_device *pdev)
 		}
 	}
 
-	led_data->gpiod = devm_fwnode_get_gpiod_from_child(dev, NULL, child,
-							   flags,
-							   led_data->name);
-	if (IS_ERR(led_data->gpiod)) {
-		fwnode_handle_put(child);
-		return PTR_ERR(led_data->gpiod);
-	}
-
 	led_data->cdev.name = led_data->name;
 	led_data->cdev.brightness_set_blocking = lt3593_led_set;
 	led_data->cdev.brightness = state ? LED_FULL : LED_OFF;