[PATCH v2] staging: trivial: hikey9xx: fix be32<->u32 casting warnings
This patch fixes the following warnings reported by sparse, by adding missing __force annotations. drivers/staging/hikey9xx/hisi-spmi-controller.c:164:24: warning: cast to restricted __be32 drivers/staging/hikey9xx/hisi-spmi-controller.c:164:24: warning: cast to restricted __be32 drivers/staging/hikey9xx/hisi-spmi-controller.c:164:24: warning: cast to restricted __be32 drivers/staging/hikey9xx/hisi-spmi-controller.c:164:24: warning: cast to restricted __be32 drivers/staging/hikey9xx/hisi-spmi-controller.c:164:24: warning: cast to restricted __be32 drivers/staging/hikey9xx/hisi-spmi-controller.c:164:24: warning: cast to restricted __be32 drivers/staging/hikey9xx/hisi-spmi-controller.c:239:25: warning: cast from restricted __be32 Rationale for #164: data is declared as u32, and it is read and then converted by means of be32_to_cpu(). Said function expects a __be32 but data is u32, therefore there's a type missmatch here. Rationale for #239: Is the dual of #164. This time data going to be written so it needs to be converted from cpu to __be32, but writel() expects u32 and the output of cpu_to_be32 returns a __be32. Signed-off-by: Juan Antonio Aldea-Armenteros --- Changes in V2: - Fix typo in commit message. drivers/staging/hikey9xx/hisi-spmi-controller.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/hikey9xx/hisi-spmi-controller.c b/drivers/staging/hikey9xx/hisi-spmi-controller.c index f831c43f4783..861aedd5de48 100644 --- a/drivers/staging/hikey9xx/hisi-spmi-controller.c +++ b/drivers/staging/hikey9xx/hisi-spmi-controller.c @@ -161,7 +161,7 @@ static int spmi_read_cmd(struct spmi_controller *ctrl, SPMI_SLAVE_OFFSET * slave_id + SPMI_APB_SPMI_RDATA0_BASE_ADDR + i * SPMI_PER_DATAREG_BYTE); - data = be32_to_cpu((__be32)data); + data = be32_to_cpu((__be32 __force)data); if ((bc - i * SPMI_PER_DATAREG_BYTE) >> 2) { memcpy(buf, , sizeof(data)); buf += sizeof(data); @@ -236,7 +236,7 @@ static int spmi_write_cmd(struct spmi_controller *ctrl, buf += (bc % SPMI_PER_DATAREG_BYTE); } - writel((u32)cpu_to_be32(data), + writel((u32 __force)cpu_to_be32(data), spmi_controller->base + chnl_ofst + SPMI_APB_SPMI_WDATA0_BASE_ADDR + SPMI_PER_DATAREG_BYTE * i); -- 2.28.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v1] staging: trivial: hikey9xx: fix be32<->u32 casting warnings
This patch fixes the following warnings reported by sparse by adding missing __force annotations. drivers/staging/hikey9xx/hisi-spmi-controller.c:164:24: warning: cast to restricted __be32 drivers/staging/hikey9xx/hisi-spmi-controller.c:164:24: warning: cast to restricted __be32 drivers/staging/hikey9xx/hisi-spmi-controller.c:164:24: warning: cast to restricted __be32 drivers/staging/hikey9xx/hisi-spmi-controller.c:164:24: warning: cast to restricted __be32 drivers/staging/hikey9xx/hisi-spmi-controller.c:164:24: warning: cast to restricted __be32 drivers/staging/hikey9xx/hisi-spmi-controller.c:164:24: warning: cast to restricted __be32 drivers/staging/hikey9xx/hisi-spmi-controller.c:239:25: warning: cast from restricted __be32 Rationale for #164: data is declared as u32, and it read then converted by means of be32_to_cpu(). Said function expects a __be32 but data is u32, therefore there's a type missmatch here. Rationale for #293: Is the dualof #164. This time data going to be written so it needs to be converted from cpu to be32, but writel() expects u32 and the output of cpu_to_be32 returns a __be32. Signed-off-by: Juan Antonio Aldea-Armenteros --- drivers/staging/hikey9xx/hisi-spmi-controller.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/hikey9xx/hisi-spmi-controller.c b/drivers/staging/hikey9xx/hisi-spmi-controller.c index f831c43f4783..861aedd5de48 100644 --- a/drivers/staging/hikey9xx/hisi-spmi-controller.c +++ b/drivers/staging/hikey9xx/hisi-spmi-controller.c @@ -161,7 +161,7 @@ static int spmi_read_cmd(struct spmi_controller *ctrl, SPMI_SLAVE_OFFSET * slave_id + SPMI_APB_SPMI_RDATA0_BASE_ADDR + i * SPMI_PER_DATAREG_BYTE); - data = be32_to_cpu((__be32)data); + data = be32_to_cpu((__be32 __force)data); if ((bc - i * SPMI_PER_DATAREG_BYTE) >> 2) { memcpy(buf, , sizeof(data)); buf += sizeof(data); @@ -236,7 +236,7 @@ static int spmi_write_cmd(struct spmi_controller *ctrl, buf += (bc % SPMI_PER_DATAREG_BYTE); } - writel((u32)cpu_to_be32(data), + writel((u32 __force)cpu_to_be32(data), spmi_controller->base + chnl_ofst + SPMI_APB_SPMI_WDATA0_BASE_ADDR + SPMI_PER_DATAREG_BYTE * i); -- 2.28.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] media: atomisp-mt9m114: replace fixed function names
No I didn't intent to. I have sent another version. Thank you very much, Dan. Juan Antonio Aldea-Armenteros ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3] media: atomisp-mt9m114: replace fixed function names
There are a couple of debug messages using hardcoded function names instead of the preferred __func__ magic constant. Replace them: WARNING: Prefer using '"%s...", __func__' to using 'misensor_rmw_reg', this function's name, in a string 215: FILE: ./media/atomisp/i2c/atomisp-mt9m114.c:215: + v4l2_err(client, "misensor_rmw_reg error exit, read failed\n"); WARNING: Prefer using '"%s...", __func__' to using 'misensor_rmw_reg', this function's name, in a string 236: FILE: ./media/atomisp/i2c/atomisp-mt9m114.c:236: + v4l2_err(client, "misensor_rmw_reg error exit, write failed\n"); Signed-off-by: Juan Antonio Aldea-Armenteros --- PATCH V2: * Restored word "error" as pointed out by Dan Carpenter PATCH V3: * Fix V2 changelog message. drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c index 0d60918a9b19..f5de81132177 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c @@ -212,7 +212,7 @@ misensor_rmw_reg(struct i2c_client *client, u16 data_length, u16 reg, err = mt9m114_read_reg(client, data_length, reg, ); if (err) { - v4l2_err(client, "misensor_rmw_reg error exit, read failed\n"); + v4l2_err(client, "%s error exit, read failed\n", __func__); return -EINVAL; } @@ -233,7 +233,7 @@ misensor_rmw_reg(struct i2c_client *client, u16 data_length, u16 reg, err = mt9m114_write_reg(client, data_length, reg, val); if (err) { - v4l2_err(client, "misensor_rmw_reg error exit, write failed\n"); + v4l2_err(client, "%s error exit, write failed\n", __func__); return -EINVAL; } -- 2.27.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] media: atomisp-mt9m114: replace fixed function names
There are a couple of debug messages using hardcoded function names instead of the preferred __func__ magic constant. Replace them: WARNING: Prefer using '"%s...", __func__' to using 'misensor_rmw_reg', this function's name, in a string 215: FILE: ./media/atomisp/i2c/atomisp-mt9m114.c:215: + v4l2_err(client, "misensor_rmw_reg error exit, read failed\n"); WARNING: Prefer using '"%s...", __func__' to using 'misensor_rmw_reg', this function's name, in a string 236: FILE: ./media/atomisp/i2c/atomisp-mt9m114.c:236: + v4l2_err(client, "misensor_rmw_reg error exit, write failed\n"); Signed-off-by: Juan Antonio Aldea-Armenteros PATCH V2: * Restored word "error" as pointed out by Dan Carpenter --- drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c index 0d60918a9b19..f5de81132177 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c @@ -212,7 +212,7 @@ misensor_rmw_reg(struct i2c_client *client, u16 data_length, u16 reg, err = mt9m114_read_reg(client, data_length, reg, ); if (err) { - v4l2_err(client, "misensor_rmw_reg error exit, read failed\n"); + v4l2_err(client, "%s error exit, read failed\n", __func__); return -EINVAL; } @@ -233,7 +233,7 @@ misensor_rmw_reg(struct i2c_client *client, u16 data_length, u16 reg, err = mt9m114_write_reg(client, data_length, reg, val); if (err) { - v4l2_err(client, "misensor_rmw_reg error exit, write failed\n"); + v4l2_err(client, "%s error exit, write failed\n", __func__); return -EINVAL; } -- 2.27.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] media: atomisp-mt9m114: replace fixed function names
There are a couple of debug messages using hardcoded function names instead of the preferred __func__ magic constant. Replace them: WARNING: Prefer using '"%s...", __func__' to using 'misensor_rmw_reg', this function's name, in a string 215: FILE: ./media/atomisp/i2c/atomisp-mt9m114.c:215: + v4l2_err(client, "misensor_rmw_reg error exit, read failed\n"); WARNING: Prefer using '"%s...", __func__' to using 'misensor_rmw_reg', this function's name, in a string 236: FILE: ./media/atomisp/i2c/atomisp-mt9m114.c:236: + v4l2_err(client, "misensor_rmw_reg error exit, write failed\n"); Signed-off-by: Juan Antonio Aldea-Armenteros --- drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c index 0d60918a9b19..54c24bc2061d 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c @@ -212,7 +212,7 @@ misensor_rmw_reg(struct i2c_client *client, u16 data_length, u16 reg, err = mt9m114_read_reg(client, data_length, reg, ); if (err) { - v4l2_err(client, "misensor_rmw_reg error exit, read failed\n"); + v4l2_err(client, "%s exit, read failed\n", __func__); return -EINVAL; } @@ -233,7 +233,7 @@ misensor_rmw_reg(struct i2c_client *client, u16 data_length, u16 reg, err = mt9m114_write_reg(client, data_length, reg, val); if (err) { - v4l2_err(client, "misensor_rmw_reg error exit, write failed\n"); + v4l2_err(client, "%s error exit, write failed\n", __func__); return -EINVAL; } -- 2.27.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel