2021-11-24 19:13:56

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 00/20] Solve the remaining issues with clang and W=1 on media

Currently, using clang with W=1 and CONFIG_WERROR causes media to break.
This is reported by builder.linuxtv.org.

This series solve the remaining issues.

Mauro Carvalho Chehab (20):
media: adv7842: get rid of two unused functions
media: saa7134-go7007: get rid of to_state() function
media: davinci: get rid of an unused function
media: drxd: drop offset var from DownloadMicrocode()
media: drxk: drop operation_mode from set_dvbt()
media: m88ds3103: drop reg11 calculus from m88ds3103b_select_mclk()
media: si21xx: report eventual errors at set_frontend
media: solo6x10: add _maybe_unused to currently unused functions
media: si470x: fix printk warnings with clang
media: radio-si476x: drop a container_of() abstraction macro
media: lmedm04: don't ignore errors when setting a filter
media: au0828-i2c: drop a duplicated function
media: adv7604 add _maybe_unused to currently unused functions
media: adv7511: drop unused functions
media: imx290: mark read reg function as __maybe_unused
media: davinci: vpbe_osd: mark read reg function as __maybe_unused
media: qcom: camss: mark read reg function as __maybe_unused
media: mtk-mdp: address a clang warning
media: cobalt: drop an unused variable
media: mxl5005s: drop some dead code

drivers/media/dvb-frontends/drxd_hard.c | 8 -------
drivers/media/dvb-frontends/drxk_hard.c | 6 -----
drivers/media/dvb-frontends/m88ds3103.c | 6 +----
drivers/media/dvb-frontends/si21xx.c | 7 +++---
drivers/media/i2c/adv7511-v4l2.c | 22 -------------------
drivers/media/i2c/adv7604.c | 18 +++++++--------
drivers/media/i2c/adv7842.c | 10 ---------
drivers/media/i2c/imx290.c | 2 +-
drivers/media/pci/cobalt/cobalt-cpld.c | 5 +----
drivers/media/pci/saa7134/saa7134-go7007.c | 7 +-----
.../media/pci/solo6x10/solo6x10-v4l2-enc.c | 12 +++++-----
drivers/media/platform/davinci/vpbe_osd.c | 2 +-
drivers/media/platform/davinci/vpif_capture.c | 11 ----------
drivers/media/platform/mtk-mdp/mtk_mdp_core.c | 2 +-
.../media/platform/qcom/camss/camss-vfe-170.c | 2 +-
drivers/media/radio/radio-si476x.c | 6 -----
drivers/media/radio/si470x/radio-si470x-i2c.c | 4 ++--
drivers/media/radio/si470x/radio-si470x-usb.c | 8 +++----
drivers/media/tuners/mxl5005s.c | 14 +-----------
drivers/media/usb/au0828/au0828-i2c.c | 7 ------
drivers/media/usb/dvb-usb-v2/lmedm04.c | 3 +++
21 files changed, 36 insertions(+), 126 deletions(-)

--
2.33.1




2021-11-24 19:14:01

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 14/20] media: adv7511: drop unused functions

Those are aliases for another function and not used at the
current implementation. So, just drop it.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/20] at: https://lore.kernel.org/all/[email protected]/

drivers/media/i2c/adv7511-v4l2.c | 22 ----------------------
1 file changed, 22 deletions(-)

diff --git a/drivers/media/i2c/adv7511-v4l2.c b/drivers/media/i2c/adv7511-v4l2.c
index 41f4e749a859..8e13cae40ec5 100644
--- a/drivers/media/i2c/adv7511-v4l2.c
+++ b/drivers/media/i2c/adv7511-v4l2.c
@@ -270,28 +270,6 @@ static int adv7511_pktmem_rd(struct v4l2_subdev *sd, u8 reg)
return adv_smbus_read_byte_data(state->i2c_pktmem, reg);
}

-static int adv7511_pktmem_wr(struct v4l2_subdev *sd, u8 reg, u8 val)
-{
- struct adv7511_state *state = get_adv7511_state(sd);
- int ret;
- int i;
-
- for (i = 0; i < 3; i++) {
- ret = i2c_smbus_write_byte_data(state->i2c_pktmem, reg, val);
- if (ret == 0)
- return 0;
- }
- v4l2_err(sd, "%s: i2c write error\n", __func__);
- return ret;
-}
-
-/* To set specific bits in the register, a clear-mask is given (to be AND-ed),
- and then the value-mask (to be OR-ed). */
-static inline void adv7511_pktmem_wr_and_or(struct v4l2_subdev *sd, u8 reg, u8 clr_mask, u8 val_mask)
-{
- adv7511_pktmem_wr(sd, reg, (adv7511_pktmem_rd(sd, reg) & clr_mask) | val_mask);
-}
-
static inline bool adv7511_have_hotplug(struct v4l2_subdev *sd)
{
return adv7511_rd(sd, 0x42) & MASK_ADV7511_HPD_DETECT;
--
2.33.1


2021-11-24 19:14:12

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 11/20] media: lmedm04: don't ignore errors when setting a filter

Solves a clang warning

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/20] at: https://lore.kernel.org/all/[email protected]/

drivers/media/usb/dvb-usb-v2/lmedm04.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c
index fe4d886442a4..8a34e6c0d6a6 100644
--- a/drivers/media/usb/dvb-usb-v2/lmedm04.c
+++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c
@@ -423,6 +423,9 @@ static int lme2510_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)

mutex_unlock(&d->i2c_mutex);

+ if (ret)
+ return -EREMOTEIO;
+
return 0;
}

--
2.33.1


2021-11-24 19:14:24

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 10/20] media: radio-si476x: drop a container_of() abstraction macro

This isn't used anywhere. So, drop it.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/20] at: https://lore.kernel.org/all/[email protected]/

drivers/media/radio/radio-si476x.c | 6 ------
1 file changed, 6 deletions(-)

diff --git a/drivers/media/radio/radio-si476x.c b/drivers/media/radio/radio-si476x.c
index b39a68f83c5f..0bf99e1cd1d8 100644
--- a/drivers/media/radio/radio-si476x.c
+++ b/drivers/media/radio/radio-si476x.c
@@ -312,12 +312,6 @@ struct si476x_radio {
u32 audmode;
};

-static inline struct si476x_radio *
-v4l2_dev_to_radio(struct v4l2_device *d)
-{
- return container_of(d, struct si476x_radio, v4l2dev);
-}
-
static inline struct si476x_radio *
v4l2_ctrl_handler_to_radio(struct v4l2_ctrl_handler *d)
{
--
2.33.1


2021-11-24 19:14:43

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 19/20] media: cobalt: drop an unused variable

The clock_control value is read but never actually used. Based on
a comment at the code, it has to be reset at the function.

So, drop the variable that stores its value.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/20] at: https://lore.kernel.org/all/[email protected]/

drivers/media/pci/cobalt/cobalt-cpld.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/media/pci/cobalt/cobalt-cpld.c b/drivers/media/pci/cobalt/cobalt-cpld.c
index 3d8026483ac3..fad882459d23 100644
--- a/drivers/media/pci/cobalt/cobalt-cpld.c
+++ b/drivers/media/pci/cobalt/cobalt-cpld.c
@@ -236,7 +236,6 @@ bool cobalt_cpld_set_freq(struct cobalt *cobalt, unsigned f_out)
u8 n1, hsdiv;
u8 regs[6];
int found = 0;
- u16 clock_ctrl;
int retries = 3;

for (i = 0; i < ARRAY_SIZE(multipliers); i++) {
@@ -260,9 +259,7 @@ bool cobalt_cpld_set_freq(struct cobalt *cobalt, unsigned f_out)
hsdiv = multipliers[i_best].hsdiv - 4;
rfreq = div_u64(dco << 28, f_xtal);

- clock_ctrl = cpld_read(cobalt, SI570_CLOCK_CTRL);
- clock_ctrl |= S01755_REG_CLOCK_CTRL_BITMAP_CLKHSMA_FPGA_CTRL;
- clock_ctrl |= S01755_REG_CLOCK_CTRL_BITMAP_CLKHSMA_EN;
+ cpld_read(cobalt, SI570_CLOCK_CTRL);

regs[0] = (hsdiv << 5) | (n1 >> 2);
regs[1] = ((n1 & 0x3) << 6) | (rfreq >> 32);
--
2.33.1


2021-11-24 19:14:59

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 20/20] media: mxl5005s: drop some dead code

As reported by clang (with W=1), the ctrlVal var is never used.

Yet, there are even some loops to estimate it. As this is dead
code, remove it. If ever needed, someone could revert this
patch.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/20] at: https://lore.kernel.org/all/[email protected]/

drivers/media/tuners/mxl5005s.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/media/tuners/mxl5005s.c b/drivers/media/tuners/mxl5005s.c
index f6e82a8e7d37..ab4c43df9d18 100644
--- a/drivers/media/tuners/mxl5005s.c
+++ b/drivers/media/tuners/mxl5005s.c
@@ -3414,9 +3414,8 @@ static u16 MXL_ControlWrite_Group(struct dvb_frontend *fe, u16 controlNum,
u32 value, u16 controlGroup)
{
struct mxl5005s_state *state = fe->tuner_priv;
- u16 i, j, k;
+ u16 i, j;
u32 highLimit;
- u32 ctrlVal;

if (controlGroup == 1) /* Initial Control */ {

@@ -3432,9 +3431,6 @@ static u16 MXL_ControlWrite_Group(struct dvb_frontend *fe, u16 controlNum,
(u8)(state->Init_Ctrl[i].bit[j]),
(u8)((value>>j) & 0x01));
}
- ctrlVal = 0;
- for (k = 0; k < state->Init_Ctrl[i].size; k++)
- ctrlVal += state->Init_Ctrl[i].val[k] * (1 << k);
} else
return -1;
}
@@ -3454,9 +3450,6 @@ static u16 MXL_ControlWrite_Group(struct dvb_frontend *fe, u16 controlNum,
(u8)(state->CH_Ctrl[i].bit[j]),
(u8)((value>>j) & 0x01));
}
- ctrlVal = 0;
- for (k = 0; k < state->CH_Ctrl[i].size; k++)
- ctrlVal += state->CH_Ctrl[i].val[k] * (1 << k);
} else
return -1;
}
@@ -3477,11 +3470,6 @@ static u16 MXL_ControlWrite_Group(struct dvb_frontend *fe, u16 controlNum,
(u8)(state->MXL_Ctrl[i].bit[j]),
(u8)((value>>j) & 0x01));
}
- ctrlVal = 0;
- for (k = 0; k < state->MXL_Ctrl[i].size; k++)
- ctrlVal += state->
- MXL_Ctrl[i].val[k] *
- (1 << k);
} else
return -1;
}
--
2.33.1


2021-11-24 19:15:20

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 18/20] media: mtk-mdp: address a clang warning

The typecasts at the dvb-core generate clang warnings when W=1
is enabled.

Such warning is harmless, but it causes the build to break with
CONFIG_WERROR and W=1 with clang, so do the cast on a way that
it won't produce warnings anymore.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/20] at: https://lore.kernel.org/all/[email protected]/

drivers/media/platform/mtk-mdp/mtk_mdp_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
index 976aa1f4829b..11285717577f 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
@@ -148,7 +148,7 @@ static int mtk_mdp_probe(struct platform_device *pdev)
continue;
}

- comp_type = (enum mtk_mdp_comp_type)of_id->data;
+ comp_type = (long)of_id->data;

comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL);
if (!comp) {
--
2.33.1


2021-11-24 19:15:22

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 16/20] media: davinci: vpbe_osd: mark read reg function as __maybe_unused

Such function is currently unused, but could be needed in the
future. So, keep it, marking it as __maybe_unused, in order to
avoid a clang W=1 error.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/20] at: https://lore.kernel.org/all/[email protected]/

drivers/media/platform/davinci/vpbe_osd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/davinci/vpbe_osd.c b/drivers/media/platform/davinci/vpbe_osd.c
index 91b571a0ac2c..6b36cae5e6c1 100644
--- a/drivers/media/platform/davinci/vpbe_osd.c
+++ b/drivers/media/platform/davinci/vpbe_osd.c
@@ -45,7 +45,7 @@ static const struct platform_device_id vpbe_osd_devtype[] = {
MODULE_DEVICE_TABLE(platform, vpbe_osd_devtype);

/* register access routines */
-static inline u32 osd_read(struct osd_state *sd, u32 offset)
+static inline u32 __maybe_unused osd_read(struct osd_state *sd, u32 offset)
{
struct osd_state *osd = sd;

--
2.33.1


2021-11-24 19:15:22

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 17/20] media: qcom: camss: mark read reg function as __maybe_unused

Such function is currently unused, but could be needed in the
future. So, keep it, marking it as __maybe_unused, in order to
avoid a clang W=1 error.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/20] at: https://lore.kernel.org/all/[email protected]/

drivers/media/platform/qcom/camss/camss-vfe-170.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/camss/camss-vfe-170.c b/drivers/media/platform/qcom/camss/camss-vfe-170.c
index 5c083d70d495..455ae1a819e6 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe-170.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe-170.c
@@ -191,7 +191,7 @@ static u32 vfe_hw_version(struct vfe_device *vfe)
return hw_version;
}

-static inline void vfe_reg_clr(struct vfe_device *vfe, u32 reg, u32 clr_bits)
+static inline void __maybe_unused vfe_reg_clr(struct vfe_device *vfe, u32 reg, u32 clr_bits)
{
u32 bits = readl_relaxed(vfe->base + reg);

--
2.33.1


2021-11-24 19:15:23

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 15/20] media: imx290: mark read reg function as __maybe_unused

Such function is currently unused, but could be needed in the
future. So, keep it, marking it as __maybe_unused, in order to
avoid a clang W=1 error.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/20] at: https://lore.kernel.org/all/[email protected]/

drivers/media/i2c/imx290.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/imx290.c b/drivers/media/i2c/imx290.c
index bf7a6c37ca5d..caab830f8c72 100644
--- a/drivers/media/i2c/imx290.c
+++ b/drivers/media/i2c/imx290.c
@@ -363,7 +363,7 @@ static inline struct imx290 *to_imx290(struct v4l2_subdev *_sd)
return container_of(_sd, struct imx290, sd);
}

-static inline int imx290_read_reg(struct imx290 *imx290, u16 addr, u8 *value)
+static inline int __maybe_unused imx290_read_reg(struct imx290 *imx290, u16 addr, u8 *value)
{
unsigned int regval;
int ret;
--
2.33.1


2021-11-24 19:15:25

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 13/20] media: adv7604 add _maybe_unused to currently unused functions

There are several unused helper macros there, meant to parse some
fields.

While there's not wrong with that, it generates clang warnings
with W=1, causing build to break with CONFIG_WERROR.

So, add __maybe_unused to fix such warnings.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/20] at: https://lore.kernel.org/all/[email protected]/

drivers/media/i2c/adv7604.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 44768b59a6ff..be95b2264221 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -398,14 +398,14 @@ static inline int io_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask,
return io_write(sd, reg, (io_read(sd, reg) & ~mask) | val);
}

-static inline int avlink_read(struct v4l2_subdev *sd, u8 reg)
+static inline int __maybe_unused avlink_read(struct v4l2_subdev *sd, u8 reg)
{
struct adv76xx_state *state = to_state(sd);

return adv76xx_read_check(state, ADV7604_PAGE_AVLINK, reg);
}

-static inline int avlink_write(struct v4l2_subdev *sd, u8 reg, u8 val)
+static inline int __maybe_unused avlink_write(struct v4l2_subdev *sd, u8 reg, u8 val)
{
struct adv76xx_state *state = to_state(sd);

@@ -439,14 +439,14 @@ static inline int infoframe_read(struct v4l2_subdev *sd, u8 reg)
return adv76xx_read_check(state, ADV76XX_PAGE_INFOFRAME, reg);
}

-static inline int infoframe_write(struct v4l2_subdev *sd, u8 reg, u8 val)
+static inline int __maybe_unused infoframe_write(struct v4l2_subdev *sd, u8 reg, u8 val)
{
struct adv76xx_state *state = to_state(sd);

return regmap_write(state->regmap[ADV76XX_PAGE_INFOFRAME], reg, val);
}

-static inline int afe_read(struct v4l2_subdev *sd, u8 reg)
+static inline int __maybe_unused afe_read(struct v4l2_subdev *sd, u8 reg)
{
struct adv76xx_state *state = to_state(sd);

@@ -479,14 +479,14 @@ static inline int rep_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, u8
return rep_write(sd, reg, (rep_read(sd, reg) & ~mask) | val);
}

-static inline int edid_read(struct v4l2_subdev *sd, u8 reg)
+static inline int __maybe_unused edid_read(struct v4l2_subdev *sd, u8 reg)
{
struct adv76xx_state *state = to_state(sd);

return adv76xx_read_check(state, ADV76XX_PAGE_EDID, reg);
}

-static inline int edid_write(struct v4l2_subdev *sd, u8 reg, u8 val)
+static inline int __maybe_unused edid_write(struct v4l2_subdev *sd, u8 reg, u8 val)
{
struct adv76xx_state *state = to_state(sd);

@@ -570,7 +570,7 @@ static inline int hdmi_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, u8
return hdmi_write(sd, reg, (hdmi_read(sd, reg) & ~mask) | val);
}

-static inline int test_write(struct v4l2_subdev *sd, u8 reg, u8 val)
+static inline int __maybe_unused test_write(struct v4l2_subdev *sd, u8 reg, u8 val)
{
struct adv76xx_state *state = to_state(sd);

@@ -601,14 +601,14 @@ static inline int cp_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 v
return cp_write(sd, reg, (cp_read(sd, reg) & ~mask) | val);
}

-static inline int vdp_read(struct v4l2_subdev *sd, u8 reg)
+static inline int __maybe_unused vdp_read(struct v4l2_subdev *sd, u8 reg)
{
struct adv76xx_state *state = to_state(sd);

return adv76xx_read_check(state, ADV7604_PAGE_VDP, reg);
}

-static inline int vdp_write(struct v4l2_subdev *sd, u8 reg, u8 val)
+static inline int __maybe_unused vdp_write(struct v4l2_subdev *sd, u8 reg, u8 val)
{
struct adv76xx_state *state = to_state(sd);

--
2.33.1


2021-11-24 19:22:13

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 18/20] media: mtk-mdp: address a clang warning

On Wed, Nov 24, 2021 at 8:13 PM Mauro Carvalho Chehab
<[email protected]> wrote:
>
> The typecasts at the dvb-core generate clang warnings when W=1
> is enabled.
>
> Such warning is harmless, but it causes the build to break with
> CONFIG_WERROR and W=1 with clang, so do the cast on a way that
> it won't produce warnings anymore.
>
> Signed-off-by: Mauro Carvalho Chehab <[email protected]>

Reviewed-by: Arnd Bergmann <[email protected]>

>
> - comp_type = (enum mtk_mdp_comp_type)of_id->data;
> + comp_type = (long)of_id->data;

I would generally use (uintptr_t) for this purpose, but the effect is the same.

Arnd

2021-11-24 19:24:17

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 00/20] Solve the remaining issues with clang and W=1 on media

On Wed, Nov 24, 2021 at 8:13 PM Mauro Carvalho Chehab
<[email protected]> wrote:
>
> Currently, using clang with W=1 and CONFIG_WERROR causes media to break.
> This is reported by builder.linuxtv.org.
>
> This series solve the remaining issues.

I looked through my randconfig tree and found one more that I had
initially not sent
as I wasn't sure whether we want to fix
-Wtautological-constant-out-of-range-compare
warnings. I'll send it now, as all warnings of that type in other
drivers have been addressed.

Arnd

2021-11-25 11:01:59

by Robert Foss

[permalink] [raw]
Subject: Re: [PATCH 17/20] media: qcom: camss: mark read reg function as __maybe_unused

Thanks for submitting this Mauro.

On Wed, 24 Nov 2021 at 20:13, Mauro Carvalho Chehab
<[email protected]> wrote:
>
> Such function is currently unused, but could be needed in the
> future. So, keep it, marking it as __maybe_unused, in order to
> avoid a clang W=1 error.
>
> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
> ---
>
> To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
> See [PATCH 00/20] at: https://lore.kernel.org/all/[email protected]/
>
> drivers/media/platform/qcom/camss/camss-vfe-170.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/qcom/camss/camss-vfe-170.c b/drivers/media/platform/qcom/camss/camss-vfe-170.c
> index 5c083d70d495..455ae1a819e6 100644
> --- a/drivers/media/platform/qcom/camss/camss-vfe-170.c
> +++ b/drivers/media/platform/qcom/camss/camss-vfe-170.c
> @@ -191,7 +191,7 @@ static u32 vfe_hw_version(struct vfe_device *vfe)
> return hw_version;
> }
>
> -static inline void vfe_reg_clr(struct vfe_device *vfe, u32 reg, u32 clr_bits)
> +static inline void __maybe_unused vfe_reg_clr(struct vfe_device *vfe, u32 reg, u32 clr_bits)
> {
> u32 bits = readl_relaxed(vfe->base + reg);
>
> --
> 2.33.1
>

I've submitted a patch[1] for removing this function, with that patch
applied, this patch is no longer needed.

[1] https://lore.kernel.org/all/[email protected]/

2021-11-26 20:16:23

by Nathan Chancellor

[permalink] [raw]
Subject: Re: [PATCH 10/20] media: radio-si476x: drop a container_of() abstraction macro

On Wed, Nov 24, 2021 at 08:13:13PM +0100, Mauro Carvalho Chehab wrote:
> This isn't used anywhere. So, drop it.
>
> Signed-off-by: Mauro Carvalho Chehab <[email protected]>

Reviewed-by: Nathan Chancellor <[email protected]>

> ---
>
> To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
> See [PATCH 00/20] at: https://lore.kernel.org/all/[email protected]/
>
> drivers/media/radio/radio-si476x.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/drivers/media/radio/radio-si476x.c b/drivers/media/radio/radio-si476x.c
> index b39a68f83c5f..0bf99e1cd1d8 100644
> --- a/drivers/media/radio/radio-si476x.c
> +++ b/drivers/media/radio/radio-si476x.c
> @@ -312,12 +312,6 @@ struct si476x_radio {
> u32 audmode;
> };
>
> -static inline struct si476x_radio *
> -v4l2_dev_to_radio(struct v4l2_device *d)
> -{
> - return container_of(d, struct si476x_radio, v4l2dev);
> -}
> -
> static inline struct si476x_radio *
> v4l2_ctrl_handler_to_radio(struct v4l2_ctrl_handler *d)
> {
> --
> 2.33.1
>
>

2021-11-26 20:20:14

by Nathan Chancellor

[permalink] [raw]
Subject: Re: [PATCH 11/20] media: lmedm04: don't ignore errors when setting a filter

On Wed, Nov 24, 2021 at 08:13:14PM +0100, Mauro Carvalho Chehab wrote:
> Solves a clang warning
>
> Signed-off-by: Mauro Carvalho Chehab <[email protected]>

Reviewed-by: Nathan Chancellor <[email protected]>

> ---
>
> To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
> See [PATCH 00/20] at: https://lore.kernel.org/all/[email protected]/
>
> drivers/media/usb/dvb-usb-v2/lmedm04.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c
> index fe4d886442a4..8a34e6c0d6a6 100644
> --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c
> +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c
> @@ -423,6 +423,9 @@ static int lme2510_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
>
> mutex_unlock(&d->i2c_mutex);
>
> + if (ret)
> + return -EREMOTEIO;
> +
> return 0;
> }
>
> --
> 2.33.1
>
>

2021-11-26 20:32:29

by Nathan Chancellor

[permalink] [raw]
Subject: Re: [PATCH 20/20] media: mxl5005s: drop some dead code

On Wed, Nov 24, 2021 at 08:13:23PM +0100, Mauro Carvalho Chehab wrote:
> As reported by clang (with W=1), the ctrlVal var is never used.
>
> Yet, there are even some loops to estimate it. As this is dead
> code, remove it. If ever needed, someone could revert this
> patch.
>
> Signed-off-by: Mauro Carvalho Chehab <[email protected]>

Reviewed-by: Nathan Chancellor <[email protected]>

> ---
>
> To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
> See [PATCH 00/20] at: https://lore.kernel.org/all/[email protected]/
>
> drivers/media/tuners/mxl5005s.c | 14 +-------------
> 1 file changed, 1 insertion(+), 13 deletions(-)
>
> diff --git a/drivers/media/tuners/mxl5005s.c b/drivers/media/tuners/mxl5005s.c
> index f6e82a8e7d37..ab4c43df9d18 100644
> --- a/drivers/media/tuners/mxl5005s.c
> +++ b/drivers/media/tuners/mxl5005s.c
> @@ -3414,9 +3414,8 @@ static u16 MXL_ControlWrite_Group(struct dvb_frontend *fe, u16 controlNum,
> u32 value, u16 controlGroup)
> {
> struct mxl5005s_state *state = fe->tuner_priv;
> - u16 i, j, k;
> + u16 i, j;
> u32 highLimit;
> - u32 ctrlVal;
>
> if (controlGroup == 1) /* Initial Control */ {
>
> @@ -3432,9 +3431,6 @@ static u16 MXL_ControlWrite_Group(struct dvb_frontend *fe, u16 controlNum,
> (u8)(state->Init_Ctrl[i].bit[j]),
> (u8)((value>>j) & 0x01));
> }
> - ctrlVal = 0;
> - for (k = 0; k < state->Init_Ctrl[i].size; k++)
> - ctrlVal += state->Init_Ctrl[i].val[k] * (1 << k);
> } else
> return -1;
> }
> @@ -3454,9 +3450,6 @@ static u16 MXL_ControlWrite_Group(struct dvb_frontend *fe, u16 controlNum,
> (u8)(state->CH_Ctrl[i].bit[j]),
> (u8)((value>>j) & 0x01));
> }
> - ctrlVal = 0;
> - for (k = 0; k < state->CH_Ctrl[i].size; k++)
> - ctrlVal += state->CH_Ctrl[i].val[k] * (1 << k);
> } else
> return -1;
> }
> @@ -3477,11 +3470,6 @@ static u16 MXL_ControlWrite_Group(struct dvb_frontend *fe, u16 controlNum,
> (u8)(state->MXL_Ctrl[i].bit[j]),
> (u8)((value>>j) & 0x01));
> }
> - ctrlVal = 0;
> - for (k = 0; k < state->MXL_Ctrl[i].size; k++)
> - ctrlVal += state->
> - MXL_Ctrl[i].val[k] *
> - (1 << k);
> } else
> return -1;
> }
> --
> 2.33.1
>
>

2021-11-26 20:37:52

by Nathan Chancellor

[permalink] [raw]
Subject: Re: [PATCH 14/20] media: adv7511: drop unused functions

On Wed, Nov 24, 2021 at 08:13:17PM +0100, Mauro Carvalho Chehab wrote:
> Those are aliases for another function and not used at the
> current implementation. So, just drop it.
>
> Signed-off-by: Mauro Carvalho Chehab <[email protected]>

Reviewed-by: Nathan Chancellor <[email protected]>

> ---
>
> To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
> See [PATCH 00/20] at: https://lore.kernel.org/all/[email protected]/
>
> drivers/media/i2c/adv7511-v4l2.c | 22 ----------------------
> 1 file changed, 22 deletions(-)
>
> diff --git a/drivers/media/i2c/adv7511-v4l2.c b/drivers/media/i2c/adv7511-v4l2.c
> index 41f4e749a859..8e13cae40ec5 100644
> --- a/drivers/media/i2c/adv7511-v4l2.c
> +++ b/drivers/media/i2c/adv7511-v4l2.c
> @@ -270,28 +270,6 @@ static int adv7511_pktmem_rd(struct v4l2_subdev *sd, u8 reg)
> return adv_smbus_read_byte_data(state->i2c_pktmem, reg);
> }
>
> -static int adv7511_pktmem_wr(struct v4l2_subdev *sd, u8 reg, u8 val)
> -{
> - struct adv7511_state *state = get_adv7511_state(sd);
> - int ret;
> - int i;
> -
> - for (i = 0; i < 3; i++) {
> - ret = i2c_smbus_write_byte_data(state->i2c_pktmem, reg, val);
> - if (ret == 0)
> - return 0;
> - }
> - v4l2_err(sd, "%s: i2c write error\n", __func__);
> - return ret;
> -}
> -
> -/* To set specific bits in the register, a clear-mask is given (to be AND-ed),
> - and then the value-mask (to be OR-ed). */
> -static inline void adv7511_pktmem_wr_and_or(struct v4l2_subdev *sd, u8 reg, u8 clr_mask, u8 val_mask)
> -{
> - adv7511_pktmem_wr(sd, reg, (adv7511_pktmem_rd(sd, reg) & clr_mask) | val_mask);
> -}
> -
> static inline bool adv7511_have_hotplug(struct v4l2_subdev *sd)
> {
> return adv7511_rd(sd, 0x42) & MASK_ADV7511_HPD_DETECT;
> --
> 2.33.1
>
>

2021-11-26 20:38:16

by Nathan Chancellor

[permalink] [raw]
Subject: Re: [PATCH 19/20] media: cobalt: drop an unused variable

On Wed, Nov 24, 2021 at 08:13:22PM +0100, Mauro Carvalho Chehab wrote:
> The clock_control value is read but never actually used. Based on
> a comment at the code, it has to be reset at the function.
>
> So, drop the variable that stores its value.
>
> Signed-off-by: Mauro Carvalho Chehab <[email protected]>

Reviewed-by: Nathan Chancellor <[email protected]>

> ---
>
> To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
> See [PATCH 00/20] at: https://lore.kernel.org/all/[email protected]/
>
> drivers/media/pci/cobalt/cobalt-cpld.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/media/pci/cobalt/cobalt-cpld.c b/drivers/media/pci/cobalt/cobalt-cpld.c
> index 3d8026483ac3..fad882459d23 100644
> --- a/drivers/media/pci/cobalt/cobalt-cpld.c
> +++ b/drivers/media/pci/cobalt/cobalt-cpld.c
> @@ -236,7 +236,6 @@ bool cobalt_cpld_set_freq(struct cobalt *cobalt, unsigned f_out)
> u8 n1, hsdiv;
> u8 regs[6];
> int found = 0;
> - u16 clock_ctrl;
> int retries = 3;
>
> for (i = 0; i < ARRAY_SIZE(multipliers); i++) {
> @@ -260,9 +259,7 @@ bool cobalt_cpld_set_freq(struct cobalt *cobalt, unsigned f_out)
> hsdiv = multipliers[i_best].hsdiv - 4;
> rfreq = div_u64(dco << 28, f_xtal);
>
> - clock_ctrl = cpld_read(cobalt, SI570_CLOCK_CTRL);
> - clock_ctrl |= S01755_REG_CLOCK_CTRL_BITMAP_CLKHSMA_FPGA_CTRL;
> - clock_ctrl |= S01755_REG_CLOCK_CTRL_BITMAP_CLKHSMA_EN;
> + cpld_read(cobalt, SI570_CLOCK_CTRL);
>
> regs[0] = (hsdiv << 5) | (n1 >> 2);
> regs[1] = ((n1 & 0x3) << 6) | (rfreq >> 32);
> --
> 2.33.1
>
>