Subject: [PATCH] [acpi driver model] Define helpers for empty methods - Declare macros for helping define methods that drivers do not implement: - acpi_no_start(name) - acpi_no_stop(name) - acpi_no_shutdown(name) - acpi_no_suspend(name) - acpi_no_resume(name) A driver can use these, instead of doing: static int foo_start(struct acpi_dev * dev) { return 0; } (though the two are equivalent) Signed-off-by: Patrick Mochel --- include/acpi/driver.h | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) applies-to: 66aa28839da93645c8976b4e6944ec8b7b51d0be 42feb84952604922384116771c61b413e5847c9a diff --git a/include/acpi/driver.h b/include/acpi/driver.h index e7d3312..29c0cc4 100644 --- a/include/acpi/driver.h +++ b/include/acpi/driver.h @@ -28,6 +28,42 @@ extern int acpi_driver_register(struct a extern void acpi_driver_unregister(struct acpi_device_driver *); +/** + * A driver can use these macros for declaring empty + * methods (that must be present for the driver to + * initialize properly); or when developing a driver + * before all of the methods get filled in. + * + * To replace one of the methods with real code, use e.g. + * + * static int ac_start(struct acpi_dev * ad) + * { + * return 0; + * } + * + * ...and go from there. + */ + +#define acpi_no_start(__name) \ +static int __name##_start(struct acpi_dev * ad) { return 0; } + + +#define acpi_no_stop(__name) \ +static int __name##_stop(struct acpi_dev * ad) { return 0; } + + +#define acpi_no_shutdown(__name) \ +static void __name##_shutdown(struct acpi_dev * ad) { } + + +#define acpi_no_suspend(__name) \ +static int __name##_suspend(struct acpi_dev * ad, u32 state) { return 0; } + + +#define acpi_no_resume(__name) \ +static int __name##_resume(struct acpi_dev * ad) { return 0; } + + #define __decl_acpi_ids(__name, ...) \ static const char * __name##_ids[] = { __VA_ARGS__ } --- 0.99.9.GIT