linux-fpga.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] fpga: Add dummy definitions of API functions
@ 2025-11-04 15:27 Ian Abbott
  2025-11-04 15:27 ` [PATCH 1/4] fpga: altera-pr-ip: " Ian Abbott
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Ian Abbott @ 2025-11-04 15:27 UTC (permalink / raw)
  To: linux-fpga; +Cc: Moritz Fischer, Xu Yilun, Tom Rix, linux-kernel

Add dummy definitions of the FPGA API functions for build testing

1) fpga: altera-pr-ip: Add dummy definitions of API functions
2) fpga: bridge: Add dummy definitions of API functions
3) fpga: manager: Add dummy definitions of API functions
4) fpga: region: Add dummy definitions of API functions

 include/linux/fpga/altera-pr-ip-core.h |  8 ++-
 include/linux/fpga/fpga-bridge.h       | 75 ++++++++++++++++++++++++++-
 include/linux/fpga/fpga-mgr.h          | 95 +++++++++++++++++++++++++++++++---
 include/linux/fpga/fpga-region.h       | 44 ++++++++++++++--
 4 files changed, 207 insertions(+), 15 deletions(-)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/4] fpga: altera-pr-ip: Add dummy definitions of API functions
  2025-11-04 15:27 [PATCH 0/4] fpga: Add dummy definitions of API functions Ian Abbott
@ 2025-11-04 15:27 ` Ian Abbott
  2025-11-05  7:17   ` kernel test robot
  2025-11-05  7:39   ` kernel test robot
  2025-11-04 15:27 ` [PATCH 2/4] fpga: bridge: " Ian Abbott
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 16+ messages in thread
From: Ian Abbott @ 2025-11-04 15:27 UTC (permalink / raw)
  To: linux-fpga; +Cc: Moritz Fischer, Xu Yilun, Tom Rix, linux-kernel, Ian Abbott

Add a dummy definition of alt_pr_register() for build testing.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 include/linux/fpga/altera-pr-ip-core.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/linux/fpga/altera-pr-ip-core.h b/include/linux/fpga/altera-pr-ip-core.h
index a6b4c07858cc..4a5aa9adaccc 100644
--- a/include/linux/fpga/altera-pr-ip-core.h
+++ b/include/linux/fpga/altera-pr-ip-core.h
@@ -11,7 +11,13 @@
 #ifndef _ALT_PR_IP_CORE_H
 #define _ALT_PR_IP_CORE_H
 #include <linux/io.h>
+#include <asm/errno.h>
 
+#ifdef CONFIG_ALTERA_PR_IP_CORE
 int alt_pr_register(struct device *dev, void __iomem *reg_base);
-
+#else
+static inline int alt_pr_register(struct device *dev, void __iomem *reg_base)
+{
+	return -EOPNOTSUPP;
+}
 #endif /* _ALT_PR_IP_CORE_H */
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/4] fpga: bridge: Add dummy definitions of API functions
  2025-11-04 15:27 [PATCH 0/4] fpga: Add dummy definitions of API functions Ian Abbott
  2025-11-04 15:27 ` [PATCH 1/4] fpga: altera-pr-ip: " Ian Abbott
@ 2025-11-04 15:27 ` Ian Abbott
  2025-11-05  9:13   ` kernel test robot
  2025-11-04 15:27 ` [PATCH 3/4] fpga: manager: " Ian Abbott
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Ian Abbott @ 2025-11-04 15:27 UTC (permalink / raw)
  To: linux-fpga; +Cc: Moritz Fischer, Xu Yilun, Tom Rix, linux-kernel, Ian Abbott

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

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 include/linux/fpga/fpga-bridge.h | 75 +++++++++++++++++++++++++++++++-
 1 file changed, 73 insertions(+), 2 deletions(-)

diff --git a/include/linux/fpga/fpga-bridge.h b/include/linux/fpga/fpga-bridge.h
index 94c4edd047e5..107e97adcc7c 100644
--- a/include/linux/fpga/fpga-bridge.h
+++ b/include/linux/fpga/fpga-bridge.h
@@ -5,6 +5,7 @@
 
 #include <linux/device.h>
 #include <linux/fpga/fpga-mgr.h>
+#include <linux/err.h>
 
 struct fpga_bridge;
 
@@ -63,6 +64,10 @@ struct fpga_bridge {
 
 #define to_fpga_bridge(d) container_of(d, struct fpga_bridge, dev)
 
+#define fpga_bridge_register(parent, name, br_ops, priv) \
+	__fpga_bridge_register(parent, name, br_ops, priv, THIS_MODULE)
+
+#ifdef CONFIG_FPGA_BRIDGE
 struct fpga_bridge *of_fpga_bridge_get(struct device_node *node,
 				       struct fpga_image_info *info);
 struct fpga_bridge *fpga_bridge_get(struct device *dev,
@@ -81,12 +86,78 @@ int of_fpga_bridge_get_to_list(struct device_node *np,
 			       struct fpga_image_info *info,
 			       struct list_head *bridge_list);
 
-#define fpga_bridge_register(parent, name, br_ops, priv) \
-	__fpga_bridge_register(parent, name, br_ops, priv, THIS_MODULE)
 struct fpga_bridge *
 __fpga_bridge_register(struct device *parent, const char *name,
 		       const struct fpga_bridge_ops *br_ops, void *priv,
 		       struct module *owner);
 void fpga_bridge_unregister(struct fpga_bridge *br);
 
+#else
+static inline struct fpga_bridge *
+of_fpga_bridge_get(struct device_node *node, struct fpga_image_info *info)
+{
+	return ERR_PTR(-EOPNOTSUPP);
+}
+
+static inline struct fpga_bridge *
+fpga_bridge_get(struct device *dev, struct fpga_image_info *info)
+{
+	return ERR_PTR(-EOPNOTSUPP);
+}
+
+static inline void fpga_bridge_put(struct fpga_bridge *bridge)
+{
+}
+
+static inline int fpga_bridge_enable(struct fpga_bridge *bridge)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline int fpga_bridge_disable(struct fpga_bridge *bridge)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline int fpga_bridges_enable(struct list_head *bridge_list)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline int fpga_bridges_disable(struct list_head *bridge_list)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline void fpga_bridges_put(struct list_head *bridge_list)
+{
+}
+
+static inline int fpga_bridge_get_to_list(struct device *dev,
+					  struct fpga_image_info *info,
+					  struct list_head *bridge_list)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline int of_fpga_bridge_get_to_list(struct device_node *np,
+					     struct fpga_image_info *info,
+					     struct list_head *bridge_list)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline struct fpga_bridge *
+__fpga_bridge_register(struct device *parent, const char *name,
+		       const struct fpga_bridge_ops *br_ops, void *priv,
+		       struct module *owner)
+{
+	return ERR_PTR(-EOPNOTSUPP);
+}
+
+static inline void fpga_bridge_unregister(struct fpga_bridge *br)
+{
+}
+#endif
+
 #endif /* _LINUX_FPGA_BRIDGE_H */
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/4] fpga: manager: Add dummy definitions of API functions
  2025-11-04 15:27 [PATCH 0/4] fpga: Add dummy definitions of API functions Ian Abbott
  2025-11-04 15:27 ` [PATCH 1/4] fpga: altera-pr-ip: " Ian Abbott
  2025-11-04 15:27 ` [PATCH 2/4] fpga: bridge: " Ian Abbott
@ 2025-11-04 15:27 ` Ian Abbott
  2025-11-04 15:27 ` [PATCH 4/4] fpga: region: " Ian Abbott
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: Ian Abbott @ 2025-11-04 15:27 UTC (permalink / raw)
  To: linux-fpga; +Cc: Moritz Fischer, Xu Yilun, Tom Rix, linux-kernel, Ian Abbott

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

Signed-off-by: Ian Abbott <abbotti@mev.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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 4/4] fpga: region: Add dummy definitions of API functions
  2025-11-04 15:27 [PATCH 0/4] fpga: Add dummy definitions of API functions Ian Abbott
                   ` (2 preceding siblings ...)
  2025-11-04 15:27 ` [PATCH 3/4] fpga: manager: " Ian Abbott
@ 2025-11-04 15:27 ` Ian Abbott
  2025-11-05  1:47 ` [PATCH 0/4] fpga: " Xu Yilun
  2025-11-05 12:31 ` [PATCH v2 " Ian Abbott
  5 siblings, 0 replies; 16+ messages in thread
From: Ian Abbott @ 2025-11-04 15:27 UTC (permalink / raw)
  To: linux-fpga; +Cc: Moritz Fischer, Xu Yilun, Tom Rix, linux-kernel, Ian Abbott

Add dummy definitions of the FPGA region API functions for build
testing.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 include/linux/fpga/fpga-region.h | 44 +++++++++++++++++++++++++++++---
 1 file changed, 40 insertions(+), 4 deletions(-)

diff --git a/include/linux/fpga/fpga-region.h b/include/linux/fpga/fpga-region.h
index 5fbc05fe70a6..db4c7c1b9151 100644
--- a/include/linux/fpga/fpga-region.h
+++ b/include/linux/fpga/fpga-region.h
@@ -6,6 +6,7 @@
 #include <linux/device.h>
 #include <linux/fpga/fpga-mgr.h>
 #include <linux/fpga/fpga-bridge.h>
+#include <linux/err.h>
 
 struct fpga_region;
 
@@ -54,23 +55,58 @@ struct fpga_region {
 
 #define to_fpga_region(d) container_of(d, struct fpga_region, dev)
 
+#define fpga_region_register_full(parent, info) \
+	__fpga_region_register_full(parent, info, THIS_MODULE)
+
+#define fpga_region_register(parent, mgr, get_bridges) \
+	__fpga_region_register(parent, mgr, get_bridges, THIS_MODULE)
+
+#ifdef CONFIG_FPGA_REGION
 struct fpga_region *
 fpga_region_class_find(struct device *start, const void *data,
 		       int (*match)(struct device *, const void *));
 
 int fpga_region_program_fpga(struct fpga_region *region);
 
-#define fpga_region_register_full(parent, info) \
-	__fpga_region_register_full(parent, info, THIS_MODULE)
 struct fpga_region *
 __fpga_region_register_full(struct device *parent, const struct fpga_region_info *info,
 			    struct module *owner);
 
-#define fpga_region_register(parent, mgr, get_bridges) \
-	__fpga_region_register(parent, mgr, get_bridges, THIS_MODULE)
 struct fpga_region *
 __fpga_region_register(struct device *parent, struct fpga_manager *mgr,
 		       int (*get_bridges)(struct fpga_region *), struct module *owner);
 void fpga_region_unregister(struct fpga_region *region);
 
+#else
+static inline struct fpga_region *
+fpga_region_class_find(struct device *start, const void *data,
+		       int (*match)(struct device *, const void *))
+{
+	return NULL;
+}
+
+static inline int fpga_region_program_fpga(struct fpga_region *region)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline struct fpga_region *
+__fpga_region_register_full(struct device *parent, const struct fpga_region_info *info,
+			    struct module *owner)
+{
+	return ERR_PTR(-EOPNOTSUPP);
+}
+
+static inline struct fpga_region *
+__fpga_region_register(struct device *parent, struct fpga_manager *mgr,
+		       int (*get_bridges)(struct fpga_region *), struct module *owner)
+{
+	return ERR_PTR(-EOPNOTSUPP);
+}
+
+static inline void fpga_region_unregister(struct fpga_region *region)
+{
+}
+#endif
+
 #endif /* _FPGA_REGION_H */
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/4] fpga: Add dummy definitions of API functions
  2025-11-04 15:27 [PATCH 0/4] fpga: Add dummy definitions of API functions Ian Abbott
                   ` (3 preceding siblings ...)
  2025-11-04 15:27 ` [PATCH 4/4] fpga: region: " Ian Abbott
@ 2025-11-05  1:47 ` Xu Yilun
  2025-11-05 10:37   ` Ian Abbott
  2025-11-05 12:31 ` [PATCH v2 " Ian Abbott
  5 siblings, 1 reply; 16+ messages in thread
From: Xu Yilun @ 2025-11-05  1:47 UTC (permalink / raw)
  To: Ian Abbott; +Cc: linux-fpga, Moritz Fischer, Xu Yilun, Tom Rix, linux-kernel

On Tue, Nov 04, 2025 at 03:27:01PM +0000, Ian Abbott wrote:
> Add dummy definitions of the FPGA API functions for build testing
> 
> 1) fpga: altera-pr-ip: Add dummy definitions of API functions
> 2) fpga: bridge: Add dummy definitions of API functions
> 3) fpga: manager: Add dummy definitions of API functions
> 4) fpga: region: Add dummy definitions of API functions

Sorry I don't get the idea. Why should someone use FPGA APIs without
selecting CONIG_FPGA_XXX? Better make the changes along with the use
case patches.

Thanks,
Yilun

> 
>  include/linux/fpga/altera-pr-ip-core.h |  8 ++-
>  include/linux/fpga/fpga-bridge.h       | 75 ++++++++++++++++++++++++++-
>  include/linux/fpga/fpga-mgr.h          | 95 +++++++++++++++++++++++++++++++---
>  include/linux/fpga/fpga-region.h       | 44 ++++++++++++++--
>  4 files changed, 207 insertions(+), 15 deletions(-)
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/4] fpga: altera-pr-ip: Add dummy definitions of API functions
  2025-11-04 15:27 ` [PATCH 1/4] fpga: altera-pr-ip: " Ian Abbott
@ 2025-11-05  7:17   ` kernel test robot
  2025-11-05  7:39   ` kernel test robot
  1 sibling, 0 replies; 16+ messages in thread
From: kernel test robot @ 2025-11-05  7:17 UTC (permalink / raw)
  To: Ian Abbott, linux-fpga
  Cc: oe-kbuild-all, Moritz Fischer, Xu Yilun, Tom Rix, linux-kernel,
	Ian Abbott

Hi Ian,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.18-rc4 next-20251104]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ian-Abbott/fpga-altera-pr-ip-Add-dummy-definitions-of-API-functions/20251105-000956
base:   linus/master
patch link:    https://lore.kernel.org/r/20251104153013.154463-2-abbotti%40mev.co.uk
patch subject: [PATCH 1/4] fpga: altera-pr-ip: Add dummy definitions of API functions
config: parisc-randconfig-001-20251105 (https://download.01.org/0day-ci/archive/20251105/202511051513.Wkv71gq0-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 12.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251105/202511051513.Wkv71gq0-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511051513.Wkv71gq0-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/fpga/altera-pr-ip-core.c:11:
>> include/linux/fpga/altera-pr-ip-core.h:11: error: unterminated #ifndef
      11 | #ifndef _ALT_PR_IP_CORE_H
         | 
>> drivers/fpga/altera-pr-ip-core.c:176:5: error: redefinition of 'alt_pr_register'
     176 | int alt_pr_register(struct device *dev, void __iomem *reg_base)
         |     ^~~~~~~~~~~~~~~
   include/linux/fpga/altera-pr-ip-core.h:19:19: note: previous definition of 'alt_pr_register' with type 'int(struct device *, void *)'
      19 | static inline int alt_pr_register(struct device *dev, void __iomem *reg_base)
         |                   ^~~~~~~~~~~~~~~
--
   In file included from altera-pr-ip-core.c:11:
>> include/linux/fpga/altera-pr-ip-core.h:11: error: unterminated #ifndef
      11 | #ifndef _ALT_PR_IP_CORE_H
         | 
   altera-pr-ip-core.c:176:5: error: redefinition of 'alt_pr_register'
     176 | int alt_pr_register(struct device *dev, void __iomem *reg_base)
         |     ^~~~~~~~~~~~~~~
   include/linux/fpga/altera-pr-ip-core.h:19:19: note: previous definition of 'alt_pr_register' with type 'int(struct device *, void *)'
      19 | static inline int alt_pr_register(struct device *dev, void __iomem *reg_base)
         |                   ^~~~~~~~~~~~~~~


vim +11 include/linux/fpga/altera-pr-ip-core.h

d201cc17a8a31c Matthew Gerlach 2017-03-23 @11  #ifndef _ALT_PR_IP_CORE_H
d201cc17a8a31c Matthew Gerlach 2017-03-23  12  #define _ALT_PR_IP_CORE_H
d201cc17a8a31c Matthew Gerlach 2017-03-23  13  #include <linux/io.h>
961ea9f518b406 Ian Abbott      2025-11-04  14  #include <asm/errno.h>
d201cc17a8a31c Matthew Gerlach 2017-03-23  15  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/4] fpga: altera-pr-ip: Add dummy definitions of API functions
  2025-11-04 15:27 ` [PATCH 1/4] fpga: altera-pr-ip: " Ian Abbott
  2025-11-05  7:17   ` kernel test robot
@ 2025-11-05  7:39   ` kernel test robot
  1 sibling, 0 replies; 16+ messages in thread
From: kernel test robot @ 2025-11-05  7:39 UTC (permalink / raw)
  To: Ian Abbott, linux-fpga
  Cc: llvm, oe-kbuild-all, Moritz Fischer, Xu Yilun, Tom Rix,
	linux-kernel, Ian Abbott

Hi Ian,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.18-rc4 next-20251104]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ian-Abbott/fpga-altera-pr-ip-Add-dummy-definitions-of-API-functions/20251105-000956
base:   linus/master
patch link:    https://lore.kernel.org/r/20251104153013.154463-2-abbotti%40mev.co.uk
patch subject: [PATCH 1/4] fpga: altera-pr-ip: Add dummy definitions of API functions
config: arm64-randconfig-001-20251105 (https://download.01.org/0day-ci/archive/20251105/202511051539.q44jggF0-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251105/202511051539.q44jggF0-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511051539.q44jggF0-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/fpga/altera-pr-ip-core.c:11:
>> include/linux/fpga/altera-pr-ip-core.h:11:2: error: unterminated conditional directive
      11 | #ifndef _ALT_PR_IP_CORE_H
         |  ^
   In file included from drivers/fpga/altera-pr-ip-core.c:12:
   In file included from include/linux/fpga/fpga-mgr.h:12:
   In file included from include/linux/platform_device.h:13:
   In file included from include/linux/device.h:32:
   In file included from include/linux/device/driver.h:21:
   In file included from include/linux/module.h:20:
   In file included from include/linux/elf.h:6:
   In file included from arch/arm64/include/asm/elf.h:141:
   In file included from include/linux/fs.h:34:
   In file included from include/linux/percpu-rwsem.h:7:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:98:11: warning: array index 3 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
      98 |                 return (set->sig[3] | set->sig[2] |
         |                         ^        ~
   include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
      62 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from drivers/fpga/altera-pr-ip-core.c:12:
   In file included from include/linux/fpga/fpga-mgr.h:12:
   In file included from include/linux/platform_device.h:13:
   In file included from include/linux/device.h:32:
   In file included from include/linux/device/driver.h:21:
   In file included from include/linux/module.h:20:
   In file included from include/linux/elf.h:6:
   In file included from arch/arm64/include/asm/elf.h:141:
   In file included from include/linux/fs.h:34:
   In file included from include/linux/percpu-rwsem.h:7:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:98:25: warning: array index 2 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
      98 |                 return (set->sig[3] | set->sig[2] |
         |                                       ^        ~
   include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
      62 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from drivers/fpga/altera-pr-ip-core.c:12:
   In file included from include/linux/fpga/fpga-mgr.h:12:
   In file included from include/linux/platform_device.h:13:
   In file included from include/linux/device.h:32:
   In file included from include/linux/device/driver.h:21:
   In file included from include/linux/module.h:20:
   In file included from include/linux/elf.h:6:
   In file included from arch/arm64/include/asm/elf.h:141:
   In file included from include/linux/fs.h:34:
   In file included from include/linux/percpu-rwsem.h:7:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:99:4: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
      99 |                         set->sig[1] | set->sig[0]) == 0;
         |                         ^        ~
   include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
      62 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from drivers/fpga/altera-pr-ip-core.c:12:
   In file included from include/linux/fpga/fpga-mgr.h:12:
   In file included from include/linux/platform_device.h:13:
   In file included from include/linux/device.h:32:
   In file included from include/linux/device/driver.h:21:
   In file included from include/linux/module.h:20:
   In file included from include/linux/elf.h:6:
   In file included from arch/arm64/include/asm/elf.h:141:
   In file included from include/linux/fs.h:34:
   In file included from include/linux/percpu-rwsem.h:7:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:101:11: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
     101 |                 return (set->sig[1] | set->sig[0]) == 0;
         |                         ^        ~
   include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
      62 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from drivers/fpga/altera-pr-ip-core.c:12:
   In file included from include/linux/fpga/fpga-mgr.h:12:
   In file included from include/linux/platform_device.h:13:
   In file included from include/linux/device.h:32:
   In file included from include/linux/device/driver.h:21:
   In file included from include/linux/module.h:20:
   In file included from include/linux/elf.h:6:
   In file included from arch/arm64/include/asm/elf.h:141:
   In file included from include/linux/fs.h:34:
   In file included from include/linux/percpu-rwsem.h:7:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:114:11: warning: array index 3 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds]
     114 |                 return  (set1->sig[3] == set2->sig[3]) &&
         |                          ^         ~
   include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
      62 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from drivers/fpga/altera-pr-ip-core.c:12:
   In file included from include/linux/fpga/fpga-mgr.h:12:
   In file included from include/linux/platform_device.h:13:
   In file included from include/linux/device.h:32:
   In file included from include/linux/device/driver.h:21:
   In file included from include/linux/module.h:20:
   In file included from include/linux/elf.h:6:
   In file included from arch/arm64/include/asm/elf.h:141:
--
   In file included from altera-pr-ip-core.c:11:
>> include/linux/fpga/altera-pr-ip-core.h:11:2: error: unterminated conditional directive
      11 | #ifndef _ALT_PR_IP_CORE_H
         |  ^
   In file included from altera-pr-ip-core.c:12:
   In file included from include/linux/fpga/fpga-mgr.h:12:
   In file included from include/linux/platform_device.h:13:
   In file included from include/linux/device.h:32:
   In file included from include/linux/device/driver.h:21:
   In file included from include/linux/module.h:20:
   In file included from include/linux/elf.h:6:
   In file included from arch/arm64/include/asm/elf.h:141:
   In file included from include/linux/fs.h:34:
   In file included from include/linux/percpu-rwsem.h:7:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:98:11: warning: array index 3 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
      98 |                 return (set->sig[3] | set->sig[2] |
         |                         ^        ~
   include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
      62 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from altera-pr-ip-core.c:12:
   In file included from include/linux/fpga/fpga-mgr.h:12:
   In file included from include/linux/platform_device.h:13:
   In file included from include/linux/device.h:32:
   In file included from include/linux/device/driver.h:21:
   In file included from include/linux/module.h:20:
   In file included from include/linux/elf.h:6:
   In file included from arch/arm64/include/asm/elf.h:141:
   In file included from include/linux/fs.h:34:
   In file included from include/linux/percpu-rwsem.h:7:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:98:25: warning: array index 2 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
      98 |                 return (set->sig[3] | set->sig[2] |
         |                                       ^        ~
   include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
      62 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from altera-pr-ip-core.c:12:
   In file included from include/linux/fpga/fpga-mgr.h:12:
   In file included from include/linux/platform_device.h:13:
   In file included from include/linux/device.h:32:
   In file included from include/linux/device/driver.h:21:
   In file included from include/linux/module.h:20:
   In file included from include/linux/elf.h:6:
   In file included from arch/arm64/include/asm/elf.h:141:
   In file included from include/linux/fs.h:34:
   In file included from include/linux/percpu-rwsem.h:7:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:99:4: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
      99 |                         set->sig[1] | set->sig[0]) == 0;
         |                         ^        ~
   include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
      62 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from altera-pr-ip-core.c:12:
   In file included from include/linux/fpga/fpga-mgr.h:12:
   In file included from include/linux/platform_device.h:13:
   In file included from include/linux/device.h:32:
   In file included from include/linux/device/driver.h:21:
   In file included from include/linux/module.h:20:
   In file included from include/linux/elf.h:6:
   In file included from arch/arm64/include/asm/elf.h:141:
   In file included from include/linux/fs.h:34:
   In file included from include/linux/percpu-rwsem.h:7:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:101:11: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
     101 |                 return (set->sig[1] | set->sig[0]) == 0;
         |                         ^        ~
   include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
      62 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from altera-pr-ip-core.c:12:
   In file included from include/linux/fpga/fpga-mgr.h:12:
   In file included from include/linux/platform_device.h:13:
   In file included from include/linux/device.h:32:
   In file included from include/linux/device/driver.h:21:
   In file included from include/linux/module.h:20:
   In file included from include/linux/elf.h:6:
   In file included from arch/arm64/include/asm/elf.h:141:
   In file included from include/linux/fs.h:34:
   In file included from include/linux/percpu-rwsem.h:7:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:114:11: warning: array index 3 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds]
     114 |                 return  (set1->sig[3] == set2->sig[3]) &&
         |                          ^         ~
   include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
      62 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from altera-pr-ip-core.c:12:
   In file included from include/linux/fpga/fpga-mgr.h:12:
   In file included from include/linux/platform_device.h:13:
   In file included from include/linux/device.h:32:
   In file included from include/linux/device/driver.h:21:
   In file included from include/linux/module.h:20:
   In file included from include/linux/elf.h:6:
   In file included from arch/arm64/include/asm/elf.h:141:


vim +11 include/linux/fpga/altera-pr-ip-core.h

d201cc17a8a31cc Matthew Gerlach 2017-03-23 @11  #ifndef _ALT_PR_IP_CORE_H
d201cc17a8a31cc Matthew Gerlach 2017-03-23  12  #define _ALT_PR_IP_CORE_H
d201cc17a8a31cc Matthew Gerlach 2017-03-23  13  #include <linux/io.h>
961ea9f518b4061 Ian Abbott      2025-11-04  14  #include <asm/errno.h>
d201cc17a8a31cc Matthew Gerlach 2017-03-23  15  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/4] fpga: bridge: Add dummy definitions of API functions
  2025-11-04 15:27 ` [PATCH 2/4] fpga: bridge: " Ian Abbott
@ 2025-11-05  9:13   ` kernel test robot
  0 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2025-11-05  9:13 UTC (permalink / raw)
  To: Ian Abbott, linux-fpga
  Cc: oe-kbuild-all, Moritz Fischer, Xu Yilun, Tom Rix, linux-kernel,
	Ian Abbott

Hi Ian,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.18-rc4 next-20251105]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ian-Abbott/fpga-altera-pr-ip-Add-dummy-definitions-of-API-functions/20251105-000956
base:   linus/master
patch link:    https://lore.kernel.org/r/20251104153013.154463-3-abbotti%40mev.co.uk
patch subject: [PATCH 2/4] fpga: bridge: Add dummy definitions of API functions
config: parisc-randconfig-001-20251105 (https://download.01.org/0day-ci/archive/20251105/202511051756.m53LZeZi-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 12.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251105/202511051756.m53LZeZi-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511051756.m53LZeZi-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/fpga/fpga-bridge.c:29:5: error: redefinition of 'fpga_bridge_enable'
      29 | int fpga_bridge_enable(struct fpga_bridge *bridge)
         |     ^~~~~~~~~~~~~~~~~~
   In file included from drivers/fpga/fpga-bridge.c:8:
   include/linux/fpga/fpga-bridge.h:112:19: note: previous definition of 'fpga_bridge_enable' with type 'int(struct fpga_bridge *)'
     112 | static inline int fpga_bridge_enable(struct fpga_bridge *bridge)
         |                   ^~~~~~~~~~~~~~~~~~
>> drivers/fpga/fpga-bridge.c:47:5: error: redefinition of 'fpga_bridge_disable'
      47 | int fpga_bridge_disable(struct fpga_bridge *bridge)
         |     ^~~~~~~~~~~~~~~~~~~
   include/linux/fpga/fpga-bridge.h:117:19: note: previous definition of 'fpga_bridge_disable' with type 'int(struct fpga_bridge *)'
     117 | static inline int fpga_bridge_disable(struct fpga_bridge *bridge)
         |                   ^~~~~~~~~~~~~~~~~~~
>> drivers/fpga/fpga-bridge.c:91:21: error: redefinition of 'of_fpga_bridge_get'
      91 | struct fpga_bridge *of_fpga_bridge_get(struct device_node *np,
         |                     ^~~~~~~~~~~~~~~~~~
   include/linux/fpga/fpga-bridge.h:97:1: note: previous definition of 'of_fpga_bridge_get' with type 'struct fpga_bridge *(struct device_node *, struct fpga_image_info *)'
      97 | of_fpga_bridge_get(struct device_node *node, struct fpga_image_info *info)
         | ^~~~~~~~~~~~~~~~~~
>> drivers/fpga/fpga-bridge.c:123:21: error: redefinition of 'fpga_bridge_get'
     123 | struct fpga_bridge *fpga_bridge_get(struct device *dev,
         |                     ^~~~~~~~~~~~~~~
   include/linux/fpga/fpga-bridge.h:103:1: note: previous definition of 'fpga_bridge_get' with type 'struct fpga_bridge *(struct device *, struct fpga_image_info *)'
     103 | fpga_bridge_get(struct device *dev, struct fpga_image_info *info)
         | ^~~~~~~~~~~~~~~
>> drivers/fpga/fpga-bridge.c:147:6: error: redefinition of 'fpga_bridge_put'
     147 | void fpga_bridge_put(struct fpga_bridge *bridge)
         |      ^~~~~~~~~~~~~~~
   include/linux/fpga/fpga-bridge.h:108:20: note: previous definition of 'fpga_bridge_put' with type 'void(struct fpga_bridge *)'
     108 | static inline void fpga_bridge_put(struct fpga_bridge *bridge)
         |                    ^~~~~~~~~~~~~~~
>> drivers/fpga/fpga-bridge.c:166:5: error: redefinition of 'fpga_bridges_enable'
     166 | int fpga_bridges_enable(struct list_head *bridge_list)
         |     ^~~~~~~~~~~~~~~~~~~
   include/linux/fpga/fpga-bridge.h:122:19: note: previous definition of 'fpga_bridges_enable' with type 'int(struct list_head *)'
     122 | static inline int fpga_bridges_enable(struct list_head *bridge_list)
         |                   ^~~~~~~~~~~~~~~~~~~
>> drivers/fpga/fpga-bridge.c:190:5: error: redefinition of 'fpga_bridges_disable'
     190 | int fpga_bridges_disable(struct list_head *bridge_list)
         |     ^~~~~~~~~~~~~~~~~~~~
   include/linux/fpga/fpga-bridge.h:127:19: note: previous definition of 'fpga_bridges_disable' with type 'int(struct list_head *)'
     127 | static inline int fpga_bridges_disable(struct list_head *bridge_list)
         |                   ^~~~~~~~~~~~~~~~~~~~
>> drivers/fpga/fpga-bridge.c:213:6: error: redefinition of 'fpga_bridges_put'
     213 | void fpga_bridges_put(struct list_head *bridge_list)
         |      ^~~~~~~~~~~~~~~~
   include/linux/fpga/fpga-bridge.h:132:20: note: previous definition of 'fpga_bridges_put' with type 'void(struct list_head *)'
     132 | static inline void fpga_bridges_put(struct list_head *bridge_list)
         |                    ^~~~~~~~~~~~~~~~
>> drivers/fpga/fpga-bridge.c:239:5: error: redefinition of 'of_fpga_bridge_get_to_list'
     239 | int of_fpga_bridge_get_to_list(struct device_node *np,
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fpga/fpga-bridge.h:143:19: note: previous definition of 'of_fpga_bridge_get_to_list' with type 'int(struct device_node *, struct fpga_image_info *, struct list_head *)'
     143 | static inline int of_fpga_bridge_get_to_list(struct device_node *np,
         |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/fpga/fpga-bridge.c:269:5: error: redefinition of 'fpga_bridge_get_to_list'
     269 | int fpga_bridge_get_to_list(struct device *dev,
         |     ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fpga/fpga-bridge.h:136:19: note: previous definition of 'fpga_bridge_get_to_list' with type 'int(struct device *, struct fpga_image_info *, struct list_head *)'
     136 | static inline int fpga_bridge_get_to_list(struct device *dev,
         |                   ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/fpga/fpga-bridge.c:332:1: error: redefinition of '__fpga_bridge_register'
     332 | __fpga_bridge_register(struct device *parent, const char *name,
         | ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/fpga/fpga-bridge.h:151:1: note: previous definition of '__fpga_bridge_register' with type 'struct fpga_bridge *(struct device *, const char *, const struct fpga_bridge_ops *, void *, struct module *)'
     151 | __fpga_bridge_register(struct device *parent, const char *name,
         | ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/fpga/fpga-bridge.c:403:6: error: redefinition of 'fpga_bridge_unregister'
     403 | void fpga_bridge_unregister(struct fpga_bridge *bridge)
         |      ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/fpga/fpga-bridge.h:158:20: note: previous definition of 'fpga_bridge_unregister' with type 'void(struct fpga_bridge *)'
     158 | static inline void fpga_bridge_unregister(struct fpga_bridge *br)
         |                    ^~~~~~~~~~~~~~~~~~~~~~


vim +/fpga_bridge_enable +29 drivers/fpga/fpga-bridge.c

21aeda950c5f84 Alan Tull      2016-11-01   21  
21aeda950c5f84 Alan Tull      2016-11-01   22  /**
21aeda950c5f84 Alan Tull      2016-11-01   23   * fpga_bridge_enable - Enable transactions on the bridge
21aeda950c5f84 Alan Tull      2016-11-01   24   *
21aeda950c5f84 Alan Tull      2016-11-01   25   * @bridge: FPGA bridge
21aeda950c5f84 Alan Tull      2016-11-01   26   *
21aeda950c5f84 Alan Tull      2016-11-01   27   * Return: 0 for success, error code otherwise.
21aeda950c5f84 Alan Tull      2016-11-01   28   */
21aeda950c5f84 Alan Tull      2016-11-01  @29  int fpga_bridge_enable(struct fpga_bridge *bridge)
21aeda950c5f84 Alan Tull      2016-11-01   30  {
21aeda950c5f84 Alan Tull      2016-11-01   31  	dev_dbg(&bridge->dev, "enable\n");
21aeda950c5f84 Alan Tull      2016-11-01   32  
b1a91ca25f15b6 Marco Pagani   2024-02-01   33  	if (bridge->br_ops->enable_set)
21aeda950c5f84 Alan Tull      2016-11-01   34  		return bridge->br_ops->enable_set(bridge, 1);
21aeda950c5f84 Alan Tull      2016-11-01   35  
21aeda950c5f84 Alan Tull      2016-11-01   36  	return 0;
21aeda950c5f84 Alan Tull      2016-11-01   37  }
21aeda950c5f84 Alan Tull      2016-11-01   38  EXPORT_SYMBOL_GPL(fpga_bridge_enable);
21aeda950c5f84 Alan Tull      2016-11-01   39  
21aeda950c5f84 Alan Tull      2016-11-01   40  /**
21aeda950c5f84 Alan Tull      2016-11-01   41   * fpga_bridge_disable - Disable transactions on the bridge
21aeda950c5f84 Alan Tull      2016-11-01   42   *
21aeda950c5f84 Alan Tull      2016-11-01   43   * @bridge: FPGA bridge
21aeda950c5f84 Alan Tull      2016-11-01   44   *
21aeda950c5f84 Alan Tull      2016-11-01   45   * Return: 0 for success, error code otherwise.
21aeda950c5f84 Alan Tull      2016-11-01   46   */
21aeda950c5f84 Alan Tull      2016-11-01  @47  int fpga_bridge_disable(struct fpga_bridge *bridge)
21aeda950c5f84 Alan Tull      2016-11-01   48  {
21aeda950c5f84 Alan Tull      2016-11-01   49  	dev_dbg(&bridge->dev, "disable\n");
21aeda950c5f84 Alan Tull      2016-11-01   50  
b1a91ca25f15b6 Marco Pagani   2024-02-01   51  	if (bridge->br_ops->enable_set)
21aeda950c5f84 Alan Tull      2016-11-01   52  		return bridge->br_ops->enable_set(bridge, 0);
21aeda950c5f84 Alan Tull      2016-11-01   53  
21aeda950c5f84 Alan Tull      2016-11-01   54  	return 0;
21aeda950c5f84 Alan Tull      2016-11-01   55  }
21aeda950c5f84 Alan Tull      2016-11-01   56  EXPORT_SYMBOL_GPL(fpga_bridge_disable);
21aeda950c5f84 Alan Tull      2016-11-01   57  
1da11f822042eb Marco Pagani   2024-03-22   58  static struct fpga_bridge *__fpga_bridge_get(struct device *bridge_dev,
21aeda950c5f84 Alan Tull      2016-11-01   59  					     struct fpga_image_info *info)
21aeda950c5f84 Alan Tull      2016-11-01   60  {
21aeda950c5f84 Alan Tull      2016-11-01   61  	struct fpga_bridge *bridge;
21aeda950c5f84 Alan Tull      2016-11-01   62  
1da11f822042eb Marco Pagani   2024-03-22   63  	bridge = to_fpga_bridge(bridge_dev);
21aeda950c5f84 Alan Tull      2016-11-01   64  
21aeda950c5f84 Alan Tull      2016-11-01   65  	bridge->info = info;
21aeda950c5f84 Alan Tull      2016-11-01   66  
1da11f822042eb Marco Pagani   2024-03-22   67  	if (!mutex_trylock(&bridge->mutex))
1da11f822042eb Marco Pagani   2024-03-22   68  		return ERR_PTR(-EBUSY);
21aeda950c5f84 Alan Tull      2016-11-01   69  
1da11f822042eb Marco Pagani   2024-03-22   70  	if (!try_module_get(bridge->br_ops_owner)) {
1da11f822042eb Marco Pagani   2024-03-22   71  		mutex_unlock(&bridge->mutex);
1da11f822042eb Marco Pagani   2024-03-22   72  		return ERR_PTR(-ENODEV);
1da11f822042eb Marco Pagani   2024-03-22   73  	}
21aeda950c5f84 Alan Tull      2016-11-01   74  
21aeda950c5f84 Alan Tull      2016-11-01   75  	dev_dbg(&bridge->dev, "get\n");
21aeda950c5f84 Alan Tull      2016-11-01   76  
21aeda950c5f84 Alan Tull      2016-11-01   77  	return bridge;
21aeda950c5f84 Alan Tull      2016-11-01   78  }
9c1c4b2753fea3 Alan Tull      2017-11-15   79  
9c1c4b2753fea3 Alan Tull      2017-11-15   80  /**
e7555cf6c263d9 Tom Rix        2021-06-08   81   * of_fpga_bridge_get - get an exclusive reference to an fpga bridge
9c1c4b2753fea3 Alan Tull      2017-11-15   82   *
8e665c9c1affcb Marco Pagani   2023-07-06   83   * @np: node pointer of an FPGA bridge.
8e665c9c1affcb Marco Pagani   2023-07-06   84   * @info: fpga image specific information.
9c1c4b2753fea3 Alan Tull      2017-11-15   85   *
8e665c9c1affcb Marco Pagani   2023-07-06   86   * Return:
8e665c9c1affcb Marco Pagani   2023-07-06   87   * * fpga_bridge struct pointer if successful.
8e665c9c1affcb Marco Pagani   2023-07-06   88   * * -EBUSY if someone already has a reference to the bridge.
8e665c9c1affcb Marco Pagani   2023-07-06   89   * * -ENODEV if @np is not an FPGA Bridge or can't take parent driver refcount.
9c1c4b2753fea3 Alan Tull      2017-11-15   90   */
9c1c4b2753fea3 Alan Tull      2017-11-15  @91  struct fpga_bridge *of_fpga_bridge_get(struct device_node *np,
9c1c4b2753fea3 Alan Tull      2017-11-15   92  				       struct fpga_image_info *info)
9c1c4b2753fea3 Alan Tull      2017-11-15   93  {
1da11f822042eb Marco Pagani   2024-03-22   94  	struct fpga_bridge *bridge;
1da11f822042eb Marco Pagani   2024-03-22   95  	struct device *bridge_dev;
9c1c4b2753fea3 Alan Tull      2017-11-15   96  
1da11f822042eb Marco Pagani   2024-03-22   97  	bridge_dev = class_find_device_by_of_node(&fpga_bridge_class, np);
1da11f822042eb Marco Pagani   2024-03-22   98  	if (!bridge_dev)
9c1c4b2753fea3 Alan Tull      2017-11-15   99  		return ERR_PTR(-ENODEV);
9c1c4b2753fea3 Alan Tull      2017-11-15  100  
1da11f822042eb Marco Pagani   2024-03-22  101  	bridge = __fpga_bridge_get(bridge_dev, info);
1da11f822042eb Marco Pagani   2024-03-22  102  	if (IS_ERR(bridge))
1da11f822042eb Marco Pagani   2024-03-22  103  		put_device(bridge_dev);
1da11f822042eb Marco Pagani   2024-03-22  104  
1da11f822042eb Marco Pagani   2024-03-22  105  	return bridge;
9c1c4b2753fea3 Alan Tull      2017-11-15  106  }
21aeda950c5f84 Alan Tull      2016-11-01  107  EXPORT_SYMBOL_GPL(of_fpga_bridge_get);
21aeda950c5f84 Alan Tull      2016-11-01  108  
9c1c4b2753fea3 Alan Tull      2017-11-15  109  static int fpga_bridge_dev_match(struct device *dev, const void *data)
9c1c4b2753fea3 Alan Tull      2017-11-15  110  {
9c1c4b2753fea3 Alan Tull      2017-11-15  111  	return dev->parent == data;
9c1c4b2753fea3 Alan Tull      2017-11-15  112  }
9c1c4b2753fea3 Alan Tull      2017-11-15  113  
9c1c4b2753fea3 Alan Tull      2017-11-15  114  /**
e7555cf6c263d9 Tom Rix        2021-06-08  115   * fpga_bridge_get - get an exclusive reference to an fpga bridge
9c1c4b2753fea3 Alan Tull      2017-11-15  116   * @dev:	parent device that fpga bridge was registered with
7ef1a2c1c9dffa Marco Pagani   2023-03-01  117   * @info:	fpga image specific information
9c1c4b2753fea3 Alan Tull      2017-11-15  118   *
e7555cf6c263d9 Tom Rix        2021-06-08  119   * Given a device, get an exclusive reference to an fpga bridge.
9c1c4b2753fea3 Alan Tull      2017-11-15  120   *
b4d9a0e5ca1396 Alan Tull      2018-09-12  121   * Return: fpga bridge struct or IS_ERR() condition containing error code.
9c1c4b2753fea3 Alan Tull      2017-11-15  122   */
9c1c4b2753fea3 Alan Tull      2017-11-15 @123  struct fpga_bridge *fpga_bridge_get(struct device *dev,
9c1c4b2753fea3 Alan Tull      2017-11-15  124  				    struct fpga_image_info *info)
9c1c4b2753fea3 Alan Tull      2017-11-15  125  {
1da11f822042eb Marco Pagani   2024-03-22  126  	struct fpga_bridge *bridge;
9c1c4b2753fea3 Alan Tull      2017-11-15  127  	struct device *bridge_dev;
9c1c4b2753fea3 Alan Tull      2017-11-15  128  
7bb2d2190d4326 Ivan Orlov     2023-08-11  129  	bridge_dev = class_find_device(&fpga_bridge_class, NULL, dev,
9c1c4b2753fea3 Alan Tull      2017-11-15  130  				       fpga_bridge_dev_match);
9c1c4b2753fea3 Alan Tull      2017-11-15  131  	if (!bridge_dev)
9c1c4b2753fea3 Alan Tull      2017-11-15  132  		return ERR_PTR(-ENODEV);
9c1c4b2753fea3 Alan Tull      2017-11-15  133  
1da11f822042eb Marco Pagani   2024-03-22  134  	bridge = __fpga_bridge_get(bridge_dev, info);
1da11f822042eb Marco Pagani   2024-03-22  135  	if (IS_ERR(bridge))
1da11f822042eb Marco Pagani   2024-03-22  136  		put_device(bridge_dev);
1da11f822042eb Marco Pagani   2024-03-22  137  
1da11f822042eb Marco Pagani   2024-03-22  138  	return bridge;
9c1c4b2753fea3 Alan Tull      2017-11-15  139  }
9c1c4b2753fea3 Alan Tull      2017-11-15  140  EXPORT_SYMBOL_GPL(fpga_bridge_get);
9c1c4b2753fea3 Alan Tull      2017-11-15  141  
21aeda950c5f84 Alan Tull      2016-11-01  142  /**
21aeda950c5f84 Alan Tull      2016-11-01  143   * fpga_bridge_put - release a reference to a bridge
21aeda950c5f84 Alan Tull      2016-11-01  144   *
21aeda950c5f84 Alan Tull      2016-11-01  145   * @bridge: FPGA bridge
21aeda950c5f84 Alan Tull      2016-11-01  146   */
21aeda950c5f84 Alan Tull      2016-11-01 @147  void fpga_bridge_put(struct fpga_bridge *bridge)
21aeda950c5f84 Alan Tull      2016-11-01  148  {
21aeda950c5f84 Alan Tull      2016-11-01  149  	dev_dbg(&bridge->dev, "put\n");
21aeda950c5f84 Alan Tull      2016-11-01  150  
21aeda950c5f84 Alan Tull      2016-11-01  151  	bridge->info = NULL;
1da11f822042eb Marco Pagani   2024-03-22  152  	module_put(bridge->br_ops_owner);
21aeda950c5f84 Alan Tull      2016-11-01  153  	mutex_unlock(&bridge->mutex);
21aeda950c5f84 Alan Tull      2016-11-01  154  	put_device(&bridge->dev);
21aeda950c5f84 Alan Tull      2016-11-01  155  }
21aeda950c5f84 Alan Tull      2016-11-01  156  EXPORT_SYMBOL_GPL(fpga_bridge_put);
21aeda950c5f84 Alan Tull      2016-11-01  157  
21aeda950c5f84 Alan Tull      2016-11-01  158  /**
21aeda950c5f84 Alan Tull      2016-11-01  159   * fpga_bridges_enable - enable bridges in a list
21aeda950c5f84 Alan Tull      2016-11-01  160   * @bridge_list: list of FPGA bridges
21aeda950c5f84 Alan Tull      2016-11-01  161   *
21aeda950c5f84 Alan Tull      2016-11-01  162   * Enable each bridge in the list. If list is empty, do nothing.
21aeda950c5f84 Alan Tull      2016-11-01  163   *
8e665c9c1affcb Marco Pagani   2023-07-06  164   * Return: 0 for success or empty bridge list or an error code otherwise.
21aeda950c5f84 Alan Tull      2016-11-01  165   */
21aeda950c5f84 Alan Tull      2016-11-01 @166  int fpga_bridges_enable(struct list_head *bridge_list)
21aeda950c5f84 Alan Tull      2016-11-01  167  {
21aeda950c5f84 Alan Tull      2016-11-01  168  	struct fpga_bridge *bridge;
21aeda950c5f84 Alan Tull      2016-11-01  169  	int ret;
21aeda950c5f84 Alan Tull      2016-11-01  170  
c37235cce31d5e Moritz Fischer 2017-03-10  171  	list_for_each_entry(bridge, bridge_list, node) {
21aeda950c5f84 Alan Tull      2016-11-01  172  		ret = fpga_bridge_enable(bridge);
21aeda950c5f84 Alan Tull      2016-11-01  173  		if (ret)
21aeda950c5f84 Alan Tull      2016-11-01  174  			return ret;
21aeda950c5f84 Alan Tull      2016-11-01  175  	}
21aeda950c5f84 Alan Tull      2016-11-01  176  
21aeda950c5f84 Alan Tull      2016-11-01  177  	return 0;
21aeda950c5f84 Alan Tull      2016-11-01  178  }
21aeda950c5f84 Alan Tull      2016-11-01  179  EXPORT_SYMBOL_GPL(fpga_bridges_enable);
21aeda950c5f84 Alan Tull      2016-11-01  180  
21aeda950c5f84 Alan Tull      2016-11-01  181  /**
21aeda950c5f84 Alan Tull      2016-11-01  182   * fpga_bridges_disable - disable bridges in a list
21aeda950c5f84 Alan Tull      2016-11-01  183   *
21aeda950c5f84 Alan Tull      2016-11-01  184   * @bridge_list: list of FPGA bridges
21aeda950c5f84 Alan Tull      2016-11-01  185   *
21aeda950c5f84 Alan Tull      2016-11-01  186   * Disable each bridge in the list. If list is empty, do nothing.
21aeda950c5f84 Alan Tull      2016-11-01  187   *
8e665c9c1affcb Marco Pagani   2023-07-06  188   * Return: 0 for success or empty bridge list or an error code otherwise.
21aeda950c5f84 Alan Tull      2016-11-01  189   */
21aeda950c5f84 Alan Tull      2016-11-01 @190  int fpga_bridges_disable(struct list_head *bridge_list)
21aeda950c5f84 Alan Tull      2016-11-01  191  {
21aeda950c5f84 Alan Tull      2016-11-01  192  	struct fpga_bridge *bridge;
21aeda950c5f84 Alan Tull      2016-11-01  193  	int ret;
21aeda950c5f84 Alan Tull      2016-11-01  194  
c37235cce31d5e Moritz Fischer 2017-03-10  195  	list_for_each_entry(bridge, bridge_list, node) {
21aeda950c5f84 Alan Tull      2016-11-01  196  		ret = fpga_bridge_disable(bridge);
21aeda950c5f84 Alan Tull      2016-11-01  197  		if (ret)
21aeda950c5f84 Alan Tull      2016-11-01  198  			return ret;
21aeda950c5f84 Alan Tull      2016-11-01  199  	}
21aeda950c5f84 Alan Tull      2016-11-01  200  
21aeda950c5f84 Alan Tull      2016-11-01  201  	return 0;
21aeda950c5f84 Alan Tull      2016-11-01  202  }
21aeda950c5f84 Alan Tull      2016-11-01  203  EXPORT_SYMBOL_GPL(fpga_bridges_disable);
21aeda950c5f84 Alan Tull      2016-11-01  204  
21aeda950c5f84 Alan Tull      2016-11-01  205  /**
21aeda950c5f84 Alan Tull      2016-11-01  206   * fpga_bridges_put - put bridges
21aeda950c5f84 Alan Tull      2016-11-01  207   *
21aeda950c5f84 Alan Tull      2016-11-01  208   * @bridge_list: list of FPGA bridges
21aeda950c5f84 Alan Tull      2016-11-01  209   *
21aeda950c5f84 Alan Tull      2016-11-01  210   * For each bridge in the list, put the bridge and remove it from the list.
21aeda950c5f84 Alan Tull      2016-11-01  211   * If list is empty, do nothing.
21aeda950c5f84 Alan Tull      2016-11-01  212   */
21aeda950c5f84 Alan Tull      2016-11-01 @213  void fpga_bridges_put(struct list_head *bridge_list)
21aeda950c5f84 Alan Tull      2016-11-01  214  {
c37235cce31d5e Moritz Fischer 2017-03-10  215  	struct fpga_bridge *bridge, *next;
21aeda950c5f84 Alan Tull      2016-11-01  216  	unsigned long flags;
21aeda950c5f84 Alan Tull      2016-11-01  217  
c37235cce31d5e Moritz Fischer 2017-03-10  218  	list_for_each_entry_safe(bridge, next, bridge_list, node) {
21aeda950c5f84 Alan Tull      2016-11-01  219  		fpga_bridge_put(bridge);
21aeda950c5f84 Alan Tull      2016-11-01  220  
21aeda950c5f84 Alan Tull      2016-11-01  221  		spin_lock_irqsave(&bridge_list_lock, flags);
21aeda950c5f84 Alan Tull      2016-11-01  222  		list_del(&bridge->node);
21aeda950c5f84 Alan Tull      2016-11-01  223  		spin_unlock_irqrestore(&bridge_list_lock, flags);
21aeda950c5f84 Alan Tull      2016-11-01  224  	}
21aeda950c5f84 Alan Tull      2016-11-01  225  }
21aeda950c5f84 Alan Tull      2016-11-01  226  EXPORT_SYMBOL_GPL(fpga_bridges_put);
21aeda950c5f84 Alan Tull      2016-11-01  227  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/4] fpga: Add dummy definitions of API functions
  2025-11-05  1:47 ` [PATCH 0/4] fpga: " Xu Yilun
@ 2025-11-05 10:37   ` Ian Abbott
  2025-11-05 14:08     ` Xu Yilun
  0 siblings, 1 reply; 16+ messages in thread
From: Ian Abbott @ 2025-11-05 10:37 UTC (permalink / raw)
  To: Xu Yilun; +Cc: linux-fpga, Moritz Fischer, Xu Yilun, Tom Rix, linux-kernel

On 2025-11-05 01:47, Xu Yilun wrote:
> On Tue, Nov 04, 2025 at 03:27:01PM +0000, Ian Abbott wrote:
>> Add dummy definitions of the FPGA API functions for build testing
>>
>> 1) fpga: altera-pr-ip: Add dummy definitions of API functions
>> 2) fpga: bridge: Add dummy definitions of API functions
>> 3) fpga: manager: Add dummy definitions of API functions
>> 4) fpga: region: Add dummy definitions of API functions
> 
> Sorry I don't get the idea. Why should someone use FPGA APIs without
> selecting CONIG_FPGA_XXX? Better make the changes along with the use
> case patches.

Projects using FPGAs often have custom devices with custom, out-of-tree 
drivers, so it's quite useful to be able to build test those drivers 
against later kernel versions on the host to keep up with kernel API 
drift, prior to possible later adoption of the kernel version on the target.

> Thanks,
> Yilun
> 
>>
>>   include/linux/fpga/altera-pr-ip-core.h |  8 ++-
>>   include/linux/fpga/fpga-bridge.h       | 75 ++++++++++++++++++++++++++-
>>   include/linux/fpga/fpga-mgr.h          | 95 +++++++++++++++++++++++++++++++---
>>   include/linux/fpga/fpga-region.h       | 44 ++++++++++++++--
>>   4 files changed, 207 insertions(+), 15 deletions(-)
However, I messed up the patches, because I only built them without the 
FPGA configure options defined.  I plan to submit a v2 patch series 
unless it is deemed a complete waste of effort by the maintainers.

Cheers,
Ian
-- 
-=( Ian Abbott <abbotti@mev.co.uk> || MEV Ltd. is a company  )=-
-=( registered in England & Wales.  Regd. number: 02862268.  )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 0/4] fpga: Add dummy definitions of API functions
  2025-11-04 15:27 [PATCH 0/4] fpga: Add dummy definitions of API functions Ian Abbott
                   ` (4 preceding siblings ...)
  2025-11-05  1:47 ` [PATCH 0/4] fpga: " Xu Yilun
@ 2025-11-05 12:31 ` Ian Abbott
  2025-11-05 12:31   ` [PATCH v2 1/4] fpga: altera-pr-ip: " Ian Abbott
                     ` (3 more replies)
  5 siblings, 4 replies; 16+ messages in thread
From: Ian Abbott @ 2025-11-05 12:31 UTC (permalink / raw)
  To: linux-fpga; +Cc: Moritz Fischer, Xu Yilun, Tom Rix, linux-kernel

Add dummy definitions of the FPGA API functions for build testing.

v2: (1) Add a missing #endif to altera-pr-ip-core.h
    (2) Change conditional compilation tests to use #if
        IS_ENABLED(CONFIG_xxx) instead of #ifdef CONFIG_xxx to avoid
        compilation errors when the options are configured as modules.

1) fpga: altera-pr-ip: Add dummy definitions of API functions
2) fpga: bridge: Add dummy definitions of API functions
3) fpga: manager: Add dummy definitions of API functions
4) fpga: region: Add dummy definitions of API functions

 include/linux/fpga/altera-pr-ip-core.h |  8 +++
 include/linux/fpga/fpga-bridge.h       | 75 ++++++++++++++++++++++++++-
 include/linux/fpga/fpga-mgr.h          | 95 +++++++++++++++++++++++++++++++---
 include/linux/fpga/fpga-region.h       | 44 ++++++++++++++--
 4 files changed, 208 insertions(+), 14 deletions(-)


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 1/4] fpga: altera-pr-ip: Add dummy definitions of API functions
  2025-11-05 12:31 ` [PATCH v2 " Ian Abbott
@ 2025-11-05 12:31   ` Ian Abbott
  2025-11-05 12:31   ` [PATCH v2 2/4] fpga: bridge: " Ian Abbott
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 16+ messages in thread
From: Ian Abbott @ 2025-11-05 12:31 UTC (permalink / raw)
  To: linux-fpga; +Cc: Moritz Fischer, Xu Yilun, Tom Rix, linux-kernel, Ian Abbott

Add a dummy definition of alt_pr_register() for build testing.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
v2: (1) Add missing #endif.
    (2) Correct conditional compilation test for ALTERA_PR_IP_CORE
        tristate configuration.
---
 include/linux/fpga/altera-pr-ip-core.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/linux/fpga/altera-pr-ip-core.h b/include/linux/fpga/altera-pr-ip-core.h
index a6b4c07858cc..f91b4cf918fb 100644
--- a/include/linux/fpga/altera-pr-ip-core.h
+++ b/include/linux/fpga/altera-pr-ip-core.h
@@ -11,7 +11,15 @@
 #ifndef _ALT_PR_IP_CORE_H
 #define _ALT_PR_IP_CORE_H
 #include <linux/io.h>
+#include <asm/errno.h>
 
+#if IS_ENABLED(CONFIG_ALTERA_PR_IP_CORE)
 int alt_pr_register(struct device *dev, void __iomem *reg_base);
+#else
+static inline int alt_pr_register(struct device *dev, void __iomem *reg_base)
+{
+	return -EOPNOTSUPP;
+}
+#endif
 
 #endif /* _ALT_PR_IP_CORE_H */
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 2/4] fpga: bridge: Add dummy definitions of API functions
  2025-11-05 12:31 ` [PATCH v2 " Ian Abbott
  2025-11-05 12:31   ` [PATCH v2 1/4] fpga: altera-pr-ip: " Ian Abbott
@ 2025-11-05 12:31   ` Ian Abbott
  2025-11-05 12:31   ` [PATCH v2 3/4] fpga: manager: " Ian Abbott
  2025-11-05 12:31   ` [PATCH v2 4/4] fpga: region: " Ian Abbott
  3 siblings, 0 replies; 16+ messages in thread
From: Ian Abbott @ 2025-11-05 12:31 UTC (permalink / raw)
  To: linux-fpga; +Cc: Moritz Fischer, Xu Yilun, Tom Rix, linux-kernel, Ian Abbott

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

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
v2: Correct conditional compilation test for FPGA_BRIDGE tristate
    configuration.
---
 include/linux/fpga/fpga-bridge.h | 75 +++++++++++++++++++++++++++++++-
 1 file changed, 73 insertions(+), 2 deletions(-)

diff --git a/include/linux/fpga/fpga-bridge.h b/include/linux/fpga/fpga-bridge.h
index 94c4edd047e5..82494cc325f3 100644
--- a/include/linux/fpga/fpga-bridge.h
+++ b/include/linux/fpga/fpga-bridge.h
@@ -5,6 +5,7 @@
 
 #include <linux/device.h>
 #include <linux/fpga/fpga-mgr.h>
+#include <linux/err.h>
 
 struct fpga_bridge;
 
@@ -63,6 +64,10 @@ struct fpga_bridge {
 
 #define to_fpga_bridge(d) container_of(d, struct fpga_bridge, dev)
 
+#define fpga_bridge_register(parent, name, br_ops, priv) \
+	__fpga_bridge_register(parent, name, br_ops, priv, THIS_MODULE)
+
+#if IS_ENABLED(CONFIG_FPGA_BRIDGE)
 struct fpga_bridge *of_fpga_bridge_get(struct device_node *node,
 				       struct fpga_image_info *info);
 struct fpga_bridge *fpga_bridge_get(struct device *dev,
@@ -81,12 +86,78 @@ int of_fpga_bridge_get_to_list(struct device_node *np,
 			       struct fpga_image_info *info,
 			       struct list_head *bridge_list);
 
-#define fpga_bridge_register(parent, name, br_ops, priv) \
-	__fpga_bridge_register(parent, name, br_ops, priv, THIS_MODULE)
 struct fpga_bridge *
 __fpga_bridge_register(struct device *parent, const char *name,
 		       const struct fpga_bridge_ops *br_ops, void *priv,
 		       struct module *owner);
 void fpga_bridge_unregister(struct fpga_bridge *br);
 
+#else
+static inline struct fpga_bridge *
+of_fpga_bridge_get(struct device_node *node, struct fpga_image_info *info)
+{
+	return ERR_PTR(-EOPNOTSUPP);
+}
+
+static inline struct fpga_bridge *
+fpga_bridge_get(struct device *dev, struct fpga_image_info *info)
+{
+	return ERR_PTR(-EOPNOTSUPP);
+}
+
+static inline void fpga_bridge_put(struct fpga_bridge *bridge)
+{
+}
+
+static inline int fpga_bridge_enable(struct fpga_bridge *bridge)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline int fpga_bridge_disable(struct fpga_bridge *bridge)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline int fpga_bridges_enable(struct list_head *bridge_list)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline int fpga_bridges_disable(struct list_head *bridge_list)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline void fpga_bridges_put(struct list_head *bridge_list)
+{
+}
+
+static inline int fpga_bridge_get_to_list(struct device *dev,
+					  struct fpga_image_info *info,
+					  struct list_head *bridge_list)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline int of_fpga_bridge_get_to_list(struct device_node *np,
+					     struct fpga_image_info *info,
+					     struct list_head *bridge_list)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline struct fpga_bridge *
+__fpga_bridge_register(struct device *parent, const char *name,
+		       const struct fpga_bridge_ops *br_ops, void *priv,
+		       struct module *owner)
+{
+	return ERR_PTR(-EOPNOTSUPP);
+}
+
+static inline void fpga_bridge_unregister(struct fpga_bridge *br)
+{
+}
+#endif
+
 #endif /* _LINUX_FPGA_BRIDGE_H */
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 3/4] fpga: manager: Add dummy definitions of API functions
  2025-11-05 12:31 ` [PATCH v2 " Ian Abbott
  2025-11-05 12:31   ` [PATCH v2 1/4] fpga: altera-pr-ip: " Ian Abbott
  2025-11-05 12:31   ` [PATCH v2 2/4] fpga: bridge: " Ian Abbott
@ 2025-11-05 12:31   ` Ian Abbott
  2025-11-05 12:31   ` [PATCH v2 4/4] fpga: region: " Ian Abbott
  3 siblings, 0 replies; 16+ messages in thread
From: Ian Abbott @ 2025-11-05 12:31 UTC (permalink / raw)
  To: linux-fpga; +Cc: Moritz Fischer, Xu Yilun, Tom Rix, linux-kernel, Ian Abbott

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

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
v2: Correct conditional compilation test for FPGA_MGR tristate
    configuration.
---
 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..38a139edc29c 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)
+
+#if IS_ENABLED(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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 4/4] fpga: region: Add dummy definitions of API functions
  2025-11-05 12:31 ` [PATCH v2 " Ian Abbott
                     ` (2 preceding siblings ...)
  2025-11-05 12:31   ` [PATCH v2 3/4] fpga: manager: " Ian Abbott
@ 2025-11-05 12:31   ` Ian Abbott
  3 siblings, 0 replies; 16+ messages in thread
From: Ian Abbott @ 2025-11-05 12:31 UTC (permalink / raw)
  To: linux-fpga; +Cc: Moritz Fischer, Xu Yilun, Tom Rix, linux-kernel, Ian Abbott

Add dummy definitions of the FPGA region API functions for build
testing.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
v2: Correct conditional compilation test for FPGA_REGION tristate
    configuration.
---
 include/linux/fpga/fpga-region.h | 44 +++++++++++++++++++++++++++++---
 1 file changed, 40 insertions(+), 4 deletions(-)

diff --git a/include/linux/fpga/fpga-region.h b/include/linux/fpga/fpga-region.h
index 5fbc05fe70a6..11263b33f0dc 100644
--- a/include/linux/fpga/fpga-region.h
+++ b/include/linux/fpga/fpga-region.h
@@ -6,6 +6,7 @@
 #include <linux/device.h>
 #include <linux/fpga/fpga-mgr.h>
 #include <linux/fpga/fpga-bridge.h>
+#include <linux/err.h>
 
 struct fpga_region;
 
@@ -54,23 +55,58 @@ struct fpga_region {
 
 #define to_fpga_region(d) container_of(d, struct fpga_region, dev)
 
+#define fpga_region_register_full(parent, info) \
+	__fpga_region_register_full(parent, info, THIS_MODULE)
+
+#define fpga_region_register(parent, mgr, get_bridges) \
+	__fpga_region_register(parent, mgr, get_bridges, THIS_MODULE)
+
+#if IS_ENABLED(CONFIG_FPGA_REGION)
 struct fpga_region *
 fpga_region_class_find(struct device *start, const void *data,
 		       int (*match)(struct device *, const void *));
 
 int fpga_region_program_fpga(struct fpga_region *region);
 
-#define fpga_region_register_full(parent, info) \
-	__fpga_region_register_full(parent, info, THIS_MODULE)
 struct fpga_region *
 __fpga_region_register_full(struct device *parent, const struct fpga_region_info *info,
 			    struct module *owner);
 
-#define fpga_region_register(parent, mgr, get_bridges) \
-	__fpga_region_register(parent, mgr, get_bridges, THIS_MODULE)
 struct fpga_region *
 __fpga_region_register(struct device *parent, struct fpga_manager *mgr,
 		       int (*get_bridges)(struct fpga_region *), struct module *owner);
 void fpga_region_unregister(struct fpga_region *region);
 
+#else
+static inline struct fpga_region *
+fpga_region_class_find(struct device *start, const void *data,
+		       int (*match)(struct device *, const void *))
+{
+	return NULL;
+}
+
+static inline int fpga_region_program_fpga(struct fpga_region *region)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline struct fpga_region *
+__fpga_region_register_full(struct device *parent, const struct fpga_region_info *info,
+			    struct module *owner)
+{
+	return ERR_PTR(-EOPNOTSUPP);
+}
+
+static inline struct fpga_region *
+__fpga_region_register(struct device *parent, struct fpga_manager *mgr,
+		       int (*get_bridges)(struct fpga_region *), struct module *owner)
+{
+	return ERR_PTR(-EOPNOTSUPP);
+}
+
+static inline void fpga_region_unregister(struct fpga_region *region)
+{
+}
+#endif
+
 #endif /* _FPGA_REGION_H */
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/4] fpga: Add dummy definitions of API functions
  2025-11-05 10:37   ` Ian Abbott
@ 2025-11-05 14:08     ` Xu Yilun
  0 siblings, 0 replies; 16+ messages in thread
From: Xu Yilun @ 2025-11-05 14:08 UTC (permalink / raw)
  To: Ian Abbott; +Cc: linux-fpga, Moritz Fischer, Xu Yilun, Tom Rix, linux-kernel

On Wed, Nov 05, 2025 at 10:37:39AM +0000, Ian Abbott wrote:
> On 2025-11-05 01:47, Xu Yilun wrote:
> > On Tue, Nov 04, 2025 at 03:27:01PM +0000, Ian Abbott wrote:
> > > Add dummy definitions of the FPGA API functions for build testing
> > > 
> > > 1) fpga: altera-pr-ip: Add dummy definitions of API functions
> > > 2) fpga: bridge: Add dummy definitions of API functions
> > > 3) fpga: manager: Add dummy definitions of API functions
> > > 4) fpga: region: Add dummy definitions of API functions
> > 
> > Sorry I don't get the idea. Why should someone use FPGA APIs without
> > selecting CONIG_FPGA_XXX? Better make the changes along with the use
> > case patches.
> 
> Projects using FPGAs often have custom devices with custom, out-of-tree
> drivers, so it's quite useful to be able to build test those drivers against
> later kernel versions on the host to keep up with kernel API drift, prior to

But why don't you select the FPGA options on your "later kernel"? I
don't see much benifit for not doing so. Finally you still need
runtime test for new kernel adoption which requires selecting these
FPGA options.

And the problem for these stubs is, real users lose the chance to find
config error at earlier stage.

> possible later adoption of the kernel version on the target.
> 
> > Thanks,
> > Yilun
> > 
> > > 
> > >   include/linux/fpga/altera-pr-ip-core.h |  8 ++-
> > >   include/linux/fpga/fpga-bridge.h       | 75 ++++++++++++++++++++++++++-
> > >   include/linux/fpga/fpga-mgr.h          | 95 +++++++++++++++++++++++++++++++---
> > >   include/linux/fpga/fpga-region.h       | 44 ++++++++++++++--
> > >   4 files changed, 207 insertions(+), 15 deletions(-)
> However, I messed up the patches, because I only built them without the FPGA
> configure options defined.  I plan to submit a v2 patch series unless it is
> deemed a complete waste of effort by the maintainers.

Sorry, for now it still seems unnecessary to me.

Thanks,
Yilun

> 
> Cheers,
> Ian
> -- 
> -=( Ian Abbott <abbotti@mev.co.uk> || MEV Ltd. is a company  )=-
> -=( registered in England & Wales.  Regd. number: 02862268.  )=-
> -=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
> -=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2025-11-05 14:22 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-04 15:27 [PATCH 0/4] fpga: Add dummy definitions of API functions Ian Abbott
2025-11-04 15:27 ` [PATCH 1/4] fpga: altera-pr-ip: " Ian Abbott
2025-11-05  7:17   ` kernel test robot
2025-11-05  7:39   ` kernel test robot
2025-11-04 15:27 ` [PATCH 2/4] fpga: bridge: " Ian Abbott
2025-11-05  9:13   ` kernel test robot
2025-11-04 15:27 ` [PATCH 3/4] fpga: manager: " Ian Abbott
2025-11-04 15:27 ` [PATCH 4/4] fpga: region: " Ian Abbott
2025-11-05  1:47 ` [PATCH 0/4] fpga: " Xu Yilun
2025-11-05 10:37   ` Ian Abbott
2025-11-05 14:08     ` Xu Yilun
2025-11-05 12:31 ` [PATCH v2 " Ian Abbott
2025-11-05 12:31   ` [PATCH v2 1/4] fpga: altera-pr-ip: " Ian Abbott
2025-11-05 12:31   ` [PATCH v2 2/4] fpga: bridge: " Ian Abbott
2025-11-05 12:31   ` [PATCH v2 3/4] fpga: manager: " Ian Abbott
2025-11-05 12:31   ` [PATCH v2 4/4] fpga: region: " Ian Abbott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).