Solve the remaining issues with clang and W=1 on media
Subsystems (17)
v2 cover 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.
v2:
- Use __always_unused for the code we're keeping
- Dropped a couple more unused functions
- Added reviews got from the first submission and addressed some comments.
Mauro Carvalho Chehab (19):
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: mark unused functions as such
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: mark unused functions as such
media: adv7511: drop unused functions
media: imx290: mark read reg function as __always_unused
media: davinci: vpbe_osd: mark read reg function as __always_unused
media: mtk-mdp: address a clang warning
media: cobalt: drop an unused variable
media: mxl5005s: drop some dead code
Robert Foss (1):
media: camss: Remove unused static function
drivers/media/dvb-frontends/drxd_hard.c | 8 ------- drivers/media/dvb-frontends/drxk_hard.c | 23 ++++--------------- 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 | 7 ------ 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, 40 insertions(+), 144 deletions(-)
Signature · 1 line
2.33.1
PATCH v2 1/20 media: adv7842: get rid of two unused functions
Those functions just call a V4L2 core macro, and aren't used anywhere. Get rid of them, in order to avoid clang warnings with W=1.
---
See [PATCH v2 00/20] at: https://lore.kernel.org/all/[email protected]/
drivers/media/i2c/adv7842.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/media/i2c/adv7842.c +0 -10
@@ -256,21 +256,11 @@ static inline struct v4l2_subdev *to_sd(struct v4l2_ctrl *ctrl) return &container_of(ctrl->handler, struct adv7842_state, hdl)->sd; } -static inline unsigned hblanking (const struct v4l2_bt_timings *t) -{ -return V4L2_DV_BT_BLANKING_WIDTH (t); -} -static inline unsigned htotal (const struct v4l2_bt_timings *t) {return V4L2_DV_BT_FRAME_WIDTH (t); } -static inline unsigned vblanking (const struct v4l2_bt_timings *t) -{ -return V4L2_DV_BT_BLANKING_HEIGHT (t); -} -static inline unsigned vtotal (const struct v4l2_bt_timings *t) {return V4L2_DV_BT_FRAME_HEIGHT (t);
Signature · 1 line
2.33.1
PATCH v2 2/20 media: saa7134-go7007: get rid of to_state() function
In reply to Mauro Carvalho ChehabThis is just an alias for container_of() and it is used only on a commented code. The commented code actually is an issue that require fixes, so, move the container_of() call to the commented code, and drop the unused function.
This way, a fix for the function could be added later without needing to re-add to_state() function.
This fixes a clang W=1 warning.
---
See [PATCH v2 00/20] at: https://lore.kernel.org/all/[email protected]/
drivers/media/pci/saa7134/saa7134-go7007.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/media/pci/saa7134/saa7134-go7007.c +1 -6
@@ -56,11 +56,6 @@ struct saa7134_go7007 {dma_addr_t bottom_dma; }; -static inline struct saa7134_go7007 *to_state (struct v4l2_subdev *sd) -{ - return container_of(sd, struct saa7134_go7007, sd); -} -static const struct go7007_board_info board_voyager = { .flags =0 , .sensor_flags = GO7007_SENSOR_656 |
@@ -385,7 +380,7 @@ MODULE_FIRMWARE("go7007/go7007tv.bin");static int saa7134_go7007_s_std (struct v4l2_subdev *sd,v4l2_std_id norm) {#if 0 -struct saa7134_go7007 *saa =to_state (sd); + struct saa7134_go7007 *saa = container_of(sd, struct saa7134_go7007, sd);struct saa7134_dev *dev = saa->dev;return saa7134_s_std_internal (dev,NULL , norm);
Signature · 1 line
2.33.1
PATCH v2 4/20 media: drxd: drop offset var from DownloadMicrocode()
In reply to Mauro Carvalho ChehabThe offset is not needed, and it is never used, as the pointer itself is already incremented.
So, drop it, in order to solve a W=1 clang warning.
---
See [PATCH v2 00/20] at: https://lore.kernel.org/all/[email protected]/
drivers/media/dvb-frontends/drxd_hard.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/media/dvb-frontends/drxd_hard.c +0 -8
@@ -914,44 +914,36 @@ static int DownloadMicrocode(struct drxd_state *state,u32 Address;u16 nBlocks;u16 BlockSize; -u32 offset =0 ;int i, status =0 ; pSrc = (u8 *) pMCImage;/* We're not using Flags */ /* Flags = (pSrc[0] << 8) | pSrc[1]; */ pSrc +=sizeof (u16); - offset +=sizeof (u16); nBlocks = (pSrc[0 ] <<8 ) | pSrc[1 ]; pSrc +=sizeof (u16); - offset +=sizeof (u16);for (i =0 ; i < nBlocks; i++) { Address = (pSrc[0 ] <<24 ) | (pSrc[1 ] <<16 ) | (pSrc[2 ] <<8 ) | pSrc[3 ]; pSrc +=sizeof (u32); - offset +=sizeof (u32); BlockSize = ((pSrc[0 ] <<8 ) | pSrc[1 ]) *sizeof (u16); pSrc +=sizeof (u16); - offset +=sizeof (u16);/* We're not using Flags */ /* u16 Flags = (pSrc[0] << 8) | pSrc[1]; */ pSrc +=sizeof (u16); - offset +=sizeof (u16);/* We're not using BlockCRC */ /* u16 BlockCRC = (pSrc[0] << 8) | pSrc[1]; */ pSrc +=sizeof (u16); - offset +=sizeof (u16); status =WriteBlock (state, Address, BlockSize, pSrc,DRX_I2C_CLEARCRC );if (status <0 )break ; pSrc += BlockSize; - offset += BlockSize; }return status;
Signature · 1 line
2.33.1
PATCH v2 6/20 media: m88ds3103: drop reg11 calculus from m88ds3103b_select_mclk()
In reply to Mauro Carvalho ChehabThis value is never used at the code. So, drop it.
Solves a W=1 clang warning.
---
See [PATCH v2 00/20] at: https://lore.kernel.org/all/[email protected]/
drivers/media/dvb-frontends/m88ds3103.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/media/dvb-frontends/m88ds3103.c +1 -5
@@ -451,7 +451,7 @@ static int m88ds3103b_select_mclk(struct m88ds3103_dev *dev)static int m88ds3103b_set_mclk (struct m88ds3103_dev *dev,u32 mclk_khz) { -u8 reg11 =0x0A , reg15, reg16, reg1D, reg1E, reg1F, tmp; +u8 reg15, reg16, reg1D, reg1E, reg1F, tmp;u8 sm, f0 =0 , f1 =0 , f2 =0 , f3 =0 ;u16 pll_div_fb,N ;u32 div;
@@ -480,8 +480,6 @@ static int m88ds3103b_set_mclk(struct m88ds3103_dev *dev, u32 mclk_khz) div /= mclk_khz;if (dev->cfg->ts_mode ==M88DS3103_TS_SERIAL ) { - reg11 |=0x02 ; -if (div <=32 ) {N =2 ;
@@ -532,8 +530,6 @@ static int m88ds3103b_set_mclk(struct m88ds3103_dev *dev, u32 mclk_khz)else if ((f3 <8 ) && (f3 !=0 )) f3 =8 ; }else { - reg11 &= ~0x02 ; -if (div <=32 ) {N =2 ;
Signature · 1 line
2.33.1
PATCH v2 8/20 media: solo6x10: mark unused functions as such
In reply to Mauro Carvalho ChehabThere are several unused helper macros there, meant to parse some fields. As those actually help to document the hardware, the better is to keep them.
However, it generates clang warnings with W=1, causing build to break with CONFIG_WERROR.
So, add __always_unused to fix such warnings.
---
See [PATCH v2 00/20] at: https://lore.kernel.org/all/[email protected]/
drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c +6 -6
@@ -391,12 +391,12 @@ static int solo_send_desc(struct solo_enc_dev *solo_enc, int skip, }/* Extract values from VOP header - VE_STATUSxx */ -static inline int vop_interlaced (const vop_header *vh) +static inline __always_unused int vop_interlaced (const vop_header *vh) {return (__le32_to_cpu ((*vh)[0 ]) >>30 ) &1 ; } -static inline u8 vop_channel (const vop_header *vh) +static inline __always_unused u8 vop_channel (const vop_header *vh) {return (__le32_to_cpu ((*vh)[0 ]) >>24 ) &0x1F ; }
@@ -411,12 +411,12 @@ static inline u32 vop_mpeg_size(const vop_header *vh)return __le32_to_cpu ((*vh)[0 ]) &0xFFFFF ; } -static inline u8 vop_hsize (const vop_header *vh) +static inline u8 __always_unused vop_hsize (const vop_header *vh) {return (__le32_to_cpu ((*vh)[1 ]) >>8 ) &0xFF ; } -static inline u8 vop_vsize (const vop_header *vh) +static inline u8 __always_unused vop_vsize (const vop_header *vh) {return __le32_to_cpu ((*vh)[1 ]) &0xFF ; }
@@ -436,12 +436,12 @@ static inline u32 vop_jpeg_size(const vop_header *vh)return __le32_to_cpu ((*vh)[4 ]) &0xFFFFF ; } -static inline u32 vop_sec (const vop_header *vh) +static inline u32 __always_unused vop_sec (const vop_header *vh) {return __le32_to_cpu ((*vh)[5 ]); } -static inline u32 vop_usec (const vop_header *vh) +static inline __always_unused u32 vop_usec (const vop_header *vh) {return __le32_to_cpu ((*vh)[6 ]); }
Signature · 1 line
2.33.1
PATCH v2 9/20 media: si470x: fix printk warnings with clang
In reply to Mauro Carvalho ChehabClang doesn't like "%hu" on macros:
drivers/media/radio/si470x/radio-si470x-i2c.c:414:4: error: format specifies type 'unsigned short' but the argument has type 'int' [-Werror,-Wformat] drivers/media/radio/si470x/radio-si470x-i2c.c:417:4: error: format specifies type 'unsigned short' but the argument has type 'int' [-Werror,-Wformat]
Besides that, changeset cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi]") dropped recomendation of using %h.
So, just replace them with "%u".
---
See [PATCH v2 00/20] at: https://lore.kernel.org/all/[email protected]/
drivers/media/radio/si470x/radio-si470x-i2c.c | 4 ++-- drivers/media/radio/si470x/radio-si470x-usb.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/media/radio/si470x/radio-si470x-i2c.c +2 -2
@@ -410,10 +410,10 @@ static int si470x_i2c_probe(struct i2c_client *client) radio->registers[DEVICEID], radio->registers[SI_CHIPID]);if ((radio->registers[SI_CHIPID ] &SI_CHIPID_FIRMWARE ) <RADIO_FW_VERSION ) {dev_warn (&client->dev, -"This driver is known to work with firmware version %hu,\n" , +"This driver is known to work with firmware version %u,\n" ,RADIO_FW_VERSION );dev_warn (&client->dev, -"but the device has firmware version %hu.\n" , +"but the device has firmware version %u.\n" , radio->registers[SI_CHIPID ] &SI_CHIPID_FIRMWARE ); version_warning =1 ; }
drivers/media/radio/si470x/radio-si470x-usb.c +4 -4
@@ -681,10 +681,10 @@ static int si470x_usb_driver_probe(struct usb_interface *intf, radio->registers[DEVICEID], radio->registers[SI_CHIPID]);if ((radio->registers[SI_CHIPID ] &SI_CHIPID_FIRMWARE ) <RADIO_FW_VERSION ) {dev_warn (&intf->dev, -"This driver is known to work with firmware version %hu,\n" , +"This driver is known to work with firmware version %u,\n" ,RADIO_FW_VERSION );dev_warn (&intf->dev, -"but the device has firmware version %hu.\n" , +"but the device has firmware version %u.\n" , radio->registers[SI_CHIPID ] &SI_CHIPID_FIRMWARE ); version_warning =1 ; }
@@ -698,10 +698,10 @@ static int si470x_usb_driver_probe(struct usb_interface *intf, radio->software_version, radio->hardware_version);if (radio->hardware_version <RADIO_HW_VERSION ) {dev_warn (&intf->dev, -"This driver is known to work with hardware version %hu,\n" , +"This driver is known to work with hardware version %u,\n" ,RADIO_HW_VERSION );dev_warn (&intf->dev, -"but the device has hardware version %hu.\n" , +"but the device has hardware version %u.\n" , radio->hardware_version); version_warning =1 ; }
Signature · 1 line
2.33.1
PATCH v2 11/20 media: lmedm04: don't ignore errors when setting a filter
In reply to Mauro Carvalho ChehabSolves a clang warning.
---
See [PATCH v2 00/20] at: https://lore.kernel.org/all/[email protected]/
drivers/media/usb/dvb-usb-v2/lmedm04.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/usb/dvb-usb-v2/lmedm04.c +3 -0
@@ -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 ; }
Signature · 1 line
2.33.1
PATCH v2 13/20 media: adv7604: mark unused functions as such
In reply to Mauro Carvalho ChehabThere are several unused helper macros there, meant to parse some fields. As those actually help to document the hardware, the better is to keep them.
However, it generates clang warnings with W=1, causing build to break with CONFIG_WERROR.
So, add __always_unused to fix such warnings.
---
See [PATCH v2 00/20] at: https://lore.kernel.org/all/[email protected]/
drivers/media/i2c/adv7604.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/media/i2c/adv7604.c +9 -9
@@ -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 __always_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 __always_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 __always_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 __always_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, u8return rep_write (sd, reg, (rep_read (sd, reg) & ~mask) | val); } -static inline int edid_read (struct v4l2_subdev *sd,u8 reg) +static inline int __always_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 __always_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, u8return 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 __always_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 vreturn cp_write (sd, reg, (cp_read (sd, reg) & ~mask) | val); } -static inline int vdp_read (struct v4l2_subdev *sd,u8 reg) +static inline int __always_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 __always_unused vdp_write (struct v4l2_subdev *sd,u8 reg,u8 val) {struct adv76xx_state *state =to_state (sd);
Signature · 1 line
2.33.1
PATCH v2 15/20 media: imx290: mark read reg function as __always_unused
In reply to Mauro Carvalho ChehabSuch function is currently unused, but could be needed in the future. So, keep it, marking it as __always_unused, in order to avoid a clang W=1 error.
---
See [PATCH v2 00/20] at: https://lore.kernel.org/all/[email protected]/
drivers/media/i2c/imx290.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/imx290.c +1 -1
@@ -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 __always_unused imx290_read_reg (struct imx290 *imx290,u16 addr,u8 *value) {unsigned int regval;int ret;
Signature · 1 line
2.33.1
PATCH v2 16/20 media: davinci: vpbe_osd: mark read reg function as __always_unused
In reply to Mauro Carvalho ChehabSuch function is currently unused, but could be needed in the future. So, keep it, marking it as __always_unused, in order to avoid a clang W=1 error.
---
See [PATCH v2 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(-)
drivers/media/platform/davinci/vpbe_osd.c +1 -1
@@ -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 __always_unused osd_read (struct osd_state *sd,u32 offset) {struct osd_state *osd = sd;
Signature · 1 line
2.33.1
PATCH v2 18/20 media: mtk-mdp: address a clang warning
In reply to Mauro Carvalho ChehabThe 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.
---
See [PATCH v2 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(-)
drivers/media/platform/mtk-mdp/mtk_mdp_core.c +1 -1
@@ -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 = (uintptr_t )of_id->data; comp =devm_kzalloc (dev,sizeof (*comp),GFP_KERNEL );if (!comp) {
Signature · 1 line
2.33.1
PATCH v2 20/20 media: mxl5005s: drop some dead code
In reply to Mauro Carvalho ChehabAs 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.
---
See [PATCH v2 00/20] at: https://lore.kernel.org/all/[email protected]/
drivers/media/tuners/mxl5005s.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/media/tuners/mxl5005s.c +1 -13
@@ -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 ; }
Signature · 1 line
2.33.1
PATCH v2 19/20 media: cobalt: drop an unused variable
In reply to Mauro Carvalho ChehabThe 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.
---
See [PATCH v2 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(-)
drivers/media/pci/cobalt/cobalt-cpld.c +1 -4
@@ -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 );
Signature · 1 line
2.33.1
PATCH v2 12/20 media: au0828-i2c: drop a duplicated function
In reply to Mauro Carvalho ChehabThis function is not used, so, just drop it.
---
See [PATCH v2 00/20] at: https://lore.kernel.org/all/[email protected]/
drivers/media/usb/au0828/au0828-i2c.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/media/usb/au0828/au0828-i2c.c +0 -7
@@ -23,13 +23,6 @@ MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time");#define I2C_WAIT_DELAY 25#define I2C_WAIT_RETRY 1000 -static inline int i2c_slave_did_write_ack (struct i2c_adapter *i2c_adap) -{ -struct au0828_dev *dev = i2c_adap->algo_data; -return au0828_read (dev,AU0828_I2C_STATUS_201 ) & -AU0828_I2C_STATUS_NO_WRITE_ACK ?0 :1 ; -} -static inline int i2c_slave_did_read_ack (struct i2c_adapter *i2c_adap) {struct au0828_dev *dev = i2c_adap->algo_data;
Signature · 1 line
2.33.1
PATCH v2 5/20 media: drxk: drop operation_mode from set_dvbt()
In reply to Mauro Carvalho ChehabThis var is set, but never used. So, drop it.
---
See [PATCH v2 00/20] at: https://lore.kernel.org/all/[email protected]/
drivers/media/dvb-frontends/drxk_hard.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)
drivers/media/dvb-frontends/drxk_hard.c +5 -18
@@ -3720,7 +3720,6 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz, {u16 cmd_result =0 ;u16 transmission_params =0 ; -u16 operation_mode =0 ;u32 iqm_rc_rate_ofs =0 ;u32 bandwidth =0 ;u16 param1;
@@ -3759,10 +3758,8 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz,/* mode */ switch (state->props.transmission_mode) {case TRANSMISSION_MODE_AUTO : -default : - operation_mode |=OFDM_SC_RA_RAM_OP_AUTO_MODE__M ; - fallthrough;/* try first guess DRX_FFTMODE_8K */ case TRANSMISSION_MODE_8K : +default : transmission_params |=OFDM_SC_RA_RAM_OP_PARAM_MODE_8K ;break ;case TRANSMISSION_MODE_2K :
@@ -3773,9 +3770,7 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz,/* guard */ switch (state->props.guard_interval) {default : -case GUARD_INTERVAL_AUTO : - operation_mode |=OFDM_SC_RA_RAM_OP_AUTO_GUARD__M ; - fallthrough;/* try first guess DRX_GUARD_1DIV4 */ +case GUARD_INTERVAL_AUTO :/* try first guess DRX_GUARD_1DIV4 */ case GUARD_INTERVAL_1_4 : transmission_params |=OFDM_SC_RA_RAM_OP_PARAM_GUARD_4 ;break ;
@@ -3794,11 +3789,7 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz,switch (state->props.hierarchy) {case HIERARCHY_AUTO :case HIERARCHY_NONE : -default : - operation_mode |=OFDM_SC_RA_RAM_OP_AUTO_HIER__M ; -/* try first guess SC_RA_RAM_OP_PARAM_HIER_NO */ -/* transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_HIER_NO; */ - fallthrough; +default :/* try first guess SC_RA_RAM_OP_PARAM_HIER_NO */ case HIERARCHY_1 : transmission_params |=OFDM_SC_RA_RAM_OP_PARAM_HIER_A1 ;break ;
@@ -3814,9 +3805,7 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz,/* modulation */ switch (state->props.modulation) {case QAM_AUTO : -default : - operation_mode |=OFDM_SC_RA_RAM_OP_AUTO_CONST__M ; - fallthrough;/* try first guess DRX_CONSTELLATION_QAM64 */ +default :/* try first guess DRX_CONSTELLATION_QAM64 */ case QAM_64 : transmission_params |=OFDM_SC_RA_RAM_OP_PARAM_CONST_QAM64 ;break ;
@@ -3857,9 +3846,7 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz,/* coderate */ switch (state->props.code_rate_HP) {case FEC_AUTO : -default : - operation_mode |=OFDM_SC_RA_RAM_OP_AUTO_RATE__M ; - fallthrough;/* try first guess DRX_CODERATE_2DIV3 */ +default :/* try first guess DRX_CODERATE_2DIV3 */ case FEC_2_3 : transmission_params |=OFDM_SC_RA_RAM_OP_PARAM_RATE_2_3 ;break ;
Signature · 1 line
2.33.1
PATCH v2 7/20 media: si21xx: report eventual errors at set_frontend
In reply to Mauro Carvalho ChehabIf an error occurs while setting the registers at set_frontend, it is silently ignored. Yet, the variable status is updated.
Change the logic to return an error if it fails to write values to the registers.
---
See [PATCH v2 00/20] at: https://lore.kernel.org/all/[email protected]/
drivers/media/dvb-frontends/si21xx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/media/dvb-frontends/si21xx.c +4 -3
@@ -711,7 +711,7 @@ static int si21xx_set_frontend(struct dvb_frontend *fe)int i;bool inband_interferer_div2[ALLOWABLE_FS_COUNT ];bool inband_interferer_div4[ALLOWABLE_FS_COUNT ]; -int status; +int status =0 ;/* allowable sample rates for ADC in MHz */ int afs[ALLOWABLE_FS_COUNT ] = {200 ,192 ,193 ,194 ,195 ,
@@ -747,8 +747,6 @@ static int si21xx_set_frontend(struct dvb_frontend *fe) rf_freq =10 * c->frequency ; data_rate = c->symbol_rate /100 ; - status =PASS ; - band_low = (rf_freq - lnb_lo) - ((lnb_uncertanity *200 ) + (data_rate *135 )) /200 ;
@@ -832,6 +830,9 @@ static int si21xx_set_frontend(struct dvb_frontend *fe) state->fs = sample_rate;/*ADC MHz*/ si21xx_setacquire (fe, c->symbol_rate, c->fec_inner); +if (status) +return -EREMOTEIO ; +return 0 ; }
Signature · 1 line
2.33.1
PATCH v2 17/20 media: camss: Remove unused static function
In reply to Mauro Carvalho ChehabFrom: Robert Foss <[email protected]>
vfe_reg_clr() is not used in camss-vfe-170.c, and can be removed.
---
See [PATCH v2 00/20] at: https://lore.kernel.org/all/[email protected]/
drivers/media/platform/qcom/camss/camss-vfe-170.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/media/platform/qcom/camss/camss-vfe-170.c +0 -7
@@ -191,13 +191,6 @@ 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) -{ -u32 bits =readl_relaxed (vfe->base + reg); - -writel_relaxed (bits & ~clr_bits, vfe->base + reg); -} -static inline void vfe_reg_set (struct vfe_device *vfe,u32 reg,u32 set_bits) {u32 bits =readl_relaxed (vfe->base + reg);
Signature · 1 line
2.33.1
PATCH v2 10/20 media: radio-si476x: drop a container_of() abstraction macro
In reply to Mauro Carvalho ChehabThis isn't used anywhere. So, drop it.
---
See [PATCH v2 00/20] at: https://lore.kernel.org/all/[email protected]/
drivers/media/radio/radio-si476x.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/media/radio/radio-si476x.c +0 -6
@@ -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) {
Signature · 1 line
2.33.1
PATCH v2 14/20 media: adv7511: drop unused functions
In reply to Mauro Carvalho ChehabThose are aliases for another function and not used at the current implementation. So, just drop it.
---
See [PATCH v2 00/20] at: https://lore.kernel.org/all/[email protected]/
drivers/media/i2c/adv7511-v4l2.c | 22 ---------------------- 1 file changed, 22 deletions(-)
drivers/media/i2c/adv7511-v4l2.c +0 -22
@@ -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 ;
Signature · 1 line
2.33.1
PATCH v2 3/20 media: davinci: get rid of an unused function
In reply to Mauro Carvalho Chehabvpif_get_default_field() seems to be some left-over from a past code that sets the field order.
---
See [PATCH v2 00/20] at: https://lore.kernel.org/all/[email protected]/
drivers/media/platform/davinci/vpif_capture.c | 11 ----------- 1 file changed, 11 deletions(-)
drivers/media/platform/davinci/vpif_capture.c +0 -11
@@ -618,17 +618,6 @@ static void vpif_calculate_offsets(struct channel_obj *ch) ch->vpifparams.video_params.stdid = vpifparams->std_info.stdid; } -/** -* vpif_get_default_field() - Get default field type based on interface -* @iface: ptr to vpif interface -*/ -static inline enum v4l2_field vpif_get_default_field ( -struct vpif_interface *iface) -{ -return (iface->if_type ==VPIF_IF_RAW_BAYER ) ?V4L2_FIELD_NONE : -V4L2_FIELD_INTERLACED ; -} -/** * vpif_config_addr() - function to configure buffer address in vpif * @ch: channel ptr
Signature · 1 line
2.33.1
Re: [PATCH v2 09/20] media: si470x: fix printk warnings with clang
In reply to Mauro Carvalho ChehabQuoted 9 lines · Mauro Carvalho Chehab
Clang doesn't like "%hu" on macros:
drivers/media/radio/si470x/radio-si470x-i2c.c:414:4: error: format specifies type 'unsigned short' but the argument has type 'int' [-Werror,-Wformat] drivers/media/radio/si470x/radio-si470x-i2c.c:417:4: error: format specifies type 'unsigned short' but the argument has type 'int' [-Werror,-Wformat]Besides that, changeset
cbacb5ab0aa0("docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi]") dropped recomendation of using %h.So, just replace them with "%u".
And perhaps change these to single dev_warn calls instead of multiple calls.
drivers/media/radio/si470x/radio-si470x-i2c.c
Quoted 1 line
drivers/media/radio/si470x/radio-si470x-i2c.c +0
-0
[]
drivers/media/radio/si470x/radio-si470x-i2c.c static int si470x_i2c_probe(struct i2c_client *client) · line 417
Quoted 11 lines
drivers/media/radio/si470x/radio-si470x-i2c.c +2
-2@@ -410,10 +410,10 @@ static int si470x_i2c_probe(struct i2c_client *client) radio->registers[DEVICEID], radio->registers[SI_CHIPID]);if ((radio->registers[SI_CHIPID ] &SI_CHIPID_FIRMWARE ) <RADIO_FW_VERSION ) {dev_warn (&client->dev, -"This driver is known to work with firmware version %hu,\n" , +"This driver is known to work with firmware version %u,\n" ,RADIO_FW_VERSION );dev_warn (&client->dev, -"but the device has firmware version %hu.\n" , +"but the device has firmware version %u.\n" , radio->registers[SI_CHIPID ] &SI_CHIPID_FIRMWARE );
dev_warn(&client->dev, "This driver is known to work with firmware version %u, but the device has firmware version %u\n", RADIO_FW_VERSION, radio->registers[SI_CHIPID] & SI_CHIPID_FIRMWARE);
etc...
Re: [PATCH v2 16/20] media: davinci: vpbe_osd: mark read reg function as __always_unused
In reply to Mauro Carvalho ChehabQuoted 5 lines · Mauro Carvalho Chehab
Such function is currently unused, but could be needed in the future. So, keep it, marking it as
__always_unused, in order to avoid a clang W=1 error.
Quoted 8 lines
Signed-off-by Mauro Carvalho Chehab <[email protected]>---
See [PATCH v2 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(-)
Cheers,
Prabhakar
Quoted 16 lines
drivers/media/platform/davinci/vpbe_osd.c +1
-2@@ -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 __always_unused osd_read (struct osd_state *sd,u32 offset) {struct osd_state *osd = sd; --2.33.1
Re: [PATCH v2 03/20] media: davinci: get rid of an unused function
In reply to Mauro Carvalho ChehabQuoted 4 lines · Mauro Carvalho Chehab
vpif_get_default_field()seems to be some left-over from a past code that sets the field order.
Quoted 9 lines
Reviewed-by Nathan Chancellor <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>---
See [PATCH v2 00/20] at: https://lore.kernel.org/all/[email protected]/
drivers/media/platform/davinci/vpif_capture.c | 11 ----------- 1 file changed, 11 deletions(-)
Cheers,
Prabhakar
Quoted 25 lines
drivers/media/platform/davinci/vpif_capture.c +0
-12@@ -618,17 +618,6 @@ static void vpif_calculate_offsets(struct channel_obj *ch) ch->vpifparams.video_params.stdid = vpifparams->std_info.stdid; } -/** -* vpif_get_default_field() - Get default field type based on interface -* @iface: ptr to vpif interface -*/ -static inline enum v4l2_field vpif_get_default_field ( -struct vpif_interface *iface) -{ -return (iface->if_type ==VPIF_IF_RAW_BAYER ) ?V4L2_FIELD_NONE : -V4L2_FIELD_INTERLACED ; -} -/** * vpif_config_addr() - function to configure buffer address in vpif * @ch: channel ptr -- 2.33.1
Re: [PATCH v2 09/20] media: si470x: fix printk warnings with clang
In reply to Joe PerchesEm Mon, 29 Nov 2021 02:10:14 -0800
Joe Perches <[email protected]> escreveu:
Quoted 31 lines · Mauro Carvalho Chehab
Quoted 9 lines
Clang doesn't like "%hu" on macros:
drivers/media/radio/si470x/radio-si470x-i2c.c:414:4: error: format specifies type 'unsigned short' but the argument has type 'int' [-Werror,-Wformat] drivers/media/radio/si470x/radio-si470x-i2c.c:417:4: error: format specifies type 'unsigned short' but the argument has type 'int' [-Werror,-Wformat]Besides that, changeset
cbacb5ab0aa0("docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi]") dropped recomendation of using %h.So, just replace them with "%u".
And perhaps change these to single
dev_warncalls instead of multiple calls.drivers/media/radio/si470x/radio-si470x-i2c.c
Quoted 1 line
drivers/media/radio/si470x/radio-si470x-i2c.c +0
-0[]
drivers/media/radio/si470x/radio-si470x-i2c.c static int si470x_i2c_probe(struct i2c_client *client) · line 417
Quoted 11 lines
drivers/media/radio/si470x/radio-si470x-i2c.c +2
-2@@ -410,10 +410,10 @@ static int si470x_i2c_probe(struct i2c_client *client) radio->registers[DEVICEID], radio->registers[SI_CHIPID]);if ((radio->registers[SI_CHIPID ] &SI_CHIPID_FIRMWARE ) <RADIO_FW_VERSION ) {dev_warn (&client->dev, -"This driver is known to work with firmware version %hu,\n" , +"This driver is known to work with firmware version %u,\n" ,RADIO_FW_VERSION );dev_warn (&client->dev, -"but the device has firmware version %hu.\n" , +"but the device has firmware version %u.\n" , radio->registers[SI_CHIPID ] &SI_CHIPID_FIRMWARE );dev_warn(&client->dev, "This driver is known to work with firmware version %u, but the device has firmware version %u\n", RADIO_FW_VERSION, radio->registers[SI_CHIPID] & SI_CHIPID_FIRMWARE);
Quoted 3 lines
etc...
Good idea. As this will touch on other things, I'll submit it on a separate patch.
Regards,
Mauro
Thanks,
Mauro
Manivannan Sadhasivam
maintainerRe: [PATCH v2 15/20] media: imx290: mark read reg function as __always_unused
In reply to Mauro Carvalho ChehabHi Mauro,
Quoted 17 lines · Mauro Carvalho Chehab
Such function is currently unused, but could be needed in the future. So, keep it, marking it as
__always_unused, in order to avoid a clang W=1 error.Signed-off-by Mauro Carvalho Chehab <[email protected]>---
See [PATCH v2 00/20] at: https://lore.kernel.org/all/[email protected]/
drivers/media/i2c/imx290.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/i2c/imx290.c +0
-0
drivers/media/i2c/imx290.c static inline struct imx290 *to_imx290(struct v4l2_subdev *_sd) · line 366
Quoted 5 lines
drivers/media/i2c/imx290.c +1
-1@@ -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 __always_unused imx290_read_reg (struct imx290 *imx290,u16 addr,u8 *value)
Can we drop this function instead?
Thanks,
Mani
Quoted 6 lines
drivers/media/i2c/imx290.c +0
-0{unsigned int regval;int ret;Signature · 1 line
2.33.1