- Fix-ups

- Standardise *_exit() and *_remove() return values; ili9320, vgg2432a4
 
  - Bug Fixes
    - Do not override maximum brightness; backlight
    - Propagate errors from get_brightness(); backlight
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmGJTUMACgkQUa+KL4f8
 d2FQ+w/+PMsuCZwyf1tcIfUTZJA5y5n8vnsLLzIkkjLlnaNbtD+y85gZzLWa0CgC
 H3nyKrcV/rbaTC5mAM+meKcmDxfbCGYDL7bleIZ2aQd1YtmvGnmspGnNwl8vHTjA
 DN8eagNssW+V1i/uPbKN76RRaOMleIwm/zjA4TZATMs6Q1MddDeJN4g5mIqbcd1i
 k5aE2Jc9ZqPuE18w7I5gOuibGo8If1IroeTJ1V2/npJJhlWAA+nJzH2bGG7I1OQm
 4AjrJ+n8twKhAbaFhi3IYcQhpbGACGo/HZ3SGS3sPjlqo2+/vdrsTqjCkiQREfZ1
 5QmOHk1/X0bFTcO5u6rhldq3qbS3qg7DwRzTb8LmY3bcPVHj5JD8jJcbnHgzXkOz
 UncS0Y5sMImn+BKDVVvsosMH45XnZtngyYEEbgpzMI3JXGf9LxilxCVTZ8rrfogF
 TYbM+i1bzs3Tvl3mKaecSqvsKJgJUVNKFOSb0oGlXd9WaEb3WmTgFi6CfATeokif
 buTdPGt2rD2WcanNFV8A32z3byuvS8C7EXRkprhbUVjkO//rOam7HgR8SBP6rkRo
 IYs2CUAviawfiCypGPUCjBz6JwgcG9uQrdpFBrWEp26dkx+m/MP5OvkuwgjIPNrI
 4Bu12kU1mTRrR9CenJP1Ka/1fKQbQaFsNxiKM3C7SYOnt90XMRs=
 =PbxD
 -----END PGP SIGNATURE-----

Merge tag 'backlight-next-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight

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
This commit is contained in:
Linus Torvalds 2021-11-08 12:21:28 -08:00
commit d2f38a3c65
4 changed files with 22 additions and 15 deletions

View File

@ -292,10 +292,13 @@ static ssize_t actual_brightness_show(struct device *dev,
struct backlight_device *bd = to_backlight_device(dev); struct backlight_device *bd = to_backlight_device(dev);
mutex_lock(&bd->ops_lock); mutex_lock(&bd->ops_lock);
if (bd->ops && bd->ops->get_brightness) if (bd->ops && bd->ops->get_brightness) {
rc = sprintf(buf, "%d\n", bd->ops->get_brightness(bd)); rc = bd->ops->get_brightness(bd);
else if (rc >= 0)
rc = sprintf(buf, "%d\n", rc);
} else {
rc = sprintf(buf, "%d\n", bd->props.brightness); rc = sprintf(buf, "%d\n", bd->props.brightness);
}
mutex_unlock(&bd->ops_lock); mutex_unlock(&bd->ops_lock);
return rc; return rc;
@ -381,9 +384,18 @@ ATTRIBUTE_GROUPS(bl_device);
void backlight_force_update(struct backlight_device *bd, void backlight_force_update(struct backlight_device *bd,
enum backlight_update_reason reason) enum backlight_update_reason reason)
{ {
int brightness;
mutex_lock(&bd->ops_lock); mutex_lock(&bd->ops_lock);
if (bd->ops && bd->ops->get_brightness) if (bd->ops && bd->ops->get_brightness) {
bd->props.brightness = bd->ops->get_brightness(bd); 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); mutex_unlock(&bd->ops_lock);
backlight_generate_event(bd, reason); backlight_generate_event(bd, reason);
} }
@ -688,12 +700,6 @@ static struct backlight_device *of_find_backlight(struct device *dev)
of_node_put(np); of_node_put(np);
if (!bd) if (!bd)
return ERR_PTR(-EPROBE_DEFER); 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;
} }
} }

View File

@ -251,10 +251,9 @@ int ili9320_probe_spi(struct spi_device *spi,
} }
EXPORT_SYMBOL_GPL(ili9320_probe_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); ili9320_power(ili, FB_BLANK_POWERDOWN);
return 0;
} }
EXPORT_SYMBOL_GPL(ili9320_remove); EXPORT_SYMBOL_GPL(ili9320_remove);

View File

@ -68,7 +68,7 @@ extern int ili9320_write_regs(struct ili9320 *ili,
extern int ili9320_probe_spi(struct spi_device *spi, extern int ili9320_probe_spi(struct spi_device *spi,
struct ili9320_client *cli); 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); extern void ili9320_shutdown(struct ili9320 *lcd);
/* PM */ /* PM */

View File

@ -235,7 +235,9 @@ static int vgg2432a4_probe(struct spi_device *spi)
static int vgg2432a4_remove(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) static void vgg2432a4_shutdown(struct spi_device *spi)