Commit 46f538bf authored by Linus Torvalds's avatar Linus Torvalds

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
parents 8350e833 023a8830
...@@ -22,6 +22,7 @@ properties: ...@@ -22,6 +22,7 @@ properties:
- qcom,pmi8994-wled - qcom,pmi8994-wled
- qcom,pmi8998-wled - qcom,pmi8998-wled
- qcom,pm660l-wled - qcom,pm660l-wled
- qcom,pm6150l-wled
- qcom,pm8150l-wled - qcom,pm8150l-wled
reg: reg:
......
...@@ -710,7 +710,6 @@ static void devm_backlight_release(void *data) ...@@ -710,7 +710,6 @@ static void devm_backlight_release(void *data)
{ {
struct backlight_device *bd = 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) ...@@ -737,11 +736,10 @@ struct backlight_device *devm_of_find_backlight(struct device *dev)
bd = of_find_backlight(dev); bd = of_find_backlight(dev);
if (IS_ERR_OR_NULL(bd)) if (IS_ERR_OR_NULL(bd))
return bd; return bd;
ret = devm_add_action(dev, devm_backlight_release, bd); ret = devm_add_action_or_reset(dev, devm_backlight_release, bd);
if (ret) { if (ret)
put_device(&bd->dev);
return ERR_PTR(ret); return ERR_PTR(ret);
}
return bd; return bd;
} }
EXPORT_SYMBOL(devm_of_find_backlight); EXPORT_SYMBOL(devm_of_find_backlight);
......
...@@ -263,9 +263,8 @@ static int pwm_backlight_parse_dt(struct device *dev, ...@@ -263,9 +263,8 @@ static int pwm_backlight_parse_dt(struct device *dev,
/* read brightness levels from DT property */ /* read brightness levels from DT property */
if (num_levels > 0) { if (num_levels > 0) {
size_t size = sizeof(*data->levels) * num_levels; data->levels = devm_kcalloc(dev, num_levels,
sizeof(*data->levels), GFP_KERNEL);
data->levels = devm_kzalloc(dev, size, GFP_KERNEL);
if (!data->levels) if (!data->levels)
return -ENOMEM; return -ENOMEM;
...@@ -320,8 +319,8 @@ static int pwm_backlight_parse_dt(struct device *dev, ...@@ -320,8 +319,8 @@ static int pwm_backlight_parse_dt(struct device *dev,
* Create a new table of brightness levels with all the * Create a new table of brightness levels with all the
* interpolated steps. * interpolated steps.
*/ */
size = sizeof(*table) * num_levels; table = devm_kcalloc(dev, num_levels, sizeof(*table),
table = devm_kzalloc(dev, size, GFP_KERNEL); GFP_KERNEL);
if (!table) if (!table)
return -ENOMEM; return -ENOMEM;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment