> From: Jeremie Courreges-Anglas <[email protected]>
> Date: Fri, 08 May 2020 19:36:03 +0200
>
> acpiac(4) obtains the AC status using _PSR. _STA is queried too but
> nothing is done with the result. AFAICS ACPI 6.3 doesn't say anything
> about a relationship between _STA and _PSR.
>
> Diff below removes the unused _STA query and renames the surrounding
> plumbing.
>
> Thoughts, oks?
Yes, that's pointless, especially because the parent driver is already
looking at _STA.
ok kettenis@
> Index: acpiac.c
> ===================================================================
> RCS file: /d/cvs/src/sys/dev/acpi/acpiac.c,v
> retrieving revision 1.31
> diff -u -p -p -u -r1.31 acpiac.c
> --- acpiac.c 1 Jul 2018 19:40:49 -0000 1.31
> +++ acpiac.c 8 May 2020 17:10:18 -0000
> @@ -36,7 +36,7 @@ void acpiac_attach(struct device *, stru
> int acpiac_notify(struct aml_node *, int, void *);
>
> void acpiac_refresh(void *);
> -int acpiac_getsta(struct acpiac_softc *);
> +int acpiac_getpsr(struct acpiac_softc *);
>
> struct cfattach acpiac_ca = {
> sizeof(struct acpiac_softc), acpiac_match, acpiac_attach
> @@ -70,7 +70,7 @@ acpiac_attach(struct device *parent, str
> sc->sc_acpi = (struct acpi_softc *)parent;
> sc->sc_devnode = aa->aaa_node;
>
> - acpiac_getsta(sc);
> + acpiac_getpsr(sc);
> printf(": AC unit ");
> if (sc->sc_ac_stat == PSR_ONLINE)
> printf("online\n");
> @@ -97,27 +97,23 @@ acpiac_refresh(void *arg)
> {
> struct acpiac_softc *sc = arg;
>
> - acpiac_getsta(sc);
> + acpiac_getpsr(sc);
> sc->sc_sens[0].value = sc->sc_ac_stat;
> acpi_record_event(sc->sc_acpi, APM_POWER_CHANGE);
> }
>
> int
> -acpiac_getsta(struct acpiac_softc *sc)
> +acpiac_getpsr(struct acpiac_softc *sc)
> {
> - int64_t sta;
> + int64_t psr;
>
> - if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_STA", 0, NULL, NULL)) {
> - dnprintf(10, "%s: no _STA\n",
> - DEVNAME(sc));
> - }
> -
> - if (aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "_PSR", 0, NULL,
> &sta)) {
> + if (aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "_PSR", 0, NULL,
> &psr)) {
> dnprintf(10, "%s: no _PSR\n",
> DEVNAME(sc));
> return (1);
> }
> - sc->sc_ac_stat = sta;
> + sc->sc_ac_stat = psr;
> +
> return (0);
> }
>
>
> --
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
>
>