From 99dfaab19e03e5fa6957e129f0bdec0631da6878 Mon Sep 17 00:00:00 2001 From: deraadt Date: Sat, 17 Aug 2024 02:24:03 +0000 Subject: [PATCH] dwiic_activate did not inform sub-devices with config_activate_children() 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 | 13 ++++++++----- sys/dev/pci/dwiic_pci.c | 7 ++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sys/dev/ic/dwiic.c b/sys/dev/ic/dwiic.c index cb2f986cc29..ba425226ab4 100644 --- a/sys/dev/ic/dwiic.c +++ b/sys/dev/ic/dwiic.c @@ -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 diff --git a/sys/dev/pci/dwiic_pci.c b/sys/dev/pci/dwiic_pci.c index 68f25f37d33..3d3548c0e74 100644 --- a/sys/dev/pci/dwiic_pci.c +++ b/sys/dev/pci/dwiic_pci.c @@ -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 -- 2.20.1