[PATCH 1/1] axi: fix definition of axi_sandbox_get_emul()

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Wed May 10 11:59:20 CEST 2023


Compiling with gcc 13 results in an error:

    drivers/axi/axi-emul-uclass.c:16:5: warning: conflicting types for
    ‘axi_sandbox_get_emul’ due to enum/integer mismatch; have
    ‘int(struct udevice *, ulong,  enum axi_size_t,  struct udevice **)’
    {aka ‘int(struct udevice *, long unsigned int,  enum axi_size_t,
    struct udevice **)’} [-Wenum-int-mismatch]
       16 | int axi_sandbox_get_emul(struct udevice *bus, ulong address,
          |     ^~~~~~~~~~~~~~~~~~~~
    In file included from drivers/axi/axi-emul-uclass.c:14:
    ./arch/sandbox/include/asm/axi.h:48:5: note: previous declaration of
    ‘axi_sandbox_get_emul’ with type ‘int(struct udevice *, ulong,  uint,
    struct udevice **)’ {aka ‘int(struct udevice *, long unsigned int,
    unsigned int,  struct udevice **)’}
       48 | int axi_sandbox_get_emul(struct udevice *bus, ulong address, uint length,
          |     ^~~~~~~~~~~~~~~~~~~~

Adjust the header definition to match the implementation.
Define the size parameter as constant.

Fixes: 9a8bcabd8ada ("axi: Add AXI sandbox driver and simple emulator")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
 arch/sandbox/include/asm/axi.h | 8 ++++----
 drivers/axi/axi-emul-uclass.c  | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/sandbox/include/asm/axi.h b/arch/sandbox/include/asm/axi.h
index d483f7b65a..5b94beda0a 100644
--- a/arch/sandbox/include/asm/axi.h
+++ b/arch/sandbox/include/asm/axi.h
@@ -14,8 +14,8 @@
  * @bus:     The AXI bus from which to retrieve a emulation device
  * @address: The address of a transfer that should be handled by a emulation
  *	     device
- * @length:  The data width of a transfer that should be handled by a emulation
- *	     device
+ * @size:    A constant indicating the data width of the transfer that
+ *	     should be handled by an emulation device
  * @emulp:   Pointer to a buffer receiving the emulation device that handles
  *	     the transfer specified by the address and length parameters
  *
@@ -45,8 +45,8 @@
  * Return: 0 of OK, -ENODEV if no device capable of handling the specified
  *	   transfer exists or the device could not be retrieved
  */
-int axi_sandbox_get_emul(struct udevice *bus, ulong address, uint length,
-			 struct udevice **emulp);
+int axi_sandbox_get_emul(struct udevice *bus, ulong address,
+			 const enum axi_size_t size, struct udevice **emulp);
 /**
  * axi_get_store() - Get address of internal storage of a emulated AXI device
  * @dev:	Emulated AXI device to get the pointer of the internal storage
diff --git a/drivers/axi/axi-emul-uclass.c b/drivers/axi/axi-emul-uclass.c
index 793336d8c4..e6f3ef0720 100644
--- a/drivers/axi/axi-emul-uclass.c
+++ b/drivers/axi/axi-emul-uclass.c
@@ -14,7 +14,7 @@
 #include <asm/axi.h>
 
 int axi_sandbox_get_emul(struct udevice *bus, ulong address,
-			 enum axi_size_t size, struct udevice **emulp)
+			 const enum axi_size_t size, struct udevice **emulp)
 {
 	struct udevice *dev;
 	u32 reg[2];
-- 
2.39.2



More information about the U-Boot mailing list