summaryrefslogtreecommitdiff
path: root/drivers/firmware/google/coreboot_table.h
diff options
context:
space:
mode:
authorStephen Boyd <swboyd@chromium.org>2019-05-10 11:01:47 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-24 20:55:04 +0200
commit354635039d935dba16ba35054b27dd6671fd3d14 (patch)
tree0d329048115c18436a1cbd847424b321967f552e /drivers/firmware/google/coreboot_table.h
parent7ef0b1524417743e6861490420225affe451486b (diff)
firmware: google: Add a module_coreboot_driver() macro and use it
Remove some boiler plate code we have in three drivers with a single line each time. This also gets us a free assignment of the driver .owner field, making these drivers work better as modules. Cc: Wei-Ning Huang <wnhuang@chromium.org> Cc: Julius Werner <jwerner@chromium.org> Cc: Brian Norris <briannorris@chromium.org> Cc: Samuel Holland <samuel@sholland.org> Cc: Guenter Roeck <groeck@chromium.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Samuel Holland <samuel@sholland.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/firmware/google/coreboot_table.h')
-rw-r--r--drivers/firmware/google/coreboot_table.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/firmware/google/coreboot_table.h b/drivers/firmware/google/coreboot_table.h
index 71a9de6b15fa..054fa9374c59 100644
--- a/drivers/firmware/google/coreboot_table.h
+++ b/drivers/firmware/google/coreboot_table.h
@@ -20,6 +20,7 @@
#ifndef __COREBOOT_TABLE_H
#define __COREBOOT_TABLE_H
+#include <linux/device.h>
#include <linux/io.h>
/* Coreboot table header structure */
@@ -91,4 +92,13 @@ int coreboot_driver_register(struct coreboot_driver *driver);
/* Unregister a driver that uses the data from a coreboot table. */
void coreboot_driver_unregister(struct coreboot_driver *driver);
+/* module_coreboot_driver() - Helper macro for drivers that don't do
+ * anything special in module init/exit. This eliminates a lot of
+ * boilerplate. Each module may only use this macro once, and
+ * calling it replaces module_init() and module_exit()
+ */
+#define module_coreboot_driver(__coreboot_driver) \
+ module_driver(__coreboot_driver, coreboot_driver_register, \
+ coreboot_driver_unregister)
+
#endif /* __COREBOOT_TABLE_H */