The branch main has been updated by vexeduxr:

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

commit 28bac28d90740b2bd48e532ad7500d2f46210413
Author:     Evgenii Ivanov <deviva...@proton.me>
AuthorDate: 2025-08-12 04:17:13 +0000
Commit:     Ahmad Khalifa <vexed...@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);

Reply via email to