Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi acpi: Assert acpi_register_notify is not called...



details:   https://anonhg.NetBSD.org/src/rev/91de02feb6b2
branches:  trunk
changeset: 362464:91de02feb6b2
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Feb 27 21:22:09 2022 +0000

description:
acpi: Assert acpi_register_notify is not called twice.

diffstat:

 sys/dev/acpi/acpi.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 577705df8e51 -r 91de02feb6b2 sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c       Sun Feb 27 21:22:01 2022 +0000
+++ b/sys/dev/acpi/acpi.c       Sun Feb 27 21:22:09 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi.c,v 1.296 2022/01/22 11:49:17 thorpej Exp $       */
+/*     $NetBSD: acpi.c,v 1.297 2022/02/27 21:22:09 riastradh Exp $     */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.296 2022/01/22 11:49:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.297 2022/02/27 21:22:09 riastradh Exp $");
 
 #include "pci.h"
 #include "opt_acpi.h"
@@ -1222,6 +1222,11 @@
        if (ad == NULL || notify == NULL)
                goto fail;
 
+       KASSERTMSG(ad->ad_notify == NULL,
+           "%s: ACPI node %s already has notify handler: %p",
+           ad->ad_device ? device_xname(ad->ad_device) : "(unknown)",
+           ad->ad_name,
+           ad->ad_notify);
        atomic_store_release(&ad->ad_notify, notify);
 
        return true;



Home | Main Index | Thread Index | Old Index