Commit 46f538bf authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ properties:
      - qcom,pmi8994-wled
      - qcom,pmi8998-wled
      - qcom,pm660l-wled
      - qcom,pm6150l-wled
      - qcom,pm8150l-wled

  reg:
+4 −6
Original line number Diff line number Diff line
@@ -710,7 +710,6 @@ static void devm_backlight_release(void *data)
{
	struct backlight_device *bd = data;

	if (bd)
	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);
+4 −5
Original line number Diff line number Diff line
@@ -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;
			/*