linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/9] backlight: qcom-wled: fix and solidify handling of enabled-strings
@ 2021-11-15 20:34 Marijn Suijten
  2021-11-15 20:34 ` [PATCH v3 1/9] backlight: qcom-wled: Validate enabled string indices in DT Marijn Suijten
                   ` (9 more replies)
  0 siblings, 10 replies; 26+ messages in thread
From: Marijn Suijten @ 2021-11-15 20:34 UTC (permalink / raw)
  To: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring, Lee Jones,
	Daniel Thompson, Jingoo Han
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Jami Kettunen, Pavel Dubrova,
	Marijn Suijten, Kiran Gunda, Bryan Wu, linux-arm-msm, devicetree,
	linux-kernel, dri-devel, linux-fbdev

This patchset fixes WLED's handling of enabled-strings: besides some
cleanup it is now actually possible to specify a non-contiguous array of
enabled strings (not necessarily starting at zero) and the values from
DT are now validated to prevent possible unexpected out-of-bounds
register and array element accesses.
Off-by-one mistakes in the maximum number of strings, also causing
out-of-bounds access, have been addressed as well.

Changes in v3:
- Use __le16 type for cpu_to_le16 result;
- Reword ambiguity warning between qcom,num-strings and
  qcom,enabled-strings to explain that only one should/needs to be set;
- Move this warning from patch 4 patch 5, where the length of
  qcom,enabled-strings starts to be taken into account;
- Drop DT patches that have been picked up in the qcom tree.

v2: https://lore.kernel.org/lkml/20211112002706.453289-1-marijn.suijten@somainline.org/T

Changes in v2:
- Reordered patch 4/10 (Validate enabled string indices in DT) to sit
  before patch 1/10 (Pass number of elements to read to read_u32_array);
- Pulled qcom,num-strings out of the DT enumeration parser, and moved it
  after qcom,enabled-strings parser to always have final sign-off over
  the number of strings;
- Extra validation for this number of strings against
  qcom,enabled-strings;
- Recombined patch 9 (Consistently use enabled-strings in
  set_brightness) and patch 10 (Consider enabled_strings in
  autodetection), which both solve the same problem in two different
  functions.  In addition the autodetection code uses set_brightness as
  helper already;
- Improved DT configurations for pmi8994 and pm660l, currently in 5.15
  rc's.

v1: https://lore.kernel.org/dri-devel/20211004192741.621870-1-marijn.suijten@somainline.org/T

Marijn Suijten (9):
  backlight: qcom-wled: Validate enabled string indices in DT
  backlight: qcom-wled: Pass number of elements to read to
    read_u32_array
  backlight: qcom-wled: Use cpu_to_le16 macro to perform conversion
  backlight: qcom-wled: Fix off-by-one maximum with default num_strings
  backlight: qcom-wled: Override default length with
    qcom,enabled-strings
  backlight: qcom-wled: Remove unnecessary 4th default string in WLED3
  backlight: qcom-wled: Provide enabled_strings default for WLED 4 and 5
  backlight: qcom-wled: Remove unnecessary double whitespace
  backlight: qcom-wled: Respect enabled-strings in set_brightness

 drivers/video/backlight/qcom-wled.c | 130 +++++++++++++++-------------
 1 file changed, 72 insertions(+), 58 deletions(-)


base-commit: fa55b7dcdc43c1aa1ba12bca9d2dd4318c2a0dbf
--
2.33.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH v3 1/9] backlight: qcom-wled: Validate enabled string indices in DT
  2021-11-15 20:34 [PATCH v3 0/9] backlight: qcom-wled: fix and solidify handling of enabled-strings Marijn Suijten
@ 2021-11-15 20:34 ` Marijn Suijten
  2021-12-22 11:15   ` Lee Jones
  2021-11-15 20:34 ` [PATCH v3 2/9] backlight: qcom-wled: Pass number of elements to read to read_u32_array Marijn Suijten
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 26+ messages in thread
From: Marijn Suijten @ 2021-11-15 20:34 UTC (permalink / raw)
  To: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring, Lee Jones,
	Daniel Thompson, Jingoo Han
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Jami Kettunen, Pavel Dubrova,
	Marijn Suijten, Kiran Gunda, Bryan Wu, linux-arm-msm, devicetree,
	linux-kernel, dri-devel, linux-fbdev

The strings passed in DT may possibly cause out-of-bounds register
accesses and should be validated before use.

Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED3")
Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
---
 drivers/video/backlight/qcom-wled.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c
index d094299c2a48..8a42ed89c59c 100644
--- a/drivers/video/backlight/qcom-wled.c
+++ b/drivers/video/backlight/qcom-wled.c
@@ -1528,12 +1528,28 @@ static int wled_configure(struct wled *wled)
 	string_len = of_property_count_elems_of_size(dev->of_node,
 						     "qcom,enabled-strings",
 						     sizeof(u32));
-	if (string_len > 0)
+	if (string_len > 0) {
+		if (string_len > wled->max_string_count) {
+			dev_err(dev, "Cannot have more than %d strings\n",
+				wled->max_string_count);
+			return -EINVAL;
+		}
+
 		of_property_read_u32_array(dev->of_node,
 						"qcom,enabled-strings",
 						wled->cfg.enabled_strings,
 						sizeof(u32));
 
+		for (i = 0; i < string_len; ++i) {
+			if (wled->cfg.enabled_strings[i] >= wled->max_string_count) {
+				dev_err(dev,
+					"qcom,enabled-strings index %d at %d is out of bounds\n",
+					wled->cfg.enabled_strings[i], i);
+				return -EINVAL;
+			}
+		}
+	}
+
 	return 0;
 }
 
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v3 2/9] backlight: qcom-wled: Pass number of elements to read to read_u32_array
  2021-11-15 20:34 [PATCH v3 0/9] backlight: qcom-wled: fix and solidify handling of enabled-strings Marijn Suijten
  2021-11-15 20:34 ` [PATCH v3 1/9] backlight: qcom-wled: Validate enabled string indices in DT Marijn Suijten
@ 2021-11-15 20:34 ` Marijn Suijten
  2021-12-22 11:15   ` Lee Jones
  2021-11-15 20:34 ` [PATCH v3 3/9] backlight: qcom-wled: Use cpu_to_le16 macro to perform conversion Marijn Suijten
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 26+ messages in thread
From: Marijn Suijten @ 2021-11-15 20:34 UTC (permalink / raw)
  To: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring, Lee Jones,
	Daniel Thompson, Jingoo Han
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Jami Kettunen, Pavel Dubrova,
	Marijn Suijten, Kiran Gunda, Bryan Wu, linux-arm-msm, devicetree,
	linux-kernel, dri-devel, linux-fbdev

of_property_read_u32_array takes the number of elements to read as last
argument. This does not always need to be 4 (sizeof(u32)) but should
instead be the size of the array in DT as read just above with
of_property_count_elems_of_size.

To not make such an error go unnoticed again the driver now bails
accordingly when of_property_read_u32_array returns an error.
Surprisingly the indentation of newlined arguments is lining up again
after prepending `rc = `.

Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED3")
Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
---
 drivers/video/backlight/qcom-wled.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c
index 8a42ed89c59c..d413b913fef3 100644
--- a/drivers/video/backlight/qcom-wled.c
+++ b/drivers/video/backlight/qcom-wled.c
@@ -1535,10 +1535,15 @@ static int wled_configure(struct wled *wled)
 			return -EINVAL;
 		}
 
-		of_property_read_u32_array(dev->of_node,
+		rc = of_property_read_u32_array(dev->of_node,
 						"qcom,enabled-strings",
 						wled->cfg.enabled_strings,
-						sizeof(u32));
+						string_len);
+		if (rc) {
+			dev_err(dev, "Failed to read %d elements from qcom,enabled-strings: %d\n",
+				string_len, rc);
+			return rc;
+		}
 
 		for (i = 0; i < string_len; ++i) {
 			if (wled->cfg.enabled_strings[i] >= wled->max_string_count) {
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v3 3/9] backlight: qcom-wled: Use cpu_to_le16 macro to perform conversion
  2021-11-15 20:34 [PATCH v3 0/9] backlight: qcom-wled: fix and solidify handling of enabled-strings Marijn Suijten
  2021-11-15 20:34 ` [PATCH v3 1/9] backlight: qcom-wled: Validate enabled string indices in DT Marijn Suijten
  2021-11-15 20:34 ` [PATCH v3 2/9] backlight: qcom-wled: Pass number of elements to read to read_u32_array Marijn Suijten
@ 2021-11-15 20:34 ` Marijn Suijten
  2021-11-16 11:56   ` Daniel Thompson
  2021-12-22 11:16   ` Lee Jones
  2021-11-15 20:34 ` [PATCH v3 4/9] backlight: qcom-wled: Fix off-by-one maximum with default num_strings Marijn Suijten
                   ` (6 subsequent siblings)
  9 siblings, 2 replies; 26+ messages in thread
From: Marijn Suijten @ 2021-11-15 20:34 UTC (permalink / raw)
  To: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring, Lee Jones,
	Daniel Thompson, Jingoo Han
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Jami Kettunen, Pavel Dubrova,
	Marijn Suijten, Kiran Gunda, Bryan Wu, linux-arm-msm, devicetree,
	linux-kernel, dri-devel, linux-fbdev

The kernel already provides appropriate primitives to perform endianness
conversion which should be used in favour of manual bit-wrangling.

Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
---
 drivers/video/backlight/qcom-wled.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c
index d413b913fef3..9d883e702134 100644
--- a/drivers/video/backlight/qcom-wled.c
+++ b/drivers/video/backlight/qcom-wled.c
@@ -231,14 +231,14 @@ struct wled {
 static int wled3_set_brightness(struct wled *wled, u16 brightness)
 {
 	int rc, i;
-	u8 v[2];
+	__le16 v;
 
-	v[0] = brightness & 0xff;
-	v[1] = (brightness >> 8) & 0xf;
+	v = cpu_to_le16(brightness & WLED3_SINK_REG_BRIGHT_MAX);
 
 	for (i = 0;  i < wled->cfg.num_strings; ++i) {
 		rc = regmap_bulk_write(wled->regmap, wled->ctrl_addr +
-				       WLED3_SINK_REG_BRIGHT(i), v, 2);
+				       WLED3_SINK_REG_BRIGHT(i),
+				       &v, sizeof(v));
 		if (rc < 0)
 			return rc;
 	}
@@ -250,18 +250,18 @@ static int wled4_set_brightness(struct wled *wled, u16 brightness)
 {
 	int rc, i;
 	u16 low_limit = wled->max_brightness * 4 / 1000;
-	u8 v[2];
+	__le16 v;
 
 	/* WLED4's lower limit of operation is 0.4% */
 	if (brightness > 0 && brightness < low_limit)
 		brightness = low_limit;
 
-	v[0] = brightness & 0xff;
-	v[1] = (brightness >> 8) & 0xf;
+	v = cpu_to_le16(brightness & WLED3_SINK_REG_BRIGHT_MAX);
 
 	for (i = 0;  i < wled->cfg.num_strings; ++i) {
 		rc = regmap_bulk_write(wled->regmap, wled->sink_addr +
-				       WLED4_SINK_REG_BRIGHT(i), v, 2);
+				       WLED4_SINK_REG_BRIGHT(i),
+				       &v, sizeof(v));
 		if (rc < 0)
 			return rc;
 	}
@@ -273,21 +273,20 @@ static int wled5_set_brightness(struct wled *wled, u16 brightness)
 {
 	int rc, offset;
 	u16 low_limit = wled->max_brightness * 1 / 1000;
-	u8 v[2];
+	__le16 v;
 
 	/* WLED5's lower limit is 0.1% */
 	if (brightness < low_limit)
 		brightness = low_limit;
 
-	v[0] = brightness & 0xff;
-	v[1] = (brightness >> 8) & 0x7f;
+	v = cpu_to_le16(brightness & WLED5_SINK_REG_BRIGHT_MAX_15B);
 
 	offset = (wled->cfg.mod_sel == MOD_A) ?
 		  WLED5_SINK_REG_MOD_A_BRIGHTNESS_LSB :
 		  WLED5_SINK_REG_MOD_B_BRIGHTNESS_LSB;
 
 	rc = regmap_bulk_write(wled->regmap, wled->sink_addr + offset,
-			       v, 2);
+			       &v, sizeof(v));
 	return rc;
 }
 
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v3 4/9] backlight: qcom-wled: Fix off-by-one maximum with default num_strings
  2021-11-15 20:34 [PATCH v3 0/9] backlight: qcom-wled: fix and solidify handling of enabled-strings Marijn Suijten
                   ` (2 preceding siblings ...)
  2021-11-15 20:34 ` [PATCH v3 3/9] backlight: qcom-wled: Use cpu_to_le16 macro to perform conversion Marijn Suijten
@ 2021-11-15 20:34 ` Marijn Suijten
  2021-11-16 11:58   ` Daniel Thompson
  2021-12-22 11:16   ` Lee Jones
  2021-11-15 20:34 ` [PATCH v3 5/9] backlight: qcom-wled: Override default length with qcom,enabled-strings Marijn Suijten
                   ` (5 subsequent siblings)
  9 siblings, 2 replies; 26+ messages in thread
From: Marijn Suijten @ 2021-11-15 20:34 UTC (permalink / raw)
  To: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring, Lee Jones,
	Daniel Thompson, Jingoo Han
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Jami Kettunen, Pavel Dubrova,
	Marijn Suijten, Kiran Gunda, Bryan Wu, linux-arm-msm, devicetree,
	linux-kernel, dri-devel, linux-fbdev, Courtney Cavin

When not specifying num-strings in the DT the default is used, but +1 is
added to it which turns WLED3 into 4 and WLED4/5 into 5 strings instead
of 3 and 4 respectively, causing out-of-bounds reads and register
read/writes.  This +1 exists for a deficiency in the DT parsing code,
and is simply omitted entirely - solving this oob issue - by parsing the
property separately much like qcom,enabled-strings.

This also enables more stringent checks on the maximum value when
qcom,enabled-strings is provided in the DT, by parsing num-strings after
enabled-strings to allow it to check against (and in a subsequent patch
override) the length of enabled-strings: it is invalid to set
num-strings higher than that.
The DT currently utilizes it to get around an incorrect fixed read of
four elements from that array (has been addressed in a prior patch) by
setting a lower num-strings where desired.

Fixes: 93c64f1ea1e8 ("leds: add Qualcomm PM8941 WLED driver")
Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-By: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
---
 drivers/video/backlight/qcom-wled.c | 48 ++++++++++-------------------
 1 file changed, 16 insertions(+), 32 deletions(-)

diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c
index 9d883e702134..ab10910971e9 100644
--- a/drivers/video/backlight/qcom-wled.c
+++ b/drivers/video/backlight/qcom-wled.c
@@ -1255,21 +1255,6 @@ static const struct wled_var_cfg wled5_ovp_cfg = {
 	.size = 16,
 };
 
-static u32 wled3_num_strings_values_fn(u32 idx)
-{
-	return idx + 1;
-}
-
-static const struct wled_var_cfg wled3_num_strings_cfg = {
-	.fn = wled3_num_strings_values_fn,
-	.size = 3,
-};
-
-static const struct wled_var_cfg wled4_num_strings_cfg = {
-	.fn = wled3_num_strings_values_fn,
-	.size = 4,
-};
-
 static u32 wled3_switch_freq_values_fn(u32 idx)
 {
 	return 19200 / (2 * (1 + idx));
@@ -1343,11 +1328,6 @@ static int wled_configure(struct wled *wled)
 			.val_ptr = &cfg->switch_freq,
 			.cfg = &wled3_switch_freq_cfg,
 		},
-		{
-			.name = "qcom,num-strings",
-			.val_ptr = &cfg->num_strings,
-			.cfg = &wled3_num_strings_cfg,
-		},
 	};
 
 	const struct wled_u32_opts wled4_opts[] = {
@@ -1371,11 +1351,6 @@ static int wled_configure(struct wled *wled)
 			.val_ptr = &cfg->switch_freq,
 			.cfg = &wled3_switch_freq_cfg,
 		},
-		{
-			.name = "qcom,num-strings",
-			.val_ptr = &cfg->num_strings,
-			.cfg = &wled4_num_strings_cfg,
-		},
 	};
 
 	const struct wled_u32_opts wled5_opts[] = {
@@ -1399,11 +1374,6 @@ static int wled_configure(struct wled *wled)
 			.val_ptr = &cfg->switch_freq,
 			.cfg = &wled3_switch_freq_cfg,
 		},
-		{
-			.name = "qcom,num-strings",
-			.val_ptr = &cfg->num_strings,
-			.cfg = &wled4_num_strings_cfg,
-		},
 		{
 			.name = "qcom,modulator-sel",
 			.val_ptr = &cfg->mod_sel,
@@ -1522,8 +1492,6 @@ static int wled_configure(struct wled *wled)
 			*bool_opts[i].val_ptr = true;
 	}
 
-	cfg->num_strings = cfg->num_strings + 1;
-
 	string_len = of_property_count_elems_of_size(dev->of_node,
 						     "qcom,enabled-strings",
 						     sizeof(u32));
@@ -1554,6 +1522,22 @@ static int wled_configure(struct wled *wled)
 		}
 	}
 
+	rc = of_property_read_u32(dev->of_node, "qcom,num-strings", &val);
+	if (!rc) {
+		if (val < 1 || val > wled->max_string_count) {
+			dev_err(dev, "qcom,num-strings must be between 1 and %d\n",
+				wled->max_string_count);
+			return -EINVAL;
+		}
+
+		if (string_len > 0 && val > string_len) {
+			dev_err(dev, "qcom,num-strings exceeds qcom,enabled-strings\n");
+			return -EINVAL;
+		}
+
+		cfg->num_strings = val;
+	}
+
 	return 0;
 }
 
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v3 5/9] backlight: qcom-wled: Override default length with qcom,enabled-strings
  2021-11-15 20:34 [PATCH v3 0/9] backlight: qcom-wled: fix and solidify handling of enabled-strings Marijn Suijten
                   ` (3 preceding siblings ...)
  2021-11-15 20:34 ` [PATCH v3 4/9] backlight: qcom-wled: Fix off-by-one maximum with default num_strings Marijn Suijten
@ 2021-11-15 20:34 ` Marijn Suijten
  2021-11-16 11:59   ` Daniel Thompson
  2021-12-22 11:17   ` Lee Jones
  2021-11-15 20:34 ` [PATCH v3 6/9] backlight: qcom-wled: Remove unnecessary 4th default string in WLED3 Marijn Suijten
                   ` (4 subsequent siblings)
  9 siblings, 2 replies; 26+ messages in thread
From: Marijn Suijten @ 2021-11-15 20:34 UTC (permalink / raw)
  To: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring, Lee Jones,
	Daniel Thompson, Jingoo Han
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Jami Kettunen, Pavel Dubrova,
	Marijn Suijten, Kiran Gunda, Bryan Wu, linux-arm-msm, devicetree,
	linux-kernel, dri-devel, linux-fbdev

The length of qcom,enabled-strings as property array is enough to
determine the number of strings to be enabled, without needing to set
qcom,num-strings to override the default number of strings when less
than the default (which is also the maximum) is provided in DT.

This also introduces an extra warning when qcom,num-strings is set,
denoting that it is not necessary to set both anymore.  It is usually
more concise to set just qcom,num-length when a zero-based, contiguous
range of strings is needed (the majority of the cases), or to only set
qcom,enabled-strings when a specific set of indices is desired.

Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED3")
Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
---
 drivers/video/backlight/qcom-wled.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c
index ab10910971e9..5306b06044b4 100644
--- a/drivers/video/backlight/qcom-wled.c
+++ b/drivers/video/backlight/qcom-wled.c
@@ -1520,6 +1520,8 @@ static int wled_configure(struct wled *wled)
 				return -EINVAL;
 			}
 		}
+
+		cfg->num_strings = string_len;
 	}
 
 	rc = of_property_read_u32(dev->of_node, "qcom,num-strings", &val);
@@ -1530,9 +1532,13 @@ static int wled_configure(struct wled *wled)
 			return -EINVAL;
 		}
 
-		if (string_len > 0 && val > string_len) {
-			dev_err(dev, "qcom,num-strings exceeds qcom,enabled-strings\n");
-			return -EINVAL;
+		if (string_len > 0) {
+			dev_warn(dev, "Only one of qcom,num-strings or qcom,enabled-strings"
+				      " should be set\n");
+			if (val > string_len) {
+				dev_err(dev, "qcom,num-strings exceeds qcom,enabled-strings\n");
+				return -EINVAL;
+			}
 		}
 
 		cfg->num_strings = val;
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v3 6/9] backlight: qcom-wled: Remove unnecessary 4th default string in WLED3
  2021-11-15 20:34 [PATCH v3 0/9] backlight: qcom-wled: fix and solidify handling of enabled-strings Marijn Suijten
                   ` (4 preceding siblings ...)
  2021-11-15 20:34 ` [PATCH v3 5/9] backlight: qcom-wled: Override default length with qcom,enabled-strings Marijn Suijten
@ 2021-11-15 20:34 ` Marijn Suijten
  2021-12-22 11:17   ` Lee Jones
  2021-11-15 20:34 ` [PATCH v3 7/9] backlight: qcom-wled: Provide enabled_strings default for WLED 4 and 5 Marijn Suijten
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 26+ messages in thread
From: Marijn Suijten @ 2021-11-15 20:34 UTC (permalink / raw)
  To: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring, Lee Jones,
	Daniel Thompson, Jingoo Han
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Jami Kettunen, Pavel Dubrova,
	Marijn Suijten, Kiran Gunda, Bryan Wu, linux-arm-msm, devicetree,
	linux-kernel, dri-devel, linux-fbdev

The previous commit improves num_strings parsing to not go over the
maximum of 3 strings for WLED3 anymore.  Likewise this default index for
a hypothetical 4th string is invalid and could access registers that are
not mapped to the desired purpose.
Removing this value gets rid of undesired confusion and avoids the
possibility of accessing registers at this offset even if the 4th array
element is used by accident.

Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
---
 drivers/video/backlight/qcom-wled.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c
index 5306b06044b4..5c5df5a3deab 100644
--- a/drivers/video/backlight/qcom-wled.c
+++ b/drivers/video/backlight/qcom-wled.c
@@ -948,7 +948,7 @@ static const struct wled_config wled3_config_defaults = {
 	.cs_out_en = false,
 	.ext_gen = false,
 	.cabc = false,
-	.enabled_strings = {0, 1, 2, 3},
+	.enabled_strings = {0, 1, 2},
 };
 
 static int wled4_setup(struct wled *wled)
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v3 7/9] backlight: qcom-wled: Provide enabled_strings default for WLED 4 and 5
  2021-11-15 20:34 [PATCH v3 0/9] backlight: qcom-wled: fix and solidify handling of enabled-strings Marijn Suijten
                   ` (5 preceding siblings ...)
  2021-11-15 20:34 ` [PATCH v3 6/9] backlight: qcom-wled: Remove unnecessary 4th default string in WLED3 Marijn Suijten
@ 2021-11-15 20:34 ` Marijn Suijten
  2021-12-22 11:18   ` Lee Jones
  2021-11-15 20:34 ` [PATCH v3 8/9] backlight: qcom-wled: Remove unnecessary double whitespace Marijn Suijten
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 26+ messages in thread
From: Marijn Suijten @ 2021-11-15 20:34 UTC (permalink / raw)
  To: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring, Lee Jones,
	Daniel Thompson, Jingoo Han
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Jami Kettunen, Pavel Dubrova,
	Marijn Suijten, Kiran Gunda, Bryan Wu, linux-arm-msm, devicetree,
	linux-kernel, dri-devel, linux-fbdev

Only WLED 3 sets a sensible default that allows operating this driver
with just qcom,num-strings in the DT; WLED 4 and 5 require
qcom,enabled-strings to be provided otherwise enabled_strings remains
zero-initialized, resulting in every string-specific register write
(currently only the setup and config functions, brightness follows in a
future patch) to only configure the zero'th string multiple times.

Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
---
 drivers/video/backlight/qcom-wled.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c
index 5c5df5a3deab..f975c1f6398b 100644
--- a/drivers/video/backlight/qcom-wled.c
+++ b/drivers/video/backlight/qcom-wled.c
@@ -1079,6 +1079,7 @@ static const struct wled_config wled4_config_defaults = {
 	.cabc = false,
 	.external_pfet = false,
 	.auto_detection_enabled = false,
+	.enabled_strings = {0, 1, 2, 3},
 };
 
 static int wled5_setup(struct wled *wled)
@@ -1192,6 +1193,7 @@ static const struct wled_config wled5_config_defaults = {
 	.cabc = false,
 	.external_pfet = false,
 	.auto_detection_enabled = false,
+	.enabled_strings = {0, 1, 2, 3},
 };
 
 static const u32 wled3_boost_i_limit_values[] = {
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v3 8/9] backlight: qcom-wled: Remove unnecessary double whitespace
  2021-11-15 20:34 [PATCH v3 0/9] backlight: qcom-wled: fix and solidify handling of enabled-strings Marijn Suijten
                   ` (6 preceding siblings ...)
  2021-11-15 20:34 ` [PATCH v3 7/9] backlight: qcom-wled: Provide enabled_strings default for WLED 4 and 5 Marijn Suijten
@ 2021-11-15 20:34 ` Marijn Suijten
  2021-12-22 11:18   ` Lee Jones
  2021-11-15 20:34 ` [PATCH v3 9/9] backlight: qcom-wled: Respect enabled-strings in set_brightness Marijn Suijten
  2021-11-16 12:02 ` [PATCH v3 0/9] backlight: qcom-wled: fix and solidify handling of enabled-strings Daniel Thompson
  9 siblings, 1 reply; 26+ messages in thread
From: Marijn Suijten @ 2021-11-15 20:34 UTC (permalink / raw)
  To: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring, Lee Jones,
	Daniel Thompson, Jingoo Han
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Jami Kettunen, Pavel Dubrova,
	Marijn Suijten, Kiran Gunda, Bryan Wu, linux-arm-msm, devicetree,
	linux-kernel, dri-devel, linux-fbdev

Remove redundant spaces inside for loop conditions.  No other double
spaces were found that are not part of indentation with `[^\s]  `.

Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
---
 drivers/video/backlight/qcom-wled.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c
index f975c1f6398b..e2a78f4a9668 100644
--- a/drivers/video/backlight/qcom-wled.c
+++ b/drivers/video/backlight/qcom-wled.c
@@ -235,7 +235,7 @@ static int wled3_set_brightness(struct wled *wled, u16 brightness)
 
 	v = cpu_to_le16(brightness & WLED3_SINK_REG_BRIGHT_MAX);
 
-	for (i = 0;  i < wled->cfg.num_strings; ++i) {
+	for (i = 0; i < wled->cfg.num_strings; ++i) {
 		rc = regmap_bulk_write(wled->regmap, wled->ctrl_addr +
 				       WLED3_SINK_REG_BRIGHT(i),
 				       &v, sizeof(v));
@@ -258,7 +258,7 @@ static int wled4_set_brightness(struct wled *wled, u16 brightness)
 
 	v = cpu_to_le16(brightness & WLED3_SINK_REG_BRIGHT_MAX);
 
-	for (i = 0;  i < wled->cfg.num_strings; ++i) {
+	for (i = 0; i < wled->cfg.num_strings; ++i) {
 		rc = regmap_bulk_write(wled->regmap, wled->sink_addr +
 				       WLED4_SINK_REG_BRIGHT(i),
 				       &v, sizeof(v));
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v3 9/9] backlight: qcom-wled: Respect enabled-strings in set_brightness
  2021-11-15 20:34 [PATCH v3 0/9] backlight: qcom-wled: fix and solidify handling of enabled-strings Marijn Suijten
                   ` (7 preceding siblings ...)
  2021-11-15 20:34 ` [PATCH v3 8/9] backlight: qcom-wled: Remove unnecessary double whitespace Marijn Suijten
@ 2021-11-15 20:34 ` Marijn Suijten
  2021-12-22 11:18   ` Lee Jones
  2021-11-16 12:02 ` [PATCH v3 0/9] backlight: qcom-wled: fix and solidify handling of enabled-strings Daniel Thompson
  9 siblings, 1 reply; 26+ messages in thread
From: Marijn Suijten @ 2021-11-15 20:34 UTC (permalink / raw)
  To: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring, Lee Jones,
	Daniel Thompson, Jingoo Han
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Jami Kettunen, Pavel Dubrova,
	Marijn Suijten, Kiran Gunda, Bryan Wu, linux-arm-msm, devicetree,
	linux-kernel, dri-devel, linux-fbdev

The hardware is capable of controlling any non-contiguous sequence of
LEDs specified in the DT using qcom,enabled-strings as u32
array, and this also follows from the DT-bindings documentation.  The
numbers specified in this array represent indices of the LED strings
that are to be enabled and disabled.

Its value is appropriately used to setup and enable string modules, but
completely disregarded in the set_brightness paths which only iterate
over the number of strings linearly.
Take an example where only string 2 is enabled with
qcom,enabled_strings=<2>: this string is appropriately enabled but
subsequent brightness changes would have only touched the zero'th
brightness register because num_strings is 1 here.  This is simply
addressed by looking up the string for this index in the enabled_strings
array just like the other codepaths that iterate over num_strings.

Likewise enabled_strings is now also used in the autodetection path for
consistent behaviour: when a list of strings is specified in DT only
those strings will be probed for autodetection, analogous to how the
number of strings that need to be probed is already bound by
qcom,num-strings.  After all autodetection uses the set_brightness
helpers to set an initial value, which could otherwise end up changing
brightness on a different set of strings.

Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED3")
Fixes: 03b2b5e86986 ("backlight: qcom-wled: Add support for WLED4 peripheral")
Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
---
 drivers/video/backlight/qcom-wled.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c
index e2a78f4a9668..306bcc6ccb92 100644
--- a/drivers/video/backlight/qcom-wled.c
+++ b/drivers/video/backlight/qcom-wled.c
@@ -237,7 +237,7 @@ static int wled3_set_brightness(struct wled *wled, u16 brightness)
 
 	for (i = 0; i < wled->cfg.num_strings; ++i) {
 		rc = regmap_bulk_write(wled->regmap, wled->ctrl_addr +
-				       WLED3_SINK_REG_BRIGHT(i),
+				       WLED3_SINK_REG_BRIGHT(wled->cfg.enabled_strings[i]),
 				       &v, sizeof(v));
 		if (rc < 0)
 			return rc;
@@ -260,7 +260,7 @@ static int wled4_set_brightness(struct wled *wled, u16 brightness)
 
 	for (i = 0; i < wled->cfg.num_strings; ++i) {
 		rc = regmap_bulk_write(wled->regmap, wled->sink_addr +
-				       WLED4_SINK_REG_BRIGHT(i),
+				       WLED4_SINK_REG_BRIGHT(wled->cfg.enabled_strings[i]),
 				       &v, sizeof(v));
 		if (rc < 0)
 			return rc;
@@ -571,7 +571,7 @@ static irqreturn_t wled_short_irq_handler(int irq, void *_wled)
 
 static void wled_auto_string_detection(struct wled *wled)
 {
-	int rc = 0, i, delay_time_us;
+	int rc = 0, i, j, delay_time_us;
 	u32 sink_config = 0;
 	u8 sink_test = 0, sink_valid = 0, val;
 	bool fault_set;
@@ -618,14 +618,15 @@ static void wled_auto_string_detection(struct wled *wled)
 
 	/* Iterate through the strings one by one */
 	for (i = 0; i < wled->cfg.num_strings; i++) {
-		sink_test = BIT((WLED4_SINK_REG_CURR_SINK_SHFT + i));
+		j = wled->cfg.enabled_strings[i];
+		sink_test = BIT((WLED4_SINK_REG_CURR_SINK_SHFT + j));
 
 		/* Enable feedback control */
 		rc = regmap_write(wled->regmap, wled->ctrl_addr +
-				  WLED3_CTRL_REG_FEEDBACK_CONTROL, i + 1);
+				  WLED3_CTRL_REG_FEEDBACK_CONTROL, j + 1);
 		if (rc < 0) {
 			dev_err(wled->dev, "Failed to enable feedback for SINK %d rc = %d\n",
-				i + 1, rc);
+				j + 1, rc);
 			goto failed_detect;
 		}
 
@@ -634,7 +635,7 @@ static void wled_auto_string_detection(struct wled *wled)
 				  WLED4_SINK_REG_CURR_SINK, sink_test);
 		if (rc < 0) {
 			dev_err(wled->dev, "Failed to configure SINK %d rc=%d\n",
-				i + 1, rc);
+				j + 1, rc);
 			goto failed_detect;
 		}
 
@@ -661,7 +662,7 @@ static void wled_auto_string_detection(struct wled *wled)
 
 		if (fault_set)
 			dev_dbg(wled->dev, "WLED OVP fault detected with SINK %d\n",
-				i + 1);
+				j + 1);
 		else
 			sink_valid |= sink_test;
 
@@ -701,15 +702,16 @@ static void wled_auto_string_detection(struct wled *wled)
 	/* Enable valid sinks */
 	if (wled->version == 4) {
 		for (i = 0; i < wled->cfg.num_strings; i++) {
+			j = wled->cfg.enabled_strings[i];
 			if (sink_config &
-			    BIT(WLED4_SINK_REG_CURR_SINK_SHFT + i))
+			    BIT(WLED4_SINK_REG_CURR_SINK_SHFT + j))
 				val = WLED4_SINK_REG_STR_MOD_MASK;
 			else
 				/* Disable modulator_en for unused sink */
 				val = 0;
 
 			rc = regmap_write(wled->regmap, wled->sink_addr +
-					  WLED4_SINK_REG_STR_MOD_EN(i), val);
+					  WLED4_SINK_REG_STR_MOD_EN(j), val);
 			if (rc < 0) {
 				dev_err(wled->dev, "Failed to configure MODULATOR_EN rc=%d\n",
 					rc);
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 3/9] backlight: qcom-wled: Use cpu_to_le16 macro to perform conversion
  2021-11-15 20:34 ` [PATCH v3 3/9] backlight: qcom-wled: Use cpu_to_le16 macro to perform conversion Marijn Suijten
@ 2021-11-16 11:56   ` Daniel Thompson
  2021-12-22 11:16   ` Lee Jones
  1 sibling, 0 replies; 26+ messages in thread
From: Daniel Thompson @ 2021-11-16 11:56 UTC (permalink / raw)
  To: Marijn Suijten
  Cc: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring, Lee Jones,
	Jingoo Han, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	Jami Kettunen, Pavel Dubrova, Kiran Gunda, Bryan Wu,
	linux-arm-msm, devicetree, linux-kernel, dri-devel, linux-fbdev

On Mon, Nov 15, 2021 at 09:34:53PM +0100, Marijn Suijten wrote:
> The kernel already provides appropriate primitives to perform endianness
> conversion which should be used in favour of manual bit-wrangling.
> 
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>

Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>


Daniel.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 4/9] backlight: qcom-wled: Fix off-by-one maximum with default num_strings
  2021-11-15 20:34 ` [PATCH v3 4/9] backlight: qcom-wled: Fix off-by-one maximum with default num_strings Marijn Suijten
@ 2021-11-16 11:58   ` Daniel Thompson
  2021-12-22 11:16   ` Lee Jones
  1 sibling, 0 replies; 26+ messages in thread
From: Daniel Thompson @ 2021-11-16 11:58 UTC (permalink / raw)
  To: Marijn Suijten
  Cc: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring, Lee Jones,
	Jingoo Han, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	Jami Kettunen, Pavel Dubrova, Kiran Gunda, Bryan Wu,
	linux-arm-msm, devicetree, linux-kernel, dri-devel, linux-fbdev,
	Courtney Cavin

On Mon, Nov 15, 2021 at 09:34:54PM +0100, Marijn Suijten wrote:
> When not specifying num-strings in the DT the default is used, but +1 is
> added to it which turns WLED3 into 4 and WLED4/5 into 5 strings instead
> of 3 and 4 respectively, causing out-of-bounds reads and register
> read/writes.  This +1 exists for a deficiency in the DT parsing code,
> and is simply omitted entirely - solving this oob issue - by parsing the
> property separately much like qcom,enabled-strings.
> 
> This also enables more stringent checks on the maximum value when
> qcom,enabled-strings is provided in the DT, by parsing num-strings after
> enabled-strings to allow it to check against (and in a subsequent patch
> override) the length of enabled-strings: it is invalid to set
> num-strings higher than that.
> The DT currently utilizes it to get around an incorrect fixed read of
> four elements from that array (has been addressed in a prior patch) by
> setting a lower num-strings where desired.
> 
> Fixes: 93c64f1ea1e8 ("leds: add Qualcomm PM8941 WLED driver")
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> Reviewed-By: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>

Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>


Daniel.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 5/9] backlight: qcom-wled: Override default length with qcom,enabled-strings
  2021-11-15 20:34 ` [PATCH v3 5/9] backlight: qcom-wled: Override default length with qcom,enabled-strings Marijn Suijten
@ 2021-11-16 11:59   ` Daniel Thompson
  2021-12-22 11:17   ` Lee Jones
  1 sibling, 0 replies; 26+ messages in thread
From: Daniel Thompson @ 2021-11-16 11:59 UTC (permalink / raw)
  To: Marijn Suijten
  Cc: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring, Lee Jones,
	Jingoo Han, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	Jami Kettunen, Pavel Dubrova, Kiran Gunda, Bryan Wu,
	linux-arm-msm, devicetree, linux-kernel, dri-devel, linux-fbdev

On Mon, Nov 15, 2021 at 09:34:55PM +0100, Marijn Suijten wrote:
> The length of qcom,enabled-strings as property array is enough to
> determine the number of strings to be enabled, without needing to set
> qcom,num-strings to override the default number of strings when less
> than the default (which is also the maximum) is provided in DT.
> 
> This also introduces an extra warning when qcom,num-strings is set,
> denoting that it is not necessary to set both anymore.  It is usually
> more concise to set just qcom,num-length when a zero-based, contiguous
> range of strings is needed (the majority of the cases), or to only set
> qcom,enabled-strings when a specific set of indices is desired.
> 
> Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED3")
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>

Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>


Daniel.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 0/9] backlight: qcom-wled: fix and solidify handling of enabled-strings
  2021-11-15 20:34 [PATCH v3 0/9] backlight: qcom-wled: fix and solidify handling of enabled-strings Marijn Suijten
                   ` (8 preceding siblings ...)
  2021-11-15 20:34 ` [PATCH v3 9/9] backlight: qcom-wled: Respect enabled-strings in set_brightness Marijn Suijten
@ 2021-11-16 12:02 ` Daniel Thompson
  2021-11-16 15:42   ` Lee Jones
  9 siblings, 1 reply; 26+ messages in thread
From: Daniel Thompson @ 2021-11-16 12:02 UTC (permalink / raw)
  To: Lee Jones
  Cc: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring,
	Marijn Suijten, Jingoo Han, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	Jami Kettunen, Pavel Dubrova, Kiran Gunda, Bryan Wu,
	linux-arm-msm, devicetree, linux-kernel, dri-devel, linux-fbdev

Hi Lee

On Mon, Nov 15, 2021 at 09:34:50PM +0100, Marijn Suijten wrote:
> This patchset fixes WLED's handling of enabled-strings: besides some
> cleanup it is now actually possible to specify a non-contiguous array of
> enabled strings (not necessarily starting at zero) and the values from
> DT are now validated to prevent possible unexpected out-of-bounds
> register and array element accesses.
> Off-by-one mistakes in the maximum number of strings, also causing
> out-of-bounds access, have been addressed as well.

They have arrived piecemeal (during v1, v2 and v3) but all patches on
the set should now have my R-b: attached to them.


Daniel.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 0/9] backlight: qcom-wled: fix and solidify handling of enabled-strings
  2021-11-16 12:02 ` [PATCH v3 0/9] backlight: qcom-wled: fix and solidify handling of enabled-strings Daniel Thompson
@ 2021-11-16 15:42   ` Lee Jones
  2021-12-21 23:31     ` Marijn Suijten
  0 siblings, 1 reply; 26+ messages in thread
From: Lee Jones @ 2021-11-16 15:42 UTC (permalink / raw)
  To: Daniel Thompson
  Cc: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring,
	Marijn Suijten, Jingoo Han, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	Jami Kettunen, Pavel Dubrova, Kiran Gunda, Bryan Wu,
	linux-arm-msm, devicetree, linux-kernel, dri-devel, linux-fbdev

On Tue, 16 Nov 2021, Daniel Thompson wrote:

> Hi Lee
> 
> On Mon, Nov 15, 2021 at 09:34:50PM +0100, Marijn Suijten wrote:
> > This patchset fixes WLED's handling of enabled-strings: besides some
> > cleanup it is now actually possible to specify a non-contiguous array of
> > enabled strings (not necessarily starting at zero) and the values from
> > DT are now validated to prevent possible unexpected out-of-bounds
> > register and array element accesses.
> > Off-by-one mistakes in the maximum number of strings, also causing
> > out-of-bounds access, have been addressed as well.
> 
> They have arrived piecemeal (during v1, v2 and v3) but all patches on
> the set should now have my R-b: attached to them.

I can see that.  Nothing for you to worry about.

I'll apply these when I conduct my next sweep, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 0/9] backlight: qcom-wled: fix and solidify handling of enabled-strings
  2021-11-16 15:42   ` Lee Jones
@ 2021-12-21 23:31     ` Marijn Suijten
  2021-12-22 10:56       ` Lee Jones
  0 siblings, 1 reply; 26+ messages in thread
From: Marijn Suijten @ 2021-12-21 23:31 UTC (permalink / raw)
  To: Lee Jones
  Cc: Daniel Thompson, phone-devel, Andy Gross, Bjorn Andersson,
	Rob Herring, Jingoo Han, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	Jami Kettunen, Pavel Dubrova, Kiran Gunda, Bryan Wu,
	linux-arm-msm, devicetree, linux-kernel, dri-devel, linux-fbdev

On 2021-11-16 15:42:15, Lee Jones wrote:
> On Tue, 16 Nov 2021, Daniel Thompson wrote:
> 
> > Hi Lee
> > 
> > On Mon, Nov 15, 2021 at 09:34:50PM +0100, Marijn Suijten wrote:
> > > This patchset fixes WLED's handling of enabled-strings: besides some
> > > cleanup it is now actually possible to specify a non-contiguous array of
> > > enabled strings (not necessarily starting at zero) and the values from
> > > DT are now validated to prevent possible unexpected out-of-bounds
> > > register and array element accesses.
> > > Off-by-one mistakes in the maximum number of strings, also causing
> > > out-of-bounds access, have been addressed as well.
> > 
> > They have arrived piecemeal (during v1, v2 and v3) but all patches on
> > the set should now have my R-b: attached to them.
> 
> I can see that.  Nothing for you to worry about.
> 
> I'll apply these when I conduct my next sweep, thanks.

Thanks for that Lee!  Has the next sweep already passed by?  Seems
everyone is preparing for the 5.17 merge window but these patches
haven't yet landed on the backlight tree [1].  I'd appreciate it if we
can make them appear in the 5.17 window :)

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git/

Thanks!
- Marijn

> -- 
> Lee Jones [李琼斯]
> Senior Technical Lead - Developer Services
> Linaro.org │ Open source software for Arm SoCs
> Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 0/9] backlight: qcom-wled: fix and solidify handling of enabled-strings
  2021-12-21 23:31     ` Marijn Suijten
@ 2021-12-22 10:56       ` Lee Jones
  0 siblings, 0 replies; 26+ messages in thread
From: Lee Jones @ 2021-12-22 10:56 UTC (permalink / raw)
  To: Marijn Suijten, Daniel Thompson, phone-devel, Andy Gross,
	Bjorn Andersson, Rob Herring, Jingoo Han,
	~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Jami Kettunen, Pavel Dubrova,
	Kiran Gunda, Bryan Wu, linux-arm-msm, devicetree, linux-kernel,
	dri-devel, linux-fbdev

On Wed, 22 Dec 2021, Marijn Suijten wrote:

> On 2021-11-16 15:42:15, Lee Jones wrote:
> > On Tue, 16 Nov 2021, Daniel Thompson wrote:
> > 
> > > Hi Lee
> > > 
> > > On Mon, Nov 15, 2021 at 09:34:50PM +0100, Marijn Suijten wrote:
> > > > This patchset fixes WLED's handling of enabled-strings: besides some
> > > > cleanup it is now actually possible to specify a non-contiguous array of
> > > > enabled strings (not necessarily starting at zero) and the values from
> > > > DT are now validated to prevent possible unexpected out-of-bounds
> > > > register and array element accesses.
> > > > Off-by-one mistakes in the maximum number of strings, also causing
> > > > out-of-bounds access, have been addressed as well.
> > > 
> > > They have arrived piecemeal (during v1, v2 and v3) but all patches on
> > > the set should now have my R-b: attached to them.
> > 
> > I can see that.  Nothing for you to worry about.
> > 
> > I'll apply these when I conduct my next sweep, thanks.
> 
> Thanks for that Lee!  Has the next sweep already passed by?  Seems
> everyone is preparing for the 5.17 merge window but these patches
> haven't yet landed on the backlight tree [1].  I'd appreciate it if we
> can make them appear in the 5.17 window :)

No need to panic.

v5.17-rc1 isn't due to be cut for either 3.5 or 4.5 weeks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 1/9] backlight: qcom-wled: Validate enabled string indices in DT
  2021-11-15 20:34 ` [PATCH v3 1/9] backlight: qcom-wled: Validate enabled string indices in DT Marijn Suijten
@ 2021-12-22 11:15   ` Lee Jones
  0 siblings, 0 replies; 26+ messages in thread
From: Lee Jones @ 2021-12-22 11:15 UTC (permalink / raw)
  To: Marijn Suijten
  Cc: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring,
	Daniel Thompson, Jingoo Han, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	Jami Kettunen, Pavel Dubrova, Kiran Gunda, Bryan Wu,
	linux-arm-msm, devicetree, linux-kernel, dri-devel, linux-fbdev

On Mon, 15 Nov 2021, Marijn Suijten wrote:

> The strings passed in DT may possibly cause out-of-bounds register
> accesses and should be validated before use.
> 
> Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED3")
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
> ---
>  drivers/video/backlight/qcom-wled.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 2/9] backlight: qcom-wled: Pass number of elements to read to read_u32_array
  2021-11-15 20:34 ` [PATCH v3 2/9] backlight: qcom-wled: Pass number of elements to read to read_u32_array Marijn Suijten
@ 2021-12-22 11:15   ` Lee Jones
  0 siblings, 0 replies; 26+ messages in thread
From: Lee Jones @ 2021-12-22 11:15 UTC (permalink / raw)
  To: Marijn Suijten
  Cc: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring,
	Daniel Thompson, Jingoo Han, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	Jami Kettunen, Pavel Dubrova, Kiran Gunda, Bryan Wu,
	linux-arm-msm, devicetree, linux-kernel, dri-devel, linux-fbdev

On Mon, 15 Nov 2021, Marijn Suijten wrote:

> of_property_read_u32_array takes the number of elements to read as last
> argument. This does not always need to be 4 (sizeof(u32)) but should
> instead be the size of the array in DT as read just above with
> of_property_count_elems_of_size.
> 
> To not make such an error go unnoticed again the driver now bails
> accordingly when of_property_read_u32_array returns an error.
> Surprisingly the indentation of newlined arguments is lining up again
> after prepending `rc = `.
> 
> Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED3")
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
> ---
>  drivers/video/backlight/qcom-wled.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 3/9] backlight: qcom-wled: Use cpu_to_le16 macro to perform conversion
  2021-11-15 20:34 ` [PATCH v3 3/9] backlight: qcom-wled: Use cpu_to_le16 macro to perform conversion Marijn Suijten
  2021-11-16 11:56   ` Daniel Thompson
@ 2021-12-22 11:16   ` Lee Jones
  1 sibling, 0 replies; 26+ messages in thread
From: Lee Jones @ 2021-12-22 11:16 UTC (permalink / raw)
  To: Marijn Suijten
  Cc: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring,
	Daniel Thompson, Jingoo Han, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	Jami Kettunen, Pavel Dubrova, Kiran Gunda, Bryan Wu,
	linux-arm-msm, devicetree, linux-kernel, dri-devel, linux-fbdev

On Mon, 15 Nov 2021, Marijn Suijten wrote:

> The kernel already provides appropriate primitives to perform endianness
> conversion which should be used in favour of manual bit-wrangling.
> 
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
> ---
>  drivers/video/backlight/qcom-wled.c | 23 +++++++++++------------
>  1 file changed, 11 insertions(+), 12 deletions(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 4/9] backlight: qcom-wled: Fix off-by-one maximum with default num_strings
  2021-11-15 20:34 ` [PATCH v3 4/9] backlight: qcom-wled: Fix off-by-one maximum with default num_strings Marijn Suijten
  2021-11-16 11:58   ` Daniel Thompson
@ 2021-12-22 11:16   ` Lee Jones
  1 sibling, 0 replies; 26+ messages in thread
From: Lee Jones @ 2021-12-22 11:16 UTC (permalink / raw)
  To: Marijn Suijten
  Cc: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring,
	Daniel Thompson, Jingoo Han, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	Jami Kettunen, Pavel Dubrova, Kiran Gunda, Bryan Wu,
	linux-arm-msm, devicetree, linux-kernel, dri-devel, linux-fbdev,
	Courtney Cavin

On Mon, 15 Nov 2021, Marijn Suijten wrote:

> When not specifying num-strings in the DT the default is used, but +1 is
> added to it which turns WLED3 into 4 and WLED4/5 into 5 strings instead
> of 3 and 4 respectively, causing out-of-bounds reads and register
> read/writes.  This +1 exists for a deficiency in the DT parsing code,
> and is simply omitted entirely - solving this oob issue - by parsing the
> property separately much like qcom,enabled-strings.
> 
> This also enables more stringent checks on the maximum value when
> qcom,enabled-strings is provided in the DT, by parsing num-strings after
> enabled-strings to allow it to check against (and in a subsequent patch
> override) the length of enabled-strings: it is invalid to set
> num-strings higher than that.
> The DT currently utilizes it to get around an incorrect fixed read of
> four elements from that array (has been addressed in a prior patch) by
> setting a lower num-strings where desired.
> 
> Fixes: 93c64f1ea1e8 ("leds: add Qualcomm PM8941 WLED driver")
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> Reviewed-By: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
> ---
>  drivers/video/backlight/qcom-wled.c | 48 ++++++++++-------------------
>  1 file changed, 16 insertions(+), 32 deletions(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 5/9] backlight: qcom-wled: Override default length with qcom,enabled-strings
  2021-11-15 20:34 ` [PATCH v3 5/9] backlight: qcom-wled: Override default length with qcom,enabled-strings Marijn Suijten
  2021-11-16 11:59   ` Daniel Thompson
@ 2021-12-22 11:17   ` Lee Jones
  1 sibling, 0 replies; 26+ messages in thread
From: Lee Jones @ 2021-12-22 11:17 UTC (permalink / raw)
  To: Marijn Suijten
  Cc: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring,
	Daniel Thompson, Jingoo Han, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	Jami Kettunen, Pavel Dubrova, Kiran Gunda, Bryan Wu,
	linux-arm-msm, devicetree, linux-kernel, dri-devel, linux-fbdev

On Mon, 15 Nov 2021, Marijn Suijten wrote:

> The length of qcom,enabled-strings as property array is enough to
> determine the number of strings to be enabled, without needing to set
> qcom,num-strings to override the default number of strings when less
> than the default (which is also the maximum) is provided in DT.
> 
> This also introduces an extra warning when qcom,num-strings is set,
> denoting that it is not necessary to set both anymore.  It is usually
> more concise to set just qcom,num-length when a zero-based, contiguous
> range of strings is needed (the majority of the cases), or to only set
> qcom,enabled-strings when a specific set of indices is desired.
> 
> Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED3")
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
> ---
>  drivers/video/backlight/qcom-wled.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 6/9] backlight: qcom-wled: Remove unnecessary 4th default string in WLED3
  2021-11-15 20:34 ` [PATCH v3 6/9] backlight: qcom-wled: Remove unnecessary 4th default string in WLED3 Marijn Suijten
@ 2021-12-22 11:17   ` Lee Jones
  0 siblings, 0 replies; 26+ messages in thread
From: Lee Jones @ 2021-12-22 11:17 UTC (permalink / raw)
  To: Marijn Suijten
  Cc: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring,
	Daniel Thompson, Jingoo Han, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	Jami Kettunen, Pavel Dubrova, Kiran Gunda, Bryan Wu,
	linux-arm-msm, devicetree, linux-kernel, dri-devel, linux-fbdev

On Mon, 15 Nov 2021, Marijn Suijten wrote:

> The previous commit improves num_strings parsing to not go over the
> maximum of 3 strings for WLED3 anymore.  Likewise this default index for
> a hypothetical 4th string is invalid and could access registers that are
> not mapped to the desired purpose.
> Removing this value gets rid of undesired confusion and avoids the
> possibility of accessing registers at this offset even if the 4th array
> element is used by accident.
> 
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
> ---
>  drivers/video/backlight/qcom-wled.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 7/9] backlight: qcom-wled: Provide enabled_strings default for WLED 4 and 5
  2021-11-15 20:34 ` [PATCH v3 7/9] backlight: qcom-wled: Provide enabled_strings default for WLED 4 and 5 Marijn Suijten
@ 2021-12-22 11:18   ` Lee Jones
  0 siblings, 0 replies; 26+ messages in thread
From: Lee Jones @ 2021-12-22 11:18 UTC (permalink / raw)
  To: Marijn Suijten
  Cc: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring,
	Daniel Thompson, Jingoo Han, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	Jami Kettunen, Pavel Dubrova, Kiran Gunda, Bryan Wu,
	linux-arm-msm, devicetree, linux-kernel, dri-devel, linux-fbdev

On Mon, 15 Nov 2021, Marijn Suijten wrote:

> Only WLED 3 sets a sensible default that allows operating this driver
> with just qcom,num-strings in the DT; WLED 4 and 5 require
> qcom,enabled-strings to be provided otherwise enabled_strings remains
> zero-initialized, resulting in every string-specific register write
> (currently only the setup and config functions, brightness follows in a
> future patch) to only configure the zero'th string multiple times.
> 
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
> ---
>  drivers/video/backlight/qcom-wled.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 8/9] backlight: qcom-wled: Remove unnecessary double whitespace
  2021-11-15 20:34 ` [PATCH v3 8/9] backlight: qcom-wled: Remove unnecessary double whitespace Marijn Suijten
@ 2021-12-22 11:18   ` Lee Jones
  0 siblings, 0 replies; 26+ messages in thread
From: Lee Jones @ 2021-12-22 11:18 UTC (permalink / raw)
  To: Marijn Suijten
  Cc: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring,
	Daniel Thompson, Jingoo Han, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	Jami Kettunen, Pavel Dubrova, Kiran Gunda, Bryan Wu,
	linux-arm-msm, devicetree, linux-kernel, dri-devel, linux-fbdev

On Mon, 15 Nov 2021, Marijn Suijten wrote:

> Remove redundant spaces inside for loop conditions.  No other double
> spaces were found that are not part of indentation with `[^\s]  `.
> 
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
> ---
>  drivers/video/backlight/qcom-wled.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 9/9] backlight: qcom-wled: Respect enabled-strings in set_brightness
  2021-11-15 20:34 ` [PATCH v3 9/9] backlight: qcom-wled: Respect enabled-strings in set_brightness Marijn Suijten
@ 2021-12-22 11:18   ` Lee Jones
  0 siblings, 0 replies; 26+ messages in thread
From: Lee Jones @ 2021-12-22 11:18 UTC (permalink / raw)
  To: Marijn Suijten
  Cc: phone-devel, Andy Gross, Bjorn Andersson, Rob Herring,
	Daniel Thompson, Jingoo Han, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	Jami Kettunen, Pavel Dubrova, Kiran Gunda, Bryan Wu,
	linux-arm-msm, devicetree, linux-kernel, dri-devel, linux-fbdev

On Mon, 15 Nov 2021, Marijn Suijten wrote:

> The hardware is capable of controlling any non-contiguous sequence of
> LEDs specified in the DT using qcom,enabled-strings as u32
> array, and this also follows from the DT-bindings documentation.  The
> numbers specified in this array represent indices of the LED strings
> that are to be enabled and disabled.
> 
> Its value is appropriately used to setup and enable string modules, but
> completely disregarded in the set_brightness paths which only iterate
> over the number of strings linearly.
> Take an example where only string 2 is enabled with
> qcom,enabled_strings=<2>: this string is appropriately enabled but
> subsequent brightness changes would have only touched the zero'th
> brightness register because num_strings is 1 here.  This is simply
> addressed by looking up the string for this index in the enabled_strings
> array just like the other codepaths that iterate over num_strings.
> 
> Likewise enabled_strings is now also used in the autodetection path for
> consistent behaviour: when a list of strings is specified in DT only
> those strings will be probed for autodetection, analogous to how the
> number of strings that need to be probed is already bound by
> qcom,num-strings.  After all autodetection uses the set_brightness
> helpers to set an initial value, which could otherwise end up changing
> brightness on a different set of strings.
> 
> Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED3")
> Fixes: 03b2b5e86986 ("backlight: qcom-wled: Add support for WLED4 peripheral")
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
> ---
>  drivers/video/backlight/qcom-wled.c | 22 ++++++++++++----------
>  1 file changed, 12 insertions(+), 10 deletions(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2021-12-22 11:19 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 20:34 [PATCH v3 0/9] backlight: qcom-wled: fix and solidify handling of enabled-strings Marijn Suijten
2021-11-15 20:34 ` [PATCH v3 1/9] backlight: qcom-wled: Validate enabled string indices in DT Marijn Suijten
2021-12-22 11:15   ` Lee Jones
2021-11-15 20:34 ` [PATCH v3 2/9] backlight: qcom-wled: Pass number of elements to read to read_u32_array Marijn Suijten
2021-12-22 11:15   ` Lee Jones
2021-11-15 20:34 ` [PATCH v3 3/9] backlight: qcom-wled: Use cpu_to_le16 macro to perform conversion Marijn Suijten
2021-11-16 11:56   ` Daniel Thompson
2021-12-22 11:16   ` Lee Jones
2021-11-15 20:34 ` [PATCH v3 4/9] backlight: qcom-wled: Fix off-by-one maximum with default num_strings Marijn Suijten
2021-11-16 11:58   ` Daniel Thompson
2021-12-22 11:16   ` Lee Jones
2021-11-15 20:34 ` [PATCH v3 5/9] backlight: qcom-wled: Override default length with qcom,enabled-strings Marijn Suijten
2021-11-16 11:59   ` Daniel Thompson
2021-12-22 11:17   ` Lee Jones
2021-11-15 20:34 ` [PATCH v3 6/9] backlight: qcom-wled: Remove unnecessary 4th default string in WLED3 Marijn Suijten
2021-12-22 11:17   ` Lee Jones
2021-11-15 20:34 ` [PATCH v3 7/9] backlight: qcom-wled: Provide enabled_strings default for WLED 4 and 5 Marijn Suijten
2021-12-22 11:18   ` Lee Jones
2021-11-15 20:34 ` [PATCH v3 8/9] backlight: qcom-wled: Remove unnecessary double whitespace Marijn Suijten
2021-12-22 11:18   ` Lee Jones
2021-11-15 20:34 ` [PATCH v3 9/9] backlight: qcom-wled: Respect enabled-strings in set_brightness Marijn Suijten
2021-12-22 11:18   ` Lee Jones
2021-11-16 12:02 ` [PATCH v3 0/9] backlight: qcom-wled: fix and solidify handling of enabled-strings Daniel Thompson
2021-11-16 15:42   ` Lee Jones
2021-12-21 23:31     ` Marijn Suijten
2021-12-22 10:56       ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).