[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200929080214.23553-2-sherry.sun@nxp.com>
Date: Tue, 29 Sep 2020 16:02:13 +0800
From: Sherry Sun <sherry.sun@....com>
To: sudeep.dutt@...el.com, ashutosh.dixit@...el.com, arnd@...db.de,
gregkh@...uxfoundation.org, masahiroy@...nel.org,
michal.lkml@...kovi.net, lee.jones@...aro.org
Cc: linux-kernel@...r.kernel.org, linux-imx@....com,
linux-kbuild@...r.kernel.org
Subject: [PATCH V2 1/2] mic: vop: module autoprobing support for vop drivers
Add vop autoprobing support to MODULE_DEVICE_TABLE() by adding info
about struct vop_device_id in devicetable-offsets.c and add a vop entry
point in file2alias.c.
The type argument for MODULE_DEVICE_TABLE(type, name) is vop.
Signed-off-by: Sherry Sun <sherry.sun@....com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@....com>
---
drivers/misc/mic/bus/vop_bus.h | 7 +------
drivers/misc/mic/vop/vop_main.c | 2 +-
include/linux/mod_devicetable.h | 7 +++++++
scripts/mod/devicetable-offsets.c | 4 ++++
scripts/mod/file2alias.c | 16 ++++++++++++++++
5 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/drivers/misc/mic/bus/vop_bus.h b/drivers/misc/mic/bus/vop_bus.h
index d891eacae358..5b4a58757951 100644
--- a/drivers/misc/mic/bus/vop_bus.h
+++ b/drivers/misc/mic/bus/vop_bus.h
@@ -14,16 +14,11 @@
*/
#include <linux/dmaengine.h>
#include <linux/interrupt.h>
+#include <linux/mod_devicetable.h>
#include "../common/mic_dev.h"
-struct vop_device_id {
- u32 device;
- u32 vendor;
-};
-
#define VOP_DEV_TRNSP 1
-#define VOP_DEV_ANY_ID 0xffffffff
/*
* Size of the internal buffer used during DMA's as an intermediate buffer
* for copy to/from user. Must be an integral number of pages.
diff --git a/drivers/misc/mic/vop/vop_main.c b/drivers/misc/mic/vop/vop_main.c
index 1ccc94dfd6ac..f1e908286843 100644
--- a/drivers/misc/mic/vop/vop_main.c
+++ b/drivers/misc/mic/vop/vop_main.c
@@ -742,7 +742,7 @@ static struct vop_driver vop_driver = {
module_vop_driver(vop_driver);
-MODULE_DEVICE_TABLE(mbus, id_table);
+MODULE_DEVICE_TABLE(vop, id_table);
MODULE_AUTHOR("Intel Corporation");
MODULE_DESCRIPTION("Intel(R) Virtio Over PCIe (VOP) driver");
MODULE_LICENSE("GPL v2");
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 5b08a473cdba..736cdc236cf9 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -838,4 +838,11 @@ struct mhi_device_id {
kernel_ulong_t driver_data;
};
+/* vop */
+struct vop_device_id {
+ __u32 device;
+ __u32 vendor;
+};
+#define VOP_DEV_ANY_ID 0xffffffff
+
#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c
index 27007c18e754..393acaa5302a 100644
--- a/scripts/mod/devicetable-offsets.c
+++ b/scripts/mod/devicetable-offsets.c
@@ -243,5 +243,9 @@ int main(void)
DEVID(mhi_device_id);
DEVID_FIELD(mhi_device_id, chan);
+ DEVID(vop_device_id);
+ DEVID_FIELD(vop_device_id, device);
+ DEVID_FIELD(vop_device_id, vendor);
+
return 0;
}
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 2417dd1dee33..8063b778eedf 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -1368,6 +1368,21 @@ static int do_mhi_entry(const char *filename, void *symval, char *alias)
return 1;
}
+/* Looks like: vop:dNvN */
+static int do_vop_entry(const char *filename, void *symval,
+ char *alias)
+{
+ DEF_FIELD(symval, vop_device_id, device);
+ DEF_FIELD(symval, vop_device_id, vendor);
+
+ strcpy(alias, "vop:");
+ ADD(alias, "d", device != VOP_DEV_ANY_ID, device);
+ ADD(alias, "v", vendor != VOP_DEV_ANY_ID, vendor);
+
+ 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)
{
@@ -1442,6 +1457,7 @@ static const struct devtable devtable[] = {
{"tee", SIZE_tee_client_device_id, do_tee_entry},
{"wmi", SIZE_wmi_device_id, do_wmi_entry},
{"mhi", SIZE_mhi_device_id, do_mhi_entry},
+ {"vop", SIZE_vop_device_id, do_vop_entry},
};
/* Create MODULE_ALIAS() statements.
--
2.17.1
Powered by blists - more mailing lists