Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Jun 2022 07:12:33 GMT
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: b203d3de6b1a - stable/13 - backlight: Update cached value when getting the brightness
Message-ID:  <202206010712.2517CXgJ056448@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=b203d3de6b1a7ab38f0a1e3d944a1c4887e31a9b

commit b203d3de6b1a7ab38f0a1e3d944a1c4887e31a9b
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2022-05-25 14:48:10 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-06-01 07:12:18 +0000

    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
    
    (cherry picked from commit e26ef41f79902991c772b59927c721aa7fa5fc64)
---
 sys/dev/backlight/backlight.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/dev/backlight/backlight.c b/sys/dev/backlight/backlight.c
index 19d273ae55d8..2d3fe02d33e9 100644
--- a/sys/dev/backlight/backlight.c
+++ b/sys/dev/backlight/backlight.c
@@ -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));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202206010712.2517CXgJ056448>