tech-kern archive

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

Power mgmt handlers for com_acpi?



There are a couple of error paths in sys/dev/acpi/com_acpi.c which can result in bypassing the call to pmf_device_register(). Later on, the lack of a pmf handlers for the device can prevent the system from going to sleep.

The attached patch modifies these error paths to establish NULL handler. (We cannot use the usual handler com_resume() because it might attempt to access registers which might not have been mapped!)

Any objection committing this?


-------------------------------------------------------------------------
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |                          | pgoyette at netbsd.org  |
-------------------------------------------------------------------------
Index: com_acpi.c
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/com_acpi.c,v
retrieving revision 1.31
diff -u -p -r1.31 com_acpi.c
--- com_acpi.c  5 Mar 2010 14:00:17 -0000       1.31
+++ com_acpi.c  16 Jul 2010 12:51:18 -0000
@@ -157,7 +157,16 @@ com_acpi_attach(device_t parent, device_
 
        if (!pmf_device_register(self, NULL, com_resume))
                aprint_error_dev(self, "couldn't establish a power handler\n");
+       goto cleanup;
 
+       /*
+        * In case of irq resource or i/o space mapping error, just set
+        * a NULL power handler.  This may allow us to sleep later on.
+        */
  out:
+       if (!pmf_device_register(self, NULL, NULL))
+               aprint_error_dev(self, "couldn't establish a power handler\n");
+
+ cleanup:
        acpi_resource_cleanup(&res);
 }


Home | Main Index | Thread Index | Old Index