git: b9f1e45e685b - main - acpi_gpiobus: Reuse the existing IVAR index for an ACPI handle

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 17 Feb 2026 20:46:17 UTC
The branch main has been updated by jhb:

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

commit b9f1e45e685b5e007d0c3a9513ac13e6d82e9518
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-02-17 20:44:58 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-02-17 20:44:58 +0000

    acpi_gpiobus: Reuse the existing IVAR index for an ACPI handle
    
    ACPI_IVAR_HANDLE is a global index shared across multiple busses,
    there is no need for a unique constant here.
    
    Reviewed by:    vexeduxr, imp
    Differential Revision:  https://reviews.freebsd.org/D54155
---
 sys/dev/gpio/acpi_gpiobus.c    |  2 +-
 sys/dev/gpio/acpi_gpiobusvar.h | 13 -------------
 sys/dev/gpio/gpioaei.c         |  2 +-
 3 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/sys/dev/gpio/acpi_gpiobus.c b/sys/dev/gpio/acpi_gpiobus.c
index 0c31f4fec16d..117c05799c08 100644
--- a/sys/dev/gpio/acpi_gpiobus.c
+++ b/sys/dev/gpio/acpi_gpiobus.c
@@ -401,7 +401,7 @@ acpi_gpiobus_read_ivar(device_t dev, device_t child, int which,
 	struct acpi_gpiobus_ivar *devi = device_get_ivars(child);
 
 	switch (which) {
-	case ACPI_GPIOBUS_IVAR_HANDLE:
+	case ACPI_IVAR_HANDLE:
 		*result = (uintptr_t)devi->handle;
 		break;
 	default:
diff --git a/sys/dev/gpio/acpi_gpiobusvar.h b/sys/dev/gpio/acpi_gpiobusvar.h
index 288e8bd0f2af..ea4e7d44a217 100644
--- a/sys/dev/gpio/acpi_gpiobusvar.h
+++ b/sys/dev/gpio/acpi_gpiobusvar.h
@@ -28,21 +28,8 @@
 #ifndef	__ACPI_GPIOBUS_H__
 #define	__ACPI_GPIOBUS_H__
 
-#include <sys/bus.h>
-
 #include <contrib/dev/acpica/include/acpi.h>
 
-enum acpi_gpiobus_ivars {
-	ACPI_GPIOBUS_IVAR_HANDLE	= 10600
-};
-
-#define ACPI_GPIOBUS_ACCESSOR(var, ivar, type)			\
-	__BUS_ACCESSOR(acpi_gpiobus, var, ACPI_GPIOBUS, ivar, type)
-
-ACPI_GPIOBUS_ACCESSOR(handle,	HANDLE,		ACPI_HANDLE)
-
-#undef ACPI_GPIOBUS_ACCESSOR
-
 uint32_t acpi_gpiobus_convflags(ACPI_RESOURCE_GPIO *);
 
 #endif	/* __ACPI_GPIOBUS_H__ */
diff --git a/sys/dev/gpio/gpioaei.c b/sys/dev/gpio/gpioaei.c
index 9a769a793e5a..3451d3120843 100644
--- a/sys/dev/gpio/gpioaei.c
+++ b/sys/dev/gpio/gpioaei.c
@@ -208,7 +208,7 @@ gpio_aei_attach(device_t dev)
 	/* This is us. */
 	device_set_desc(dev, "ACPI Event Information Device");
 
-	handle = acpi_gpiobus_get_handle(dev);
+	handle = acpi_get_handle(dev);
 	status = AcpiGetParent(handle, &sc->dev_handle);
 	if (ACPI_FAILURE(status)) {
 		device_printf(dev, "Cannot get parent of %s\n",