git: 28bac28d9074 - main - gpio: Fix incorrect dev being passed to gpiobus_detach_bus

From: Ahmad Khalifa <vexeduxr_at_FreeBSD.org>
Date: Wed, 13 Aug 2025 11:33:13 UTC
The branch main has been updated by vexeduxr:

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

commit 28bac28d90740b2bd48e532ad7500d2f46210413
Author:     Evgenii Ivanov <devivanov@proton.me>
AuthorDate: 2025-08-12 04:17:13 +0000
Commit:     Ahmad Khalifa <vexeduxr@FreeBSD.org>
CommitDate: 2025-08-13 11:15:46 +0000

    gpio: Fix incorrect dev being passed to gpiobus_detach_bus
    
    Passing in the busdev will not detach from the bus correctly leaving the
    /dev/gpiocN entry
    
    Reviewed by:    vexeduxr, imp
    Differential Revision:  https://reviews.freebsd.org/D51857
---
 sys/dev/iicbus/gpio/pcf8574.c | 4 +---
 sys/dev/iicbus/gpio/tca64xx.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/sys/dev/iicbus/gpio/pcf8574.c b/sys/dev/iicbus/gpio/pcf8574.c
index 86c78ffb15e6..bf60dec67557 100644
--- a/sys/dev/iicbus/gpio/pcf8574.c
+++ b/sys/dev/iicbus/gpio/pcf8574.c
@@ -159,9 +159,7 @@ pcf8574_detach(device_t dev)
 
 	sc = device_get_softc(dev);
 
-	if (sc->busdev != NULL)
-		gpiobus_detach_bus(sc->busdev);
-
+	gpiobus_detach_bus(dev);
 	sx_destroy(&sc->lock);
 	return (0);
 }
diff --git a/sys/dev/iicbus/gpio/tca64xx.c b/sys/dev/iicbus/gpio/tca64xx.c
index a973ef22f3fa..ab8fedd3f8fd 100644
--- a/sys/dev/iicbus/gpio/tca64xx.c
+++ b/sys/dev/iicbus/gpio/tca64xx.c
@@ -292,9 +292,7 @@ tca64xx_detach(device_t dev)
 
 	sc = device_get_softc(dev);
 
-	if (sc->busdev != NULL)
-		gpiobus_detach_bus(sc->busdev);
-
+	gpiobus_detach_bus(dev);
 	mtx_destroy(&sc->mtx);
 
 	return (0);