Skip to contentSkip to conversation

Fix sparse warnings in zynq platform

PATCH Applied Ashok Reddy Soma 2 participants 8 messages Jun 14, 2023 – Jun 23, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover Fix sparse warnings in zynq platform

Fix below sparse warnings
- Add missing prototype for zynqmp_mmio_write
- Add missing prototype for zynq_qspi_mem_exec_op
- Change datatype of status and ecc_status from u32 to int
- Pass the missing argument type in function definition
- Add the missing function prototypes
- Add missing prototype for xilinx_qspi_mem_exec_op

Changes in v2:
- Move prototype declaration from sys_proto.h to include/zynqmp_firmware.h
- Added argument void in below files to fix warning

    board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c
    board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c
    board/xilinx/zynq/zynq-zed/ps7_init_gpl.c

Algapally Santosh Sagar (6):
spi: xilinx_spi: Add missing prototype for xilinx_qspi_mem_exec_op
xilinx: zynq: Add missing prototype for zynqmp_mmio_write
spi: zynq_qspi: Add missing prototype for zynq_qspi_mem_exec_op
mtd: nand: zynq_nand: Change datatype of status and ecc_status to int
arm: zynq: Pass the missing argument type in function definition
xilinx: zynq: Add the missing function prototypes

 board/xilinx/zynq/board.c                      | 2 ++
 board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c | 4 ++--
 board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c    | 4 ++--
 board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c    | 4 ++--
 board/xilinx/zynq/zynq-zed/ps7_init_gpl.c      | 4 ++--
 drivers/mtd/nand/raw/zynq_nand.c               | 4 ++--
 drivers/spi/xilinx_spi.c                       | 4 ++--
 drivers/spi/zynq_qspi.c                        | 4 ++--
 include/zynqmp_firmware.h                      | 1 +
 9 files changed, 17 insertions(+), 14 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/6 spi: xilinx_spi: Add missing prototype for xilinx_qspi_mem_exec_op

From: Algapally Santosh Sagar <[email protected]>

Add missing prototype to fix the below sparse warning
warning: no previous prototype for 'xilinx_qspi_mem_exec_op' [-Wmissing-prototypes]

---

(no changes since v1)

 drivers/spi/xilinx_spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/xilinx_spi.c +2 -2
index 33575fe757..b58a3f632a 100644
@@ -363,8 +363,8 @@ static int xilinx_qspi_check_buswidth(struct spi_slave *slave, u8 width)
 	return -EOPNOTSUPP;
 }
 
-bool xilinx_qspi_mem_exec_op(struct spi_slave *slave,
-			     const struct spi_mem_op *op)
+static bool xilinx_qspi_mem_exec_op(struct spi_slave *slave,
+				    const struct spi_mem_op *op)
 {
 	if (xilinx_qspi_check_buswidth(slave, op->cmd.buswidth))
 		return false;
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 2/6 xilinx: zynq: Add missing prototype for zynqmp_mmio_write

In reply to Ashok Reddy Soma

From: Algapally Santosh Sagar <[email protected]>

Add missing prototype to fix the sparse warning, warning: no previous prototype for 'zynqmp_mmio_write' [-Wmissing-prototypes].

---

Changes in v2:
- Move prototype declaration from sys_proto.h to include/zynqmp_firmware.h

 include/zynqmp_firmware.h | 1 +
 1 file changed, 1 insertion(+)
include/zynqmp_firmware.h +1 -0
index f7a4a39d35..3cbd91e216 100644
@@ -454,6 +454,7 @@ int zynqmp_pm_set_sd_config(u32 node, enum pm_sd_config_type config, u32 value);
 int zynqmp_pm_set_gem_config(u32 node, enum pm_gem_config_type config,
 			     u32 value);
 int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id);
+int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value);
 
 /* Type of Config Object */
 #define PM_CONFIG_OBJECT_TYPE_BASE	0x1U
Signature · 1 line
2.17.1
#3 lore raw

PATCH v2 3/6 spi: zynq_qspi: Add missing prototype for zynq_qspi_mem_exec_op

In reply to Ashok Reddy Soma

From: Algapally Santosh Sagar <[email protected]>

Add missing prototype to fix the sparse warning, warning: no previous prototype for 'zynq_qspi_mem_exec_op' [-Wmissing-prototypes].

---

(no changes since v1)

 drivers/spi/zynq_qspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/zynq_qspi.c +2 -2
index d1d4048966..cb52c0f307 100644
@@ -747,8 +747,8 @@ static int zynq_qspi_check_buswidth(struct spi_slave *slave, u8 width)
 	return -EOPNOTSUPP;
 }
 
-bool zynq_qspi_mem_exec_op(struct spi_slave *slave,
-			   const struct spi_mem_op *op)
+static bool zynq_qspi_mem_exec_op(struct spi_slave *slave,
+				  const struct spi_mem_op *op)
 {
 	if (zynq_qspi_check_buswidth(slave, op->cmd.buswidth))
 		return false;
Signature · 1 line
2.17.1
#4 lore raw

PATCH v2 4/6 mtd: nand: zynq_nand: Change datatype of status and ecc_status to int

In reply to Ashok Reddy Soma

From: Algapally Santosh Sagar <[email protected]>

status and ecc_status are of unsigned type where they are compared for negative value. This is pointed by below sparse warning. Change datatype to int to fix this.
warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits]

---

(no changes since v1)

 drivers/mtd/nand/raw/zynq_nand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/zynq_nand.c +2 -2
index 9e3ee7412d..545fdd7b69 100644
@@ -285,7 +285,7 @@ static int zynq_nand_init_nand_flash(struct mtd_info *mtd, int option)
 {
 	struct nand_chip *nand_chip = mtd_to_nand(mtd);
 	struct nand_drv *smc = nand_get_controller_data(nand_chip);
-	u32 status;
+	int status;
 
 	/* disable interrupts */
 	writel(ZYNQ_NAND_CLR_CONFIG, &smc->reg->cfr);
@@ -332,7 +332,7 @@ static int zynq_nand_calculate_hwecc(struct mtd_info *mtd, const u8 *data,
 	struct nand_drv *smc = nand_get_controller_data(nand_chip);
 	u32 ecc_value = 0;
 	u8 ecc_reg, ecc_byte;
-	u32 ecc_status;
+	int ecc_status;
 
 	/* Wait till the ECC operation is complete */
 	ecc_status = zynq_nand_waitfor_ecc_completion(mtd);
Signature · 1 line
2.17.1
#5 lore raw

PATCH v2 5/6 arm: zynq: Pass the missing argument type in function definition

In reply to Ashok Reddy Soma

From: Algapally Santosh Sagar <[email protected]>

Pass missing argument type in the function definition to fix the sparse warning, warning: old-style function definition [-Wold-style-definition]

---

Changes in v2:
- Added argument void in below files to fix warning

    board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c
    board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c
    board/xilinx/zynq/zynq-zed/ps7_init_gpl.c
 board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c | 4 ++--
 board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c    | 4 ++--
 board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c    | 4 ++--
 board/xilinx/zynq/zynq-zed/ps7_init_gpl.c      | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)
board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c +2 -2
index c2a6f9199a..602a789e77 100644
@@ -12408,7 +12408,7 @@ unsigned long *ps7_ddr_init_data = ps7_ddr_init_data_3_0;
 unsigned long *ps7_peripherals_init_data = ps7_peripherals_init_data_3_0;
 
 int
-ps7_post_config()
+ps7_post_config(void)
 {
   // Get the PS_VERSION on run time
   unsigned long si_ver = ps7GetSiliconVersion ();
@@ -12427,7 +12427,7 @@ ps7_post_config()
 }
 
 int
-ps7_init()
+ps7_init(void)
 {
   // Get the PS_VERSION on run time
   unsigned long si_ver = ps7GetSiliconVersion ();
board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c +2 -2
index fd102a3ce4..9343683f4d 100644
@@ -12741,7 +12741,7 @@ unsigned long *ps7_ddr_init_data = ps7_ddr_init_data_3_0;
 unsigned long *ps7_peripherals_init_data = ps7_peripherals_init_data_3_0;
 
 int
-ps7_post_config()
+ps7_post_config(void)
 {
   // Get the PS_VERSION on run time
   unsigned long si_ver = ps7GetSiliconVersion ();
@@ -12760,7 +12760,7 @@ ps7_post_config()
 }
 
 int
-ps7_init()
+ps7_init(void)
 {
   // Get the PS_VERSION on run time
   unsigned long si_ver = ps7GetSiliconVersion ();
board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c +2 -2
index 796e5b0c5f..6b153aa379 100644
@@ -12648,7 +12648,7 @@ unsigned long *ps7_ddr_init_data = ps7_ddr_init_data_3_0;
 unsigned long *ps7_peripherals_init_data = ps7_peripherals_init_data_3_0;
 
 int
-ps7_post_config()
+ps7_post_config(void)
 {
   // Get the PS_VERSION on run time
   unsigned long si_ver = ps7GetSiliconVersion ();
@@ -12667,7 +12667,7 @@ ps7_post_config()
 }
 
 int
-ps7_init()
+ps7_init(void)
 {
   // Get the PS_VERSION on run time
   unsigned long si_ver = ps7GetSiliconVersion ();
board/xilinx/zynq/zynq-zed/ps7_init_gpl.c +2 -2
index baf89a5800..6f2edf16c2 100644
@@ -12306,7 +12306,7 @@ unsigned long *ps7_ddr_init_data = ps7_ddr_init_data_3_0;
 unsigned long *ps7_peripherals_init_data = ps7_peripherals_init_data_3_0;
 
 int
-ps7_post_config()
+ps7_post_config(void)
 {
   // Get the PS_VERSION on run time
   unsigned long si_ver = ps7GetSiliconVersion ();
@@ -12325,7 +12325,7 @@ ps7_post_config()
 }
 
 int
-ps7_init()
+ps7_init(void)
 {
   // Get the PS_VERSION on run time
   unsigned long si_ver = ps7GetSiliconVersion ();
Signature · 1 line
2.17.1
#6 lore raw

PATCH v2 6/6 xilinx: zynq: Add the missing function prototypes

In reply to Ashok Reddy Soma

From: Algapally Santosh Sagar <[email protected]>

Add the missing prototypes for the functions pointed by the below sparse warnings
warning: no previous prototype for 'set_dfu_alt_info' [-Wmissing-prototypes]
warning: no previous prototype for 'board_debug_uart_init' [-Wmissing-prototypes]

---

(no changes since v1)

 board/xilinx/zynq/board.c | 2 ++
 1 file changed, 2 insertions(+)
board/xilinx/zynq/board.c +2 -0
index 9a59445b44..3b6581e304 100644
@@ -5,6 +5,8 @@
  */
 
 #include <common.h>
+#include <debug_uart.h>
+#include <dfu.h>
 #include <init.h>
 #include <log.h>
 #include <dm/uclass.h>
Signature · 1 line
2.17.1
maintainer Applied
#7 lore raw
In reply to Ashok Reddy Soma
Quoted 24 lines · Ashok Reddy Soma

Fix below sparse warnings
- Add missing prototype for zynqmp_mmio_write
- Add missing prototype for zynq_qspi_mem_exec_op
- Change datatype of status and ecc_status from u32 to int
- Pass the missing argument type in function definition
- Add the missing function prototypes
- Add missing prototype for xilinx_qspi_mem_exec_op

Changes in v2:
- Move prototype declaration from sys_proto.h to include/zynqmp_firmware.h
- Added argument void in below files to fix warning

     board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c
     board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c
     board/xilinx/zynq/zynq-zed/ps7_init_gpl.c

Algapally Santosh Sagar (6):
spi: xilinx_spi: Add missing prototype for xilinx_qspi_mem_exec_op
xilinx: zynq: Add missing prototype for zynqmp_mmio_write
spi: zynq_qspi: Add missing prototype for zynq_qspi_mem_exec_op
mtd: nand: zynq_nand: Change datatype of status and ecc_status to int
arm: zynq: Pass the missing argument type in function definition
xilinx: zynq: Add the missing function prototypes

Quoted 11 lines
  board/xilinx/zynq/board.c                      | 2 ++
  board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c | 4 ++--
  board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c    | 4 ++--
  board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c    | 4 ++--
  board/xilinx/zynq/zynq-zed/ps7_init_gpl.c      | 4 ++--
  drivers/mtd/nand/raw/zynq_nand.c               | 4 ++--
  drivers/spi/xilinx_spi.c                       | 4 ++--
  drivers/spi/zynq_qspi.c                        | 4 ++--
  include/zynqmp_firmware.h                      | 1 +
  9 files changed, 17 insertions(+), 14 deletions(-)

Applied.
M