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

Message ID 20240112131857.900734-6-nfraprado@collabora.com
State New
Headers
Series Allow coreboot modules to autoload and enable cbmem in the arm64 defconfig |

Commit Message

NĂ­colas F. R. A. Prado Jan. 12, 2024, 1:18 p.m. UTC
  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@chromium.org>
Signed-off-by: NĂ­colas F. R. A. Prado <nfraprado@collabora.com>

---

Changes in v2:
- Added this commit

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

Patch

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,