[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-fpga
Subject:    [PATCH v2 1/4] fpga: add helpers for the FPGA KUnit test suites.
From:       Marco Pagani <marpagan () redhat ! com>
Date:       2023-09-29 15:20:54
Message-ID: 20230929152057.85047-2-marpagan () redhat ! com
[Download RAW message or body]

Add helpers to facilitate the registration of minimal platform drivers
to support parent platform devices used for testing.

Signed-off-by: Marco Pagani <marpagan@redhat.com>
---
 drivers/fpga/tests/fpga-test-helpers.h | 29 ++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 drivers/fpga/tests/fpga-test-helpers.h

diff --git a/drivers/fpga/tests/fpga-test-helpers.h b/drivers/fpga/tests/fpga-test-helpers.h
new file mode 100644
index 000000000000..6a28ed30bf71
--- /dev/null
+++ b/drivers/fpga/tests/fpga-test-helpers.h
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * KUnit test for the FPGA Manager
+ *
+ * Copyright (C) 2023 Red Hat, Inc.
+ *
+ * Author: Marco Pagani <marpagan@redhat.com>
+ */
+
+#ifndef _FPGA_KUNIT_HELPERS_H
+#define _FPGA_KUNIT_HELPERS_H
+
+#define TEST_PDEV_NAME	"fpga-test-pdev"
+
+#define TEST_PLATFORM_DRIVER(__drv_name)			\
+	__TEST_PLATFORM_DRIVER(__drv_name, TEST_PDEV_NAME)
+/*
+ * Helper macro for defining a minimal platform driver that can
+ * be registered to support the parent platform devices used for
+ * testing.
+ */
+#define __TEST_PLATFORM_DRIVER(__drv_name, __dev_name)		\
+static struct platform_driver __drv_name = {			\
+	.driver = {						\
+		.name = __dev_name,				\
+	},							\
+}
+
+#endif	/* _FPGA_KUNIT_HELPERS_H */
-- 
2.41.0

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic