lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251104153013.154463-4-abbotti@mev.co.uk>
Date: Tue,  4 Nov 2025 15:27:04 +0000
From: Ian Abbott <abbotti@....co.uk>
To: linux-fpga@...r.kernel.org
Cc: Moritz Fischer <mdf@...nel.org>,
	Xu Yilun <yilun.xu@...el.com>,
	Tom Rix <trix@...hat.com>,
	linux-kernel@...r.kernel.org,
	Ian Abbott <abbotti@....co.uk>
Subject: [PATCH 3/4] fpga: manager: Add dummy definitions of API functions

Add dummy versions of the FPGA manager API functions for build testing.

Signed-off-by: Ian Abbott <abbotti@....co.uk>
---
 include/linux/fpga/fpga-mgr.h | 95 ++++++++++++++++++++++++++++++++---
 1 file changed, 87 insertions(+), 8 deletions(-)

diff --git a/include/linux/fpga/fpga-mgr.h b/include/linux/fpga/fpga-mgr.h
index 0d4fe068f3d8..bc77d71c8dd7 100644
--- a/include/linux/fpga/fpga-mgr.h
+++ b/include/linux/fpga/fpga-mgr.h
@@ -10,6 +10,7 @@
 
 #include <linux/mutex.h>
 #include <linux/platform_device.h>
+#include <linux/err.h>
 
 struct fpga_manager;
 struct sg_table;
@@ -217,6 +218,19 @@ struct fpga_manager {
 
 #define to_fpga_manager(d) container_of(d, struct fpga_manager, dev)
 
+#define fpga_mgr_register_full(parent, info) \
+	__fpga_mgr_register_full(parent, info, THIS_MODULE)
+
+#define fpga_mgr_register(parent, name, mops, priv) \
+	__fpga_mgr_register(parent, name, mops, priv, THIS_MODULE)
+
+#define devm_fpga_mgr_register_full(parent, info) \
+	__devm_fpga_mgr_register_full(parent, info, THIS_MODULE)
+
+#define devm_fpga_mgr_register(parent, name, mops, priv) \
+	__devm_fpga_mgr_register(parent, name, mops, priv, THIS_MODULE)
+
+#ifdef CONFIG_FPGA
 struct fpga_image_info *fpga_image_info_alloc(struct device *dev);
 
 void fpga_image_info_free(struct fpga_image_info *info);
@@ -232,30 +246,95 @@ struct fpga_manager *fpga_mgr_get(struct device *dev);
 
 void fpga_mgr_put(struct fpga_manager *mgr);
 
-#define fpga_mgr_register_full(parent, info) \
-	__fpga_mgr_register_full(parent, info, THIS_MODULE)
 struct fpga_manager *
 __fpga_mgr_register_full(struct device *parent, const struct fpga_manager_info *info,
 			 struct module *owner);
 
-#define fpga_mgr_register(parent, name, mops, priv) \
-	__fpga_mgr_register(parent, name, mops, priv, THIS_MODULE)
 struct fpga_manager *
 __fpga_mgr_register(struct device *parent, const char *name,
 		    const struct fpga_manager_ops *mops, void *priv, struct module *owner);
 
 void fpga_mgr_unregister(struct fpga_manager *mgr);
 
-#define devm_fpga_mgr_register_full(parent, info) \
-	__devm_fpga_mgr_register_full(parent, info, THIS_MODULE)
 struct fpga_manager *
 __devm_fpga_mgr_register_full(struct device *parent, const struct fpga_manager_info *info,
 			      struct module *owner);
-#define devm_fpga_mgr_register(parent, name, mops, priv) \
-	__devm_fpga_mgr_register(parent, name, mops, priv, THIS_MODULE)
 struct fpga_manager *
 __devm_fpga_mgr_register(struct device *parent, const char *name,
 			 const struct fpga_manager_ops *mops, void *priv,
 			 struct module *owner);
 
+#else
+static inline struct fpga_image_info *fpga_image_info_alloc(struct device *dev)
+{
+	return NULL;
+}
+
+static inline void fpga_image_info_free(struct fpga_image_info *info)
+{
+}
+
+static inline int fpga_mgr_load(struct fpga_manager *mgr,
+				struct fpga_image_info *info)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline int fpga_mgr_lock(struct fpga_manager *mgr)
+{
+	return 0;
+}
+
+static inline void fpga_mgr_unlock(struct fpga_manager *mgr)
+{
+}
+
+static inline struct fpga_manager *of_fpga_mgr_get(struct device_node *node)
+{
+	return ERR_PTR(-EOPNOTSUPP);
+}
+
+static inline struct fpga_manager *fpga_mgr_get(struct device *dev)
+{
+	return ERR_PTR(-EOPNOTSUPP);
+}
+
+static inline void fpga_mgr_put(struct fpga_manager *mgr)
+{
+}
+
+static inline struct fpga_manager *
+__fpga_mgr_register_full(struct device *parent, const struct fpga_manager_info *info,
+			 struct module *owner)
+{
+	return ERR_PTR(-EOPNOTSUPP);
+}
+
+static inline struct fpga_manager *
+__fpga_mgr_register(struct device *parent, const char *name,
+		    const struct fpga_manager_ops *mops, void *priv, struct module *owner)
+{
+	return ERR_PTR(-EOPNOTSUPP);
+}
+
+static inline void fpga_mgr_unregister(struct fpga_manager *mgr)
+{
+}
+
+static inline struct fpga_manager *
+__devm_fpga_mgr_register_full(struct device *parent, const struct fpga_manager_info *info,
+			      struct module *owner)
+{
+	return ERR_PTR(-EOPNOTSUPP);
+}
+
+static inline struct fpga_manager *
+__devm_fpga_mgr_register(struct device *parent, const char *name,
+			 const struct fpga_manager_ops *mops, void *priv,
+			 struct module *owner)
+{
+	return ERR_PTR(-EOPNOTSUPP);
+}
+#endif
+
 #endif /*_LINUX_FPGA_MGR_H */
-- 
2.51.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ