[PATCH v2 5/7] firmware: google: memconsole: Add to module device table

From: Nícolas F. R. A. Prado
Date: Fri Jan 12 2024 - 08:22:54 EST


Create an id table and add it to the module device table to allow the
memconsole driver to be automatically loaded when a matching device is
found.

Suggested-by: Brian Norris <briannorris@xxxxxxxxxxxx>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@xxxxxxxxxxxxx>

---

Changes in v2:
- Added this commit

drivers/firmware/google/memconsole-coreboot.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/firmware/google/memconsole-coreboot.c b/drivers/firmware/google/memconsole-coreboot.c
index 74b5286518ee..b8e65b9d8cc0 100644
--- a/drivers/firmware/google/memconsole-coreboot.c
+++ b/drivers/firmware/google/memconsole-coreboot.c
@@ -11,6 +11,7 @@
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/mod_devicetable.h>

#include "memconsole.h"
#include "coreboot_table.h"
@@ -96,6 +97,12 @@ static void memconsole_remove(struct coreboot_device *dev)
memconsole_exit();
}

+static const struct coreboot_device_id memconsole_ids[] = {
+ { .tag = CB_TAG_CBMEM_CONSOLE },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(coreboot, memconsole_ids);
+
static struct coreboot_driver memconsole_driver = {
.probe = memconsole_probe,
.remove = memconsole_remove,
--
2.43.0