dwiic_activate did not inform sub-devices with config_activate_children()
authorderaadt <deraadt@openbsd.org>
Sat, 17 Aug 2024 02:24:03 +0000 (02:24 +0000)
committerderaadt <deraadt@openbsd.org>
Sat, 17 Aug 2024 02:24:03 +0000 (02:24 +0000)
calls from the correct places, so their DVACT_QUIESCE and DVACT_WAKEUP
were incorrect, and led to those sub-drivers (ihidev and imt) racing
against dwiic hardware re-initialization.
ok kettenis mlarkin

sys/dev/ic/dwiic.c
sys/dev/pci/dwiic_pci.c

index cb2f986..ba42522 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwiic.c,v 1.18 2024/08/17 02:14:20 deraadt Exp $ */
+/* $OpenBSD: dwiic.c,v 1.19 2024/08/17 02:24:03 deraadt Exp $ */
 /*
  * Synopsys DesignWare I2C controller
  *
@@ -33,9 +33,11 @@ int
 dwiic_activate(struct device *self, int act)
 {
        struct dwiic_softc *sc = (struct dwiic_softc *)self;
+       int rv;
 
        switch (act) {
        case DVACT_SUSPEND:
+               rv = config_activate_children(self, act);               
                /* disable controller */
                dwiic_enable(sc, 0);
 
@@ -45,12 +47,13 @@ dwiic_activate(struct device *self, int act)
                break;
        case DVACT_RESUME:
                dwiic_init(sc);
+               rv = config_activate_children(self, act);
+               break;
+       default:
+               rv = config_activate_children(self, act);
                break;
        }
-
-       config_activate_children(self, act);
-
-       return 0;
+       return rv;
 }
 
 int
index 68f25f3..3d3548c 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwiic_pci.c,v 1.28 2024/08/17 02:14:21 deraadt Exp $ */
+/* $OpenBSD: dwiic_pci.c,v 1.29 2024/08/17 02:24:06 deraadt Exp $ */
 /*
  * Synopsys DesignWare I2C controller
  * PCI attachment
@@ -298,10 +298,7 @@ dwiic_pci_activate(struct device *self, int act)
                    (LPSS_RESETS_I2C | LPSS_RESETS_IDMA));
                break;
        }
-
-       dwiic_activate(self, act);
-
-       return 0;
+       return dwiic_activate(self, act);
 }
 
 void