[PATCH v2 0/6] 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(-)

From: Algapally Santosh Sagar santoshsagar.algapally@amd.com
Add missing prototype to fix the below sparse warning warning: no previous prototype for 'xilinx_qspi_mem_exec_op' [-Wmissing-prototypes]
Signed-off-by: Algapally Santosh Sagar santoshsagar.algapally@amd.com Signed-off-by: Ashok Reddy Soma ashok.reddy.soma@amd.com ---
(no changes since v1)
drivers/spi/xilinx_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c index 33575fe757..b58a3f632a 100644 --- a/drivers/spi/xilinx_spi.c +++ b/drivers/spi/xilinx_spi.c @@ -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;

From: Algapally Santosh Sagar santoshsagar.algapally@amd.com
Add missing prototype to fix the sparse warning, warning: no previous prototype for 'zynqmp_mmio_write' [-Wmissing-prototypes].
Signed-off-by: Algapally Santosh Sagar santoshsagar.algapally@amd.com Signed-off-by: Ashok Reddy Soma ashok.reddy.soma@amd.com ---
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(+)
diff --git a/include/zynqmp_firmware.h b/include/zynqmp_firmware.h index f7a4a39d35..3cbd91e216 100644 --- a/include/zynqmp_firmware.h +++ b/include/zynqmp_firmware.h @@ -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

From: Algapally Santosh Sagar santoshsagar.algapally@amd.com
Add missing prototype to fix the sparse warning, warning: no previous prototype for 'zynq_qspi_mem_exec_op' [-Wmissing-prototypes].
Signed-off-by: Algapally Santosh Sagar santoshsagar.algapally@amd.com Signed-off-by: Ashok Reddy Soma ashok.reddy.soma@amd.com ---
(no changes since v1)
drivers/spi/zynq_qspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/zynq_qspi.c b/drivers/spi/zynq_qspi.c index d1d4048966..cb52c0f307 100644 --- a/drivers/spi/zynq_qspi.c +++ b/drivers/spi/zynq_qspi.c @@ -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;

From: Algapally Santosh Sagar santoshsagar.algapally@amd.com
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]
Signed-off-by: Algapally Santosh Sagar santoshsagar.algapally@amd.com Reviewed-by: Michael Trimarchi michael@amarulasolutions.com Signed-off-by: Ashok Reddy Soma ashok.reddy.soma@amd.com ---
(no changes since v1)
drivers/mtd/nand/raw/zynq_nand.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/raw/zynq_nand.c b/drivers/mtd/nand/raw/zynq_nand.c index 9e3ee7412d..545fdd7b69 100644 --- a/drivers/mtd/nand/raw/zynq_nand.c +++ b/drivers/mtd/nand/raw/zynq_nand.c @@ -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);

From: Algapally Santosh Sagar santoshsagar.algapally@amd.com
Pass missing argument type in the function definition to fix the sparse warning, warning: old-style function definition [-Wold-style-definition]
Signed-off-by: Algapally Santosh Sagar santoshsagar.algapally@amd.com Signed-off-by: Ashok Reddy Soma ashok.reddy.soma@amd.com ---
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(-)
diff --git a/board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c b/board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c index c2a6f9199a..602a789e77 100644 --- a/board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c +++ b/board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c @@ -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 (); diff --git a/board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c b/board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c index fd102a3ce4..9343683f4d 100644 --- a/board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c +++ b/board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c @@ -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 (); diff --git a/board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c b/board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c index 796e5b0c5f..6b153aa379 100644 --- a/board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c +++ b/board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c @@ -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 (); diff --git a/board/xilinx/zynq/zynq-zed/ps7_init_gpl.c b/board/xilinx/zynq/zynq-zed/ps7_init_gpl.c index baf89a5800..6f2edf16c2 100644 --- a/board/xilinx/zynq/zynq-zed/ps7_init_gpl.c +++ b/board/xilinx/zynq/zynq-zed/ps7_init_gpl.c @@ -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 ();

From: Algapally Santosh Sagar santoshsagar.algapally@amd.com
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]
Signed-off-by: Algapally Santosh Sagar santoshsagar.algapally@amd.com Signed-off-by: Ashok Reddy Soma ashok.reddy.soma@amd.com ---
(no changes since v1)
board/xilinx/zynq/board.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c index 9a59445b44..3b6581e304 100644 --- a/board/xilinx/zynq/board.c +++ b/board/xilinx/zynq/board.c @@ -5,6 +5,8 @@ */
#include <common.h> +#include <debug_uart.h> +#include <dfu.h> #include <init.h> #include <log.h> #include <dm/uclass.h>

On 6/14/23 11:03, Ashok Reddy Soma wrote:
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(-)
Applied. M
participants (2)
-
Ashok Reddy Soma
-
Michal Simek