tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Devices without power management support



On Fri, Aug 19, 2022 at 01:52:47AM +0000, Taylor R Campbell wrote:
> All that said: What is the failure mode you're seeing for ihidev that
> blocks suspend?

It fails to read HID descriptor. The ihidev device remains unfunctionnal
and breaks suspend.

I thought about this workaround:

--- sys/dev/i2c/ihidev.c.orig
+++ sys/dev/i2c/ihidev.c
@@ -161,8 +163,17 @@
 	sc->sc_tag = ia->ia_tag;
 	sc->sc_addr = ia->ia_addr;
 	mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
 
+	/*
+	 * We register null handlers so that a failed attachement
+	 * does not result in a device that breaks suspend.
+	 * The real handler are registered at the end of this
+	 * function on success.
+	 */
+	if (!pmf_device_register(self, NULL, NULL))
+		aprint_error_dev(self, "couldn't establish power handler\n");
+
 	sc->sc_phandle = ia->ia_cookie;
 	if (ia->ia_cookietype != I2C_COOKIE_ACPI) {
 		aprint_error(": unsupported device tree type\n");
 		return;


-- 
Emmanuel Dreyfus
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index