Module Name:    src
Committed By:   martin
Date:           Thu Sep 12 19:49:00 UTC 2024

Modified Files:
        src/sys/dev/acpi [netbsd-10]: acpi_bat.c

Log Message:
Pull up following revision(s) (requested by rin in ticket #844):

        sys/dev/acpi/acpi_bat.c: revision 1.122
        sys/dev/acpi/acpi_bat.c: revision 1.123

PR/58201: Malte Dehling: re-order sysmon initialization before acpi
registration, to avoid needing to call to acpi_deregister_notify on sysmon
failure.

Remove 0 initializations (since the softc is zalloc'ed) and the initial
refresh which will have no data.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.121.4.1 src/sys/dev/acpi/acpi_bat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpi_bat.c
diff -u src/sys/dev/acpi/acpi_bat.c:1.121 src/sys/dev/acpi/acpi_bat.c:1.121.4.1
--- src/sys/dev/acpi/acpi_bat.c:1.121	Fri Jan  7 01:10:57 2022
+++ src/sys/dev/acpi/acpi_bat.c	Thu Sep 12 19:49:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_bat.c,v 1.121 2022/01/07 01:10:57 riastradh Exp $	*/
+/*	$NetBSD: acpi_bat.c,v 1.121.4.1 2024/09/12 19:49:00 martin Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.121 2022/01/07 01:10:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.121.4.1 2024/09/12 19:49:00 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/condvar.h>
@@ -229,14 +229,6 @@ acpibat_attach(device_t parent, device_t
 
 	sc->sc_node = aa->aa_node;
 
-	sc->sc_present = 0;
-	sc->sc_dvoltage = 0;
-	sc->sc_dcapacity = 0;
-	sc->sc_lcapacity = 0;
-	sc->sc_wcapacity = 0;
-
-	sc->sc_sme = NULL;
-
 	mutex_init(&sc->sc_mutex, MUTEX_DEFAULT, IPL_NONE);
 	cv_init(&sc->sc_condvar, device_xname(self));
 
@@ -759,20 +751,19 @@ acpibat_init_envsys(device_t dv)
 	sc->sc_sme->sme_cookie = dv;
 	sc->sc_sme->sme_refresh = acpibat_refresh;
 	sc->sc_sme->sme_class = SME_CLASS_BATTERY;
-	sc->sc_sme->sme_flags = SME_POLL_ONLY | SME_INIT_REFRESH;
+	sc->sc_sme->sme_flags = SME_POLL_ONLY;
 	sc->sc_sme->sme_get_limits = acpibat_get_limits;
 
+	if (sysmon_envsys_register(sc->sc_sme))
+		goto fail;
+
 	(void)acpi_register_notify(sc->sc_node, acpibat_notify_handler);
 	acpibat_update_info(dv);
 	acpibat_update_status(dv);
 
-	if (sysmon_envsys_register(sc->sc_sme))
-		goto fail;
-
 	(void)pmf_device_register(dv, NULL, acpibat_resume);
 
 	return;
-
 fail:
 	aprint_error_dev(dv, "failed to initialize sysmon\n");
 

Reply via email to