Commit d2f38a3c authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull backlight updates from Lee Jones:
 "Fix-ups:
   - Standardise *_exit() and *_remove() return values in ili9320 and
     vgg2432a4

  Bug Fixes:
   - Do not override maximum brightness
   - Propagate errors from get_brightness()"

* tag 'backlight-next-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight:
  video: backlight: ili9320: Make ili9320_remove() return void
  backlight: Propagate errors from get_brightness()
  video: backlight: Drop maximum brightness override for brightness zero
parents 3a9b0a46 3976e974
Loading
Loading
Loading
Loading
+17 −11
Original line number Diff line number Diff line
@@ -292,10 +292,13 @@ static ssize_t actual_brightness_show(struct device *dev,
	struct backlight_device *bd = to_backlight_device(dev);

	mutex_lock(&bd->ops_lock);
	if (bd->ops && bd->ops->get_brightness)
		rc = sprintf(buf, "%d\n", bd->ops->get_brightness(bd));
	else
	if (bd->ops && bd->ops->get_brightness) {
		rc = bd->ops->get_brightness(bd);
		if (rc >= 0)
			rc = sprintf(buf, "%d\n", rc);
	} else {
		rc = sprintf(buf, "%d\n", bd->props.brightness);
	}
	mutex_unlock(&bd->ops_lock);

	return rc;
@@ -381,9 +384,18 @@ ATTRIBUTE_GROUPS(bl_device);
void backlight_force_update(struct backlight_device *bd,
			    enum backlight_update_reason reason)
{
	int brightness;

	mutex_lock(&bd->ops_lock);
	if (bd->ops && bd->ops->get_brightness)
		bd->props.brightness = bd->ops->get_brightness(bd);
	if (bd->ops && bd->ops->get_brightness) {
		brightness = bd->ops->get_brightness(bd);
		if (brightness >= 0)
			bd->props.brightness = brightness;
		else
			dev_err(&bd->dev,
				"Could not update brightness from device: %pe\n",
				ERR_PTR(brightness));
	}
	mutex_unlock(&bd->ops_lock);
	backlight_generate_event(bd, reason);
}
@@ -688,12 +700,6 @@ static struct backlight_device *of_find_backlight(struct device *dev)
			of_node_put(np);
			if (!bd)
				return ERR_PTR(-EPROBE_DEFER);
			/*
			 * Note: gpio_backlight uses brightness as
			 * power state during probe
			 */
			if (!bd->props.brightness)
				bd->props.brightness = bd->props.max_brightness;
		}
	}

+1 −2
Original line number Diff line number Diff line
@@ -251,10 +251,9 @@ int ili9320_probe_spi(struct spi_device *spi,
}
EXPORT_SYMBOL_GPL(ili9320_probe_spi);

int ili9320_remove(struct ili9320 *ili)
void ili9320_remove(struct ili9320 *ili)
{
	ili9320_power(ili, FB_BLANK_POWERDOWN);
	return 0;
}
EXPORT_SYMBOL_GPL(ili9320_remove);

+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ extern int ili9320_write_regs(struct ili9320 *ili,
extern int ili9320_probe_spi(struct spi_device *spi,
			     struct ili9320_client *cli);

extern int ili9320_remove(struct ili9320 *lcd);
extern void ili9320_remove(struct ili9320 *lcd);
extern void ili9320_shutdown(struct ili9320 *lcd);

/* PM */
+3 −1
Original line number Diff line number Diff line
@@ -235,7 +235,9 @@ static int vgg2432a4_probe(struct spi_device *spi)

static int vgg2432a4_remove(struct spi_device *spi)
{
	return ili9320_remove(spi_get_drvdata(spi));
	ili9320_remove(spi_get_drvdata(spi));

	return 0;
}

static void vgg2432a4_shutdown(struct spi_device *spi)