backlight: Update cached value when getting the brightness

External events can cause the backlight level to change (AC adapter
plug/unplug for example) so cache the value there too.

PR:		257796
Sponsored by:	Beckhoff Automation GmbH & Co. KG
MFC after:	1 week
This commit is contained in:
Emmanuel Vadot 2022-05-25 16:48:10 +02:00
parent 3ddd6eb688
commit e26ef41f79

View file

@ -73,8 +73,10 @@ backlight_ioctl(struct cdev *dev, u_long cmd, caddr_t data,
/* Call the driver function so it fills up the props */
bcopy(data, &props, sizeof(struct backlight_props));
error = BACKLIGHT_GET_STATUS(sc->dev, &props);
if (error == 0)
if (error == 0) {
bcopy(&props, data, sizeof(struct backlight_props));
sc->cached_brightness = props.brightness;
}
break;
case BACKLIGHTUPDATESTATUS:
bcopy(data, &props, sizeof(struct backlight_props));