From e5fe1651a96dbd6afc0277a3a379a7649dc8c924 Mon Sep 17 00:00:00 2001 From: mglocker Date: Sun, 26 May 2024 20:06:27 +0000 Subject: [PATCH] Fix suspend/resume for ums(4) and umt(4); Calling hidm*_attach not at the end of the device driver attach function can cause accessops functions to be called by wscons(4) *before* the device has completed its attach procedure. In this case this has led the device driver to ignore interrupts after resume, because during resume ums_disable/umt_disable were called last, *after* ums_enable/umt_enable. OK phessler@ --- sys/dev/usb/ums.c | 6 +++--- sys/dev/usb/umt.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c index 239e853fa00..5376365569c 100644 --- a/sys/dev/usb/ums.c +++ b/sys/dev/usb/ums.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ums.c,v 1.52 2024/05/23 03:21:09 jsg Exp $ */ +/* $OpenBSD: ums.c,v 1.53 2024/05/26 20:06:27 mglocker Exp $ */ /* $NetBSD: ums.c,v 1.60 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -178,14 +178,14 @@ ums_attach(struct device *parent, struct device *self, void *aux) ms->sc_loc_btn[2].pos = 2; } - hidms_attach(ms, &ums_accessops); - if (sc->sc_quirks & UQ_ALWAYS_OPEN) { /* open uhidev and keep it open */ ums_enable(sc); /* but mark the hidms not in use */ ums_disable(sc); } + + hidms_attach(ms, &ums_accessops); } int diff --git a/sys/dev/usb/umt.c b/sys/dev/usb/umt.c index aea4412e5cd..35ebfb59668 100644 --- a/sys/dev/usb/umt.c +++ b/sys/dev/usb/umt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umt.c,v 1.7 2024/05/23 03:21:09 jsg Exp $ */ +/* $OpenBSD: umt.c,v 1.8 2024/05/26 20:06:27 mglocker Exp $ */ /* * USB multitouch touchpad driver for devices conforming to * Windows Precision Touchpad standard @@ -181,14 +181,14 @@ umt_attach(struct device *parent, struct device *self, void *aux) if (hidmt_setup(self, mt, desc, size) != 0) return; - hidmt_attach(mt, &umt_accessops); - if (sc->sc_quirks & UQ_ALWAYS_OPEN) { /* open uhidev and keep it open */ umt_enable(sc); /* but mark the hidmt not in use */ umt_disable(sc); } + + hidmt_attach(mt, &umt_accessops); } int -- 2.20.1