[v2,4/7] firmware: google: vpd: Add to module device table

Message ID 20240112131857.900734-5-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
vpd 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/vpd.c | 7 +++++++
 1 file changed, 7 insertions(+)
  

Patch

diff --git a/drivers/firmware/google/vpd.c b/drivers/firmware/google/vpd.c
index ee6e08c0592b..9e9fe9ca1920 100644
--- a/drivers/firmware/google/vpd.c
+++ b/drivers/firmware/google/vpd.c
@@ -14,6 +14,7 @@ 
 #include <linux/kobject.h>
 #include <linux/list.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
@@ -306,6 +307,12 @@  static void vpd_remove(struct coreboot_device *dev)
 	kobject_put(vpd_kobj);
 }
 
+static const struct coreboot_device_id vpd_ids[] = {
+	{ .tag = CB_TAG_VPD },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(coreboot, vpd_ids);
+
 static struct coreboot_driver vpd_driver = {
 	.probe = vpd_probe,
 	.remove = vpd_remove,