Skip to contentSkip to conversation

staging: media: av7110: fix coding style

PATCH Superseded Chethan C 2 participants 2 messages Mar 23 – Mar 24

Subsystems (2)

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Chethan C

author
#0 lore raw

PATCH v5 1/1 staging: media: av7110: fix coding style

Fixed Indentation, Alignment issues reported by checkpatch.pl.

Rename enum av7110_rec_play_state, av7110_type_rec_play_format and av7110_encoder_command to follow the kernel naming style.

Rename wssData to wss_data to avoid CamelCase identifiers.

---
v5:
- Limit lines to 80 columns
- Add trailing commas to enums av7110_rec_play_state, av7110_type_rec_play_format, av7110_encoder_command
- Remove unnecessary cast

v4:
- fixed the coding style issue reported by checkpatch.pl

v3:
- fixed the coding style and alignment issues reported by checkpatch.pl
- Renamed av7110_pid_command,av7110_type_rec_play_format, av7110_encoder_command to follow kernel naming style
v2:
- fixed indentation issues reported by checkpatch.pl
- Rename av7110_rec_play_state to follow kernel naming style

---
 drivers/staging/media/av7110/av7110.c     | 27 ++++---
 drivers/staging/media/av7110/av7110.h     |  2 +-
 drivers/staging/media/av7110/av7110_av.c  | 91 +++++++++++++++--------
 drivers/staging/media/av7110/av7110_ca.c  |  2 +-
 drivers/staging/media/av7110/av7110_hw.h  | 71 +++++++++---------
 drivers/staging/media/av7110/av7110_ir.c  |  2 +-
 drivers/staging/media/av7110/av7110_v4l.c | 13 ++--
 7 files changed, 124 insertions(+), 84 deletions(-)
drivers/staging/media/av7110/av7110.c +16 -11
index 607992100baf..9a361227ca60 100644
@@ -121,19 +121,21 @@ static void init_av7110_av(struct av7110 *av7110)
 	if (ret < 0)
 		pr_err("cannot set internal volume to maximum:%d\n", ret);
 
-	ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetMonitorType,
-			    1, (u16)av7110->display_ar);
+	ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, AV7110_SET_MONITOR_TYPE,
+			    1, av7110->display_ar);
 	if (ret < 0)
 		pr_err("unable to set aspect ratio\n");
-	ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetPanScanType,
+	ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, AV7110_SET_PANSCAN_TYPE,
 			    1, av7110->display_panscan);
 	if (ret < 0)
 		pr_err("unable to set pan scan\n");
 
-	ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetWSSConfig, 2, 2, wss_cfg_4_3);
+	ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, AV7110_SET_WSS_CONFIG,
+			    2, 2, wss_cfg_4_3);
 	if (ret < 0)
 		pr_err("unable to configure 4:3 wss\n");
-	ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetWSSConfig, 2, 3, wss_cfg_16_9);
+	ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, AV7110_SET_WSS_CONFIG,
+			    2, 3, wss_cfg_16_9);
 	if (ret < 0)
 		pr_err("unable to configure 16:9 wss\n");
 
@@ -717,7 +719,7 @@ static inline int SetPIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid,
 	if (av7110->audiostate.bypass_mode)
 		aflags |= 0x8000;
 
-	return av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, MultiPID, 6,
+	return av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, AV7110_MULTI_PID, 6,
 			     pcrpid, vpid, apid, ttpid, subpid, aflags);
 }
 
@@ -785,7 +787,7 @@ static int StartHWFilter(struct dvb_demux_filter *dvbdmxfilter)
 		av7110_p2t_init(&av7110->p2t_filter[dvbdmxfilter->index], dvbdmxfeed);
 	}
 
-	buf[0] = (COMTYPE_PID_FILTER << 8) + AddPIDFilter;
+	buf[0] = (COMTYPE_PID_FILTER << 8) + AV7110_ADD_PID_FILTER;
 	buf[1] = 16;
 	buf[2] = dvbdmxfeed->pid;
 	buf[3] = mode;
@@ -828,7 +830,7 @@ static int StopHWFilter(struct dvb_demux_filter *dvbdmxfilter)
 
 	av7110->handle2filter[handle] = NULL;
 
-	buf[0] = (COMTYPE_PID_FILTER << 8) + DelPIDFilter;
+	buf[0] = (COMTYPE_PID_FILTER << 8) + AV7110_DEL_PID_FILTER;
 	buf[1] = 1;
 	buf[2] = handle;
 	ret = av7110_fw_request(av7110, buf, 3, answ, 2);
@@ -873,7 +875,8 @@ static int dvb_feed_start_pid(struct dvb_demux_feed *dvbdmxfeed)
 
 	if (dvbdmxfeed->pes_type < 2 && npids[0])
 		if (av7110->fe_synced) {
-			ret = av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, Scan, 0);
+			ret = av7110_fw_cmd(av7110, COMTYPE_PIDFILTER,
+					    AV7110_SCAN, 0);
 			if (ret)
 				return ret;
 		}
@@ -1911,11 +1914,13 @@ static int av7110_fe_lock_fix(struct av7110 *av7110, enum fe_status status)
 			av7110->pids[DMX_PES_TELETEXT], 0,
 			av7110->pids[DMX_PES_PCR]);
 		if (!ret)
-			ret = av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, Scan, 0);
+			ret = av7110_fw_cmd(av7110, COMTYPE_PIDFILTER,
+					    AV7110_SCAN, 0);
 	} else {
 		ret = SetPIDs(av7110, 0, 0, 0, 0, 0);
 		if (!ret) {
-			ret = av7110_fw_cmd(av7110, COMTYPE_PID_FILTER, FlushTSQueue, 0);
+			ret = av7110_fw_cmd(av7110, COMTYPE_PID_FILTER,
+					    AV7110_FLUSH_TS_QUEUE, 0);
 			if (!ret)
 				ret = av7110_wait_msgstate(av7110, GPMQBusy);
 		}
drivers/staging/media/av7110/av7110.h +1 -1
index b584754f4be0..20776809e2f3 100644
@@ -244,7 +244,7 @@ struct av7110 {
 	video_size_t		 video_size;
 
 	u16			wssMode;
-	u16			wssData;
+	u16			wss_data;
 
 	struct infrared		ir;
 
drivers/staging/media/av7110/av7110_av.c +62 -29

231 lines not on this page · raw message

drivers/staging/media/av7110/av7110_ca.c +1 -1
index 63d9c97a5190..9413a6a7f387 100644
@@ -307,7 +307,7 @@ static int dvb_ca_ioctl(struct file *file, unsigned int cmd, void *parg)
 			mutex_unlock(&av7110->ioctl_mutex);
 			return -EINVAL;
 		}
-		av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, SetDescr, 5,
+		av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, AV7110_SET_DESCR, 5,
 			      (descr->index << 8) | descr->parity,
 			      (descr->cw[0] << 8) | descr->cw[1],
 			      (descr->cw[2] << 8) | descr->cw[3],
drivers/staging/media/av7110/av7110_hw.h +36 -35

98 lines not on this page · raw message

drivers/staging/media/av7110/av7110_ir.c +1 -1
index 68b3979ba5f2..16b8ac5ab5a1 100644
@@ -71,7 +71,7 @@ int av7110_set_ir_config(struct av7110 *av7110)
 {
 	dprintk(4, "ir config = %08x\n", av7110->ir.ir_config);
 
-	return av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, SetIR, 1,
+	return av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, AV7110_SET_IR, 1,
 			     av7110->ir.ir_config);
 }
 
drivers/staging/media/av7110/av7110_v4l.c +7 -6
index 200a7a29ea31..b427716f48f4 100644
@@ -597,13 +597,13 @@ static int vidioc_s_fmt_sliced_vbi_out(struct file *file, void *fh,
 	if (f->fmt.sliced.service_set & V4L2_SLICED_WSS_625) {
 		/* WSS controlled by userspace */
 		av7110->wssMode = 1;
-		av7110->wssData = 0;
+		av7110->wss_data = 0;
 	} else {
 		/* WSS controlled by firmware */
 		av7110->wssMode = 0;
-		av7110->wssData = 0;
+		av7110->wss_data = 0;
 		return av7110_fw_cmd(av7110, COMTYPE_ENCODER,
-				     SetWSSConfig, 1, 0);
+				     AV7110_SET_WSS_CONFIG, 1, 0);
 	}
 	return 0;
 }
@@ -623,10 +623,11 @@ static ssize_t av7110_vbi_write(struct file *file, const char __user *data, size
 	if ((d.id != 0 && d.id != V4L2_SLICED_WSS_625) || d.field != 0 || d.line != 23)
 		return -EINVAL;
 	if (d.id)
-		av7110->wssData = ((d.data[1] << 8) & 0x3f00) | d.data[0];
+		av7110->wss_data = ((d.data[1] << 8) & 0x3f00) | d.data[0];
 	else
-		av7110->wssData = 0x8000;
-	rc = av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetWSSConfig, 2, 1, av7110->wssData);
+		av7110->wss_data = 0x8000;
+	rc = av7110_fw_cmd(av7110, COMTYPE_ENCODER, AV7110_SET_WSS_CONFIG, 2,
+			   1, av7110->wss_data);
 	return (rc < 0) ? rc : count;
 }
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 6 lines · Chethan C

Fixed Indentation, Alignment issues reported by checkpatch.pl.

Rename enum av7110_rec_play_state, av7110_type_rec_play_format and av7110_encoder_command to follow the kernel naming style.

Rename wssData to wss_data to avoid CamelCase identifiers.

...

drivers/staging/media/av7110/av7110.h struct av7110 { · line 247

Quoted 3 lines
drivers/staging/media/av7110/av7110.h +1 -1
 	u16			wssMode;
-	u16			wssData;
+	u16			wss_data;

Now these two are in inconsistent state.

...

drivers/staging/media/av7110/av7110_av.c int av7110_set_vidmode(struct av7110 *av7110, enum av7110_video_mode mode) · line 349

Quoted 3 lines
drivers/staging/media/av7110/av7110_av.c +2 -1
-	ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, LoadVidCode, 1, mode);
+	ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, AV7110_LOAD_VID_CODE,
+			    1, mode);

Also rethink about more logical split. As far as I can see this API does some variadic arguments processing while the first two are mandatory ones. With that taken into account I would do it as

	ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER,
			    AV7110_LOAD_VID_CODE, 1, mode);

Also check the entire patch for this kind of amendments.

...

drivers/staging/media/av7110/av7110_v4l.c static ssize_t av7110_vbi_write(struct file *file, const char __user *data, size · line 631

Quoted 5 lines
drivers/staging/media/av7110/av7110_v4l.c +2 -1
-	rc = av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetWSSConfig, 2, 1, av7110->wssData);
 
+	rc = av7110_fw_cmd(av7110, COMTYPE_ENCODER, AV7110_SET_WSS_CONFIG, 2,
+			   1, av7110->wss_data);
 	return (rc < 0) ? rc : count;

This can also be improved a bit as

	if (rc)
		return rc;

	return count;

but strictly speaking it's out of the scope of this patch.

Signature · 2 lines
With Best Regards,
Andy Shevchenko