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

From: Parav Pandit
Date: Fri Mar 01 2019 - 00:38:14 EST


Add support to parse subdev module device id table.

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

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.
--
1.8.3.1