git: 0ffd7d4d15d4 - main - acpi_gpiobus: IoRestriction is only for type IO

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Tue, 29 Oct 2024 23:13:08 UTC
The branch main has been updated by cperciva:

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

commit 0ffd7d4d15d468c60ef274f8368a5722e3f7f6a1
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2024-10-29 16:32:38 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2024-10-29 23:12:23 +0000

    acpi_gpiobus: IoRestriction is only for type IO
    
    The IoRestriction field of ACPI_RESOURCE_GPIO is only meaningful
    for resources of type ACPI_RESOURCE_GPIO_TYPE_IO.
    
    Reported by:    jrtc27
    Reviewed by:    jrtc27
    Differential Revision:  <https://reviews.freebsd.org/D47331>
---
 sys/dev/gpio/acpi_gpiobus.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/sys/dev/gpio/acpi_gpiobus.c b/sys/dev/gpio/acpi_gpiobus.c
index 9828170daeca..c01d825fabf5 100644
--- a/sys/dev/gpio/acpi_gpiobus.c
+++ b/sys/dev/gpio/acpi_gpiobus.c
@@ -73,13 +73,15 @@ acpi_gpiobus_convflags(ACPI_RESOURCE_GPIO *gpio_res)
 			flags |= GPIO_INTR_SHAREABLE;
 #endif
 	}
-	switch (gpio_res->IoRestriction) {
-	case ACPI_IO_RESTRICT_INPUT:
-		flags |= GPIO_PIN_INPUT;
-		break;
-	case ACPI_IO_RESTRICT_OUTPUT:
-		flags |= GPIO_PIN_OUTPUT;
-		break;
+	if (gpio_res->ConnectionType == ACPI_RESOURCE_GPIO_TYPE_IO) {
+		switch (gpio_res->IoRestriction) {
+		case ACPI_IO_RESTRICT_INPUT:
+			flags |= GPIO_PIN_INPUT;
+			break;
+		case ACPI_IO_RESTRICT_OUTPUT:
+			flags |= GPIO_PIN_OUTPUT;
+			break;
+		}
 	}
 
 	switch (gpio_res->PinConfig) {