aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2022-03-25 14:01:23 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2022-03-25 14:01:23 -0700
commit46f538bf2404ee9c32648deafb886f49144bfd5e (patch)
treecab6f6ec6bf5997cb6daf6c85b76f7b4bc606dcb
parent8350e8331b3971533d6e6112ab596eda2c2ffffd (diff)
parent023a8830a62846e1cecc8da07e00c801dd0d7598 (diff)
downloadlinux-46f538bf2404ee9c32648deafb886f49144bfd5e.tar.gz
Merge tag 'backlight-next-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight
Pull backlight updates from Lee Jones: "New Device Support: - Add support for PM6150L to Qualcomm WLED Fix-ups" - Use kcalloc() to avoid open-coding; pwm_bl - Device Tree changes; qcom-wled - Cleanup or simplify code; backlight" * tag 'backlight-next-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: backlight: backlight: Slighly simplify devm_of_find_backlight() backlight: qcom-wled: Add PM6150L compatible dt-bindings: backlight: qcom-wled: Add PM6150L compatible backlight: pwm_bl: Avoid open coded arithmetic in memory allocation
-rw-r--r--Documentation/devicetree/bindings/leds/backlight/qcom-wled.yaml1
-rw-r--r--drivers/video/backlight/backlight.c10
-rw-r--r--drivers/video/backlight/pwm_bl.c9
3 files changed, 9 insertions, 11 deletions
diff --git a/Documentation/devicetree/bindings/leds/backlight/qcom-wled.yaml b/Documentation/devicetree/bindings/leds/backlight/qcom-wled.yaml
index d839e75d9788b6..1c24b333c6e2ff 100644
--- a/Documentation/devicetree/bindings/leds/backlight/qcom-wled.yaml
+++ b/Documentation/devicetree/bindings/leds/backlight/qcom-wled.yaml
@@ -22,6 +22,7 @@ properties:
- qcom,pmi8994-wled
- qcom,pmi8998-wled
- qcom,pm660l-wled
+ - qcom,pm6150l-wled
- qcom,pm8150l-wled
reg:
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 4ae6fae94ac29b..b788ff3d0f45ea 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -710,8 +710,7 @@ static void devm_backlight_release(void *data)
{
struct backlight_device *bd = data;
- if (bd)
- put_device(&bd->dev);
+ put_device(&bd->dev);
}
/**
@@ -737,11 +736,10 @@ struct backlight_device *devm_of_find_backlight(struct device *dev)
bd = of_find_backlight(dev);
if (IS_ERR_OR_NULL(bd))
return bd;
- ret = devm_add_action(dev, devm_backlight_release, bd);
- if (ret) {
- put_device(&bd->dev);
+ ret = devm_add_action_or_reset(dev, devm_backlight_release, bd);
+ if (ret)
return ERR_PTR(ret);
- }
+
return bd;
}
EXPORT_SYMBOL(devm_of_find_backlight);
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 8d8959a70e4409..c0523a0269ee5e 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -263,9 +263,8 @@ static int pwm_backlight_parse_dt(struct device *dev,
/* read brightness levels from DT property */
if (num_levels > 0) {
- size_t size = sizeof(*data->levels) * num_levels;
-
- data->levels = devm_kzalloc(dev, size, GFP_KERNEL);
+ data->levels = devm_kcalloc(dev, num_levels,
+ sizeof(*data->levels), GFP_KERNEL);
if (!data->levels)
return -ENOMEM;
@@ -320,8 +319,8 @@ static int pwm_backlight_parse_dt(struct device *dev,
* Create a new table of brightness levels with all the
* interpolated steps.
*/
- size = sizeof(*table) * num_levels;
- table = devm_kzalloc(dev, size, GFP_KERNEL);
+ table = devm_kcalloc(dev, num_levels, sizeof(*table),
+ GFP_KERNEL);
if (!table)
return -ENOMEM;
/*