Module Name: src Committed By: christos Date: Fri Apr 26 18:19:18 UTC 2024
Modified Files: src/sys/dev/acpi: acpi_bat.c Log Message: PR/58201: Malte Dehling: re-order sysmon initialization before acpi registration, to avoid needing to call to acpi_deregister_notify on sysmon failure. To generate a diff of this commit: cvs rdiff -u -r1.121 -r1.122 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.122 --- src/sys/dev/acpi/acpi_bat.c:1.121 Thu Jan 6 20:10:57 2022 +++ src/sys/dev/acpi/acpi_bat.c Fri Apr 26 14:19:18 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.122 2024/04/26 18:19:18 christos 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.122 2024/04/26 18:19:18 christos Exp $"); #include <sys/param.h> #include <sys/condvar.h> @@ -762,17 +762,16 @@ acpibat_init_envsys(device_t dv) sc->sc_sme->sme_flags = SME_POLL_ONLY | SME_INIT_REFRESH; 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");