[RFC,net-next,3/8] modpost: Add support for subdev device id table
diff mbox series

Message ID 1551418672-12822-4-git-send-email-parav@mellanox.com
State New, archived
Headers show
Series
  • Introducing subdev bus and devlink extension
Related show

Commit Message

Parav Pandit March 1, 2019, 5:37 a.m. UTC
Add support to parse subdev module device id table.

Signed-off-by: Parav Pandit <parav@mellanox.com>
---
 scripts/mod/devicetable-offsets.c |  4 ++++
 scripts/mod/file2alias.c          | 15 +++++++++++++++
 2 files changed, 19 insertions(+)

Patch
diff mbox series

diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c
index 2930044..77f6b6e 100644
--- a/scripts/mod/devicetable-offsets.c
+++ b/scripts/mod/devicetable-offsets.c
@@ -225,5 +225,9 @@  int main(void)
 	DEVID_FIELD(typec_device_id, svid);
 	DEVID_FIELD(typec_device_id, mode);
 
+	DEVID(subdev_id);
+	DEVID_FIELD(subdev_id, vendor_id);
+	DEVID_FIELD(subdev_id, device_id);
+
 	return 0;
 }
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index a37af7d..be89e8e 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -1287,6 +1287,20 @@  static int do_typec_entry(const char *filename, void *symval, char *alias)
 	return 1;
 }
 
+/* Looks like: subdev:vNdN. */
+static int do_subdev_entry(const char *filename, void *symval, char *alias)
+{
+	DEF_FIELD(symval, subdev_id, vendor_id);
+	DEF_FIELD(symval, subdev_id, device_id);
+
+	strcpy(alias, "subdev:");
+	ADD(alias, "v", 1, vendor_id);
+	ADD(alias, "d", 1, device_id);
+
+	add_wildcard(alias);
+	return 1;
+}
+
 /* Does namelen bytes of name exactly match the symbol? */
 static bool sym_is(const char *name, unsigned namelen, const char *symbol)
 {
@@ -1357,6 +1371,7 @@  static void do_table(void *symval, unsigned long size,
 	{"fslmc", SIZE_fsl_mc_device_id, do_fsl_mc_entry},
 	{"tbsvc", SIZE_tb_service_id, do_tbsvc_entry},
 	{"typec", SIZE_typec_device_id, do_typec_entry},
+	{"subdev", SIZE_subdev_id, do_subdev_entry},
 };
 
 /* Create MODULE_ALIAS() statements.