[PATCH 0/4] Several patch to solve warning on stm32mp1 board with W=1

Hi,
this serie includes few remaining patches on STM32 drivers or board code to avoid warning when the board stm32mp1 is compiled with W=1.
See also patches on: - ENV (V2): http://patchwork.ozlabs.org/patch/1230200/ - MTD (merged): http://patchwork.ozlabs.org/patch/1228814/
Regards
Patrick Delaunay (4): board: stm32mp1: board: add include for dfu board: stm32mp1: change dfu function to static pinctrl: stmfx: update the result type of dm_i2c_reg_read clk: stm32mp1: solve type issue in stm32mp1_lse_enable and stm32mp1_clktree
board/st/stm32mp1/stm32mp1.c | 5 +++-- drivers/clk/clk_stm32mp1.c | 9 +++++---- drivers/pinctrl/pinctrl-stmfx.c | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-)

Add include for dfu, add prototype for set_dfu_alt_info and avoid warning when compiling with W=1.
Signed-off-by: Patrick Delaunay patrick.delaunay@st.com ---
board/st/stm32mp1/stm32mp1.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index e82a43074f..2fecfc1b16 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -7,6 +7,7 @@ #include <bootm.h> #include <clk.h> #include <config.h> +#include <dfu.h> #include <dm.h> #include <env.h> #include <env_internal.h>

On 1/28/20 10:44 AM, Patrick Delaunay wrote:
Add include for dfu, add prototype for set_dfu_alt_info and avoid warning when compiling with W=1.
Signed-off-by: Patrick Delaunay patrick.delaunay@st.com
board/st/stm32mp1/stm32mp1.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index e82a43074f..2fecfc1b16 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -7,6 +7,7 @@ #include <bootm.h> #include <clk.h> #include <config.h> +#include <dfu.h> #include <dm.h> #include <env.h> #include <env_internal.h>
Reviewed-by: Patrice Chotard patrice.chotard@st.com
Thanks

Hi,
From: Patrick DELAUNAY patrick.delaunay@st.com Sent: mardi 28 janvier 2020 10:44
Add include for dfu, add prototype for set_dfu_alt_info and avoid warning when compiling with W=1.
Signed-off-by: Patrick Delaunay patrick.delaunay@st.com
Applied to u-boot-stm32/master, thanks!
Regards Patrick

Change the dfu functions dfu_otp_read and dfu_pmic_read to static, this patch avoids warning when compiling with W=1.
Signed-off-by: Patrick Delaunay patrick.delaunay@st.com ---
board/st/stm32mp1/stm32mp1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 2fecfc1b16..b6b70ce20f 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -1010,7 +1010,7 @@ void set_dfu_alt_info(char *interface, char *devstr) #include <dfu.h> #include <power/stpmic1.h>
-int dfu_otp_read(u64 offset, u8 *buffer, long *size) +static int dfu_otp_read(u64 offset, u8 *buffer, long *size) { struct udevice *dev; int ret; @@ -1030,7 +1030,7 @@ int dfu_otp_read(u64 offset, u8 *buffer, long *size) return 0; }
-int dfu_pmic_read(u64 offset, u8 *buffer, long *size) +static int dfu_pmic_read(u64 offset, u8 *buffer, long *size) { int ret; #ifdef CONFIG_PMIC_STPMIC1

On 1/28/20 10:44 AM, Patrick Delaunay wrote:
Change the dfu functions dfu_otp_read and dfu_pmic_read to static, this patch avoids warning when compiling with W=1.
Signed-off-by: Patrick Delaunay patrick.delaunay@st.com
board/st/stm32mp1/stm32mp1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 2fecfc1b16..b6b70ce20f 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -1010,7 +1010,7 @@ void set_dfu_alt_info(char *interface, char *devstr) #include <dfu.h> #include <power/stpmic1.h>
-int dfu_otp_read(u64 offset, u8 *buffer, long *size) +static int dfu_otp_read(u64 offset, u8 *buffer, long *size) { struct udevice *dev; int ret; @@ -1030,7 +1030,7 @@ int dfu_otp_read(u64 offset, u8 *buffer, long *size) return 0; }
-int dfu_pmic_read(u64 offset, u8 *buffer, long *size) +static int dfu_pmic_read(u64 offset, u8 *buffer, long *size) { int ret; #ifdef CONFIG_PMIC_STPMIC1
Reviewed-by: Patrice Chotard patrice.chotard@st.com
Thanks

Hi,
From: Patrick DELAUNAY patrick.delaunay@st.com Sent: mardi 28 janvier 2020 10:44 To: u-boot@lists.denx.de Cc: Patrick DELAUNAY patrick.delaunay@st.com; U-Boot STM32 <uboot- stm32@st-md-mailman.stormreply.com> Subject: [PATCH 2/4] board: stm32mp1: change dfu function to static Importance: High
Change the dfu functions dfu_otp_read and dfu_pmic_read to static, this patch avoids warning when compiling with W=1.
Signed-off-by: Patrick Delaunay patrick.delaunay@st.com
Applied to u-boot-stm32/master, thanks!
Regards Patrick

Use int as result of dm_i2c_reg_read to avoid warning with W=1 (warning: comparison is always false due to limited range of data type [-Wtype-limits])
Signed-off-by: Patrick Delaunay patrick.delaunay@st.com ---
drivers/pinctrl/pinctrl-stmfx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-stmfx.c b/drivers/pinctrl/pinctrl-stmfx.c index 0b5a0433cd..0def27166e 100644 --- a/drivers/pinctrl/pinctrl-stmfx.c +++ b/drivers/pinctrl/pinctrl-stmfx.c @@ -351,11 +351,12 @@ static int stmfx_chip_init(struct udevice *dev) int ret; struct dm_i2c_chip *chip = dev_get_parent_platdata(dev);
- id = dm_i2c_reg_read(dev, STMFX_REG_CHIP_ID); - if (id < 0) { - dev_err(dev, "error reading chip id: %d\n", id); + ret = dm_i2c_reg_read(dev, STMFX_REG_CHIP_ID); + if (ret < 0) { + dev_err(dev, "error reading chip id: %d\n", ret); return ret; } + id = (u8)ret; /* * Check that ID is the complement of the I2C address: * STMFX I2C address follows the 7-bit format (MSB), that's why

On 1/28/20 10:44 AM, Patrick Delaunay wrote:
Use int as result of dm_i2c_reg_read to avoid warning with W=1 (warning: comparison is always false due to limited range of data type [-Wtype-limits])
Signed-off-by: Patrick Delaunay patrick.delaunay@st.com
drivers/pinctrl/pinctrl-stmfx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-stmfx.c b/drivers/pinctrl/pinctrl-stmfx.c index 0b5a0433cd..0def27166e 100644 --- a/drivers/pinctrl/pinctrl-stmfx.c +++ b/drivers/pinctrl/pinctrl-stmfx.c @@ -351,11 +351,12 @@ static int stmfx_chip_init(struct udevice *dev) int ret; struct dm_i2c_chip *chip = dev_get_parent_platdata(dev);
- id = dm_i2c_reg_read(dev, STMFX_REG_CHIP_ID);
- if (id < 0) {
dev_err(dev, "error reading chip id: %d\n", id);
- ret = dm_i2c_reg_read(dev, STMFX_REG_CHIP_ID);
- if (ret < 0) {
return ret; }dev_err(dev, "error reading chip id: %d\n", ret);
- id = (u8)ret; /*
- Check that ID is the complement of the I2C address:
- STMFX I2C address follows the 7-bit format (MSB), that's why
Reviewed-by: Patrice Chotard patrice.chotard@st.com
Thanks

Hi,
From: Patrick DELAUNAY patrick.delaunay@st.com Sent: mardi 28 janvier 2020 10:44
Use int as result of dm_i2c_reg_read to avoid warning with W=1 (warning: comparison is always false due to limited range of data type [- Wtype-limits])
Signed-off-by: Patrick Delaunay patrick.delaunay@st.com
Applied to u-boot-stm32/master, thanks!
Regards Patrick

Solve type issue in stm32mp1_lse_enable and stm32mp1_clktree.
This patch solves the warnings when compiling with W=1 on stm32mp1 board:
clk_stm32mp1.c: In function ‘stm32mp1_lse_enable’: clk_stm32mp1.c:1238:15: warning: comparison of integer expressions of different signedness: ‘u32’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare] clk_stm32mp1.c:1239:13: warning: comparison of integer expressions of different signedness: ‘u32’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare]
clk_stm32mp1.c: In function ‘stm32mp1_clktree’: clk_stm32mp1.c:1814:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
Signed-off-by: Patrick Delaunay patrick.delaunay@st.com ---
drivers/clk/clk_stm32mp1.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/clk_stm32mp1.c b/drivers/clk/clk_stm32mp1.c index da66bde41b..fd8c821e48 100644 --- a/drivers/clk/clk_stm32mp1.c +++ b/drivers/clk/clk_stm32mp1.c @@ -1218,7 +1218,7 @@ static int stm32mp1_osc_wait(int enable, fdt_addr_t rcc, u32 offset, }
static void stm32mp1_lse_enable(fdt_addr_t rcc, int bypass, int digbyp, - int lsedrv) + u32 lsedrv) { u32 value;
@@ -1651,8 +1651,8 @@ static int stm32mp1_clktree(struct udevice *dev) unsigned int clkdiv[CLKDIV_NB]; unsigned int pllcfg[_PLL_NB][PLLCFG_NB]; ofnode plloff[_PLL_NB]; - int ret; - int i, len; + int ret, len; + uint i; int lse_css = 0; const u32 *pkcs_cell;
@@ -1698,7 +1698,8 @@ static int stm32mp1_clktree(struct udevice *dev) stm32mp1_lsi_set(rcc, 1);
if (priv->osc[_LSE]) { - int bypass, digbyp, lsedrv; + int bypass, digbyp; + u32 lsedrv; struct udevice *dev = priv->osc_dev[_LSE];
bypass = dev_read_bool(dev, "st,bypass");

On 1/28/20 10:44 AM, Patrick Delaunay wrote:
Solve type issue in stm32mp1_lse_enable and stm32mp1_clktree.
This patch solves the warnings when compiling with W=1 on stm32mp1 board:
clk_stm32mp1.c: In function ‘stm32mp1_lse_enable’: clk_stm32mp1.c:1238:15: warning: comparison of integer expressions of different signedness: ‘u32’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare] clk_stm32mp1.c:1239:13: warning: comparison of integer expressions of different signedness: ‘u32’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare]
clk_stm32mp1.c: In function ‘stm32mp1_clktree’: clk_stm32mp1.c:1814:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
Signed-off-by: Patrick Delaunay patrick.delaunay@st.com
drivers/clk/clk_stm32mp1.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/clk_stm32mp1.c b/drivers/clk/clk_stm32mp1.c index da66bde41b..fd8c821e48 100644 --- a/drivers/clk/clk_stm32mp1.c +++ b/drivers/clk/clk_stm32mp1.c @@ -1218,7 +1218,7 @@ static int stm32mp1_osc_wait(int enable, fdt_addr_t rcc, u32 offset, }
static void stm32mp1_lse_enable(fdt_addr_t rcc, int bypass, int digbyp,
int lsedrv)
u32 lsedrv)
{ u32 value;
@@ -1651,8 +1651,8 @@ static int stm32mp1_clktree(struct udevice *dev) unsigned int clkdiv[CLKDIV_NB]; unsigned int pllcfg[_PLL_NB][PLLCFG_NB]; ofnode plloff[_PLL_NB];
- int ret;
- int i, len;
- int ret, len;
- uint i; int lse_css = 0; const u32 *pkcs_cell;
@@ -1698,7 +1698,8 @@ static int stm32mp1_clktree(struct udevice *dev) stm32mp1_lsi_set(rcc, 1);
if (priv->osc[_LSE]) {
int bypass, digbyp, lsedrv;
int bypass, digbyp;
u32 lsedrv;
struct udevice *dev = priv->osc_dev[_LSE];
bypass = dev_read_bool(dev, "st,bypass");
Reviewed-by: Patrice Chotard patrice.chotard@st.com
Thanks

Hi,
From: Patrick DELAUNAY patrick.delaunay@st.com Sent: mardi 28 janvier 2020 10:44
Solve type issue in stm32mp1_lse_enable and stm32mp1_clktree.
This patch solves the warnings when compiling with W=1 on stm32mp1 board:
clk_stm32mp1.c: In function ‘stm32mp1_lse_enable’: clk_stm32mp1.c:1238:15: warning: comparison of integer expressions of different signedness: ‘u32’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare] clk_stm32mp1.c:1239:13: warning: comparison of integer expressions of different signedness: ‘u32’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare]
clk_stm32mp1.c: In function ‘stm32mp1_clktree’: clk_stm32mp1.c:1814:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
Signed-off-by: Patrick Delaunay patrick.delaunay@st.com
Applied to u-boot-stm32/master, thanks!
Regards Patrick
participants (3)
-
Patrice CHOTARD
-
Patrick DELAUNAY
-
Patrick Delaunay