Skip to contentSkip to conversation

staging: media: av7110: Fix various formatting and small code issues

PATCH In review Jonathan Bergh 4 participants 12 messages Oct 20, 2023 – Nov 22, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover staging: media: av7110: Fix various formatting and small code issues

These patches cover various formatting and small code issues. Formatting issues include missing newlines, whitespace and miscellaneous formatting issues. The series also fixes small code issues including using preferred integer types ('long' instead of 'long int') and ('unsigned int' instead of 'unsigned').

Jonathan Bergh (5):
staging: media: av7110: Fix missing newlines after declaration
warnings
staging: media: av7110: Fix various whitespace checkpatch errors
staging: media: av7110: Remove unnecessary whitespace before quoted
newlines
staging: media: av7110: Fix 'long int' and 'unsigned' variable
declarations
staging: media: av7110: Fix various formating issues

 drivers/staging/media/av7110/av7110_av.c | 114 +++++++++++++----------
 1 file changed, 64 insertions(+), 50 deletions(-)
Signature · 1 line
2.40.1
#1 lore raw

PATCH 1/5 staging: media: av7110: Fix missing newlines after declaration warnings

Fixed the following formatting problem:
* Missing newlines after declarations

---
 drivers/staging/media/av7110/av7110_av.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/staging/media/av7110/av7110_av.c +11 -0
index 00dd6a7fea64..af3845406626 100644
@@ -149,6 +149,7 @@ int av7110_av_start_record(struct av7110 *av7110, int av,
 int av7110_av_start_play(struct av7110 *av7110, int av)
 {
 	int ret = 0;
+
 	dprintk(2, "av7110:%p, \n", av7110);
 
 	if (av7110->rec_mode)
@@ -183,6 +184,7 @@ int av7110_av_start_play(struct av7110 *av7110, int av)
 int av7110_av_stop(struct av7110 *av7110, int av)
 {
 	int ret = 0;
+
 	dprintk(2, "av7110:%p, \n", av7110);
 
 	if (!(av7110->playing & av) && !(av7110->rec_mode & av))
@@ -320,6 +322,7 @@ int av7110_set_volume(struct av7110 *av7110, unsigned int volleft,
 int av7110_set_vidmode(struct av7110 *av7110, enum av7110_video_mode mode)
 {
 	int ret;
+
 	dprintk(2, "av7110:%p, \n", av7110);
 
 	ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, LoadVidCode, 1, mode);
@@ -408,6 +411,7 @@ static inline long aux_ring_buffer_write(struct dvb_ringbuffer *rbuf,
 static void play_video_cb(u8 *buf, int count, void *priv)
 {
 	struct av7110 *av7110 = (struct av7110 *) priv;
+
 	dprintk(2, "av7110:%p, \n", av7110);
 
 	if ((buf[3] & 0xe0) == 0xe0) {
@@ -420,6 +424,7 @@ static void play_video_cb(u8 *buf, int count, void *priv)
 static void play_audio_cb(u8 *buf, int count, void *priv)
 {
 	struct av7110 *av7110 = (struct av7110 *) priv;
+
 	dprintk(2, "av7110:%p, \n", av7110);
 
 	aux_ring_buffer_write(&av7110->aout, buf, count);
@@ -471,6 +476,7 @@ static ssize_t dvb_play(struct av7110 *av7110, const char __user *buf,
 			unsigned long count, int nonblock, int type)
 {
 	unsigned long todo = count, n;
+
 	dprintk(2, "av7110:%p, \n", av7110);
 
 	if (!av7110->kbuf[type])
@@ -504,6 +510,7 @@ static ssize_t dvb_play_kernel(struct av7110 *av7110, const u8 *buf,
 			unsigned long count, int nonblock, int type)
 {
 	unsigned long todo = count, n;
+
 	dprintk(2, "av7110:%p, \n", av7110);
 
 	if (!av7110->kbuf[type])
@@ -534,6 +541,7 @@ static ssize_t dvb_aplay(struct av7110 *av7110, const char __user *buf,
 			 unsigned long count, int nonblock, int type)
 {
 	unsigned long todo = count, n;
+
 	dprintk(2, "av7110:%p, \n", av7110);
 
 	if (!av7110->kbuf[type])
@@ -1039,6 +1047,7 @@ static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len
 	/* search in buf for instances of 00 00 01 b5 1? */
 	for (i = 0; i < len; i++) {
 		unsigned char c;
+
 		if (get_user(c, buf + i))
 			return -EFAULT;
 		if (match == 5) {
@@ -1223,6 +1232,7 @@ static int dvb_video_ioctl(struct file *file,
 	case VIDEO_SET_DISPLAY_FORMAT:
 	{
 		video_displayformat_t format = (video_displayformat_t) arg;
+
 		switch (format) {
 		case VIDEO_PAN_SCAN:
 			av7110->display_panscan = VID_PAN_SCAN_PREF;
@@ -1483,6 +1493,7 @@ static int dvb_audio_ioctl(struct file *file,
 	case AUDIO_SET_MIXER:
 	{
 		struct audio_mixer *amix = (struct audio_mixer *)parg;
+
 		ret = av7110_set_volume(av7110, amix->volume_left, amix->volume_right);
 		break;
 	}
Signature · 1 line
2.40.1
#2 lore raw

PATCH 2/5 staging: media: av7110: Fix various whitespace checkpatch errors

In reply to Jonathan Bergh

Fixed the following checkpatch errors relating to whitespaces:
* extra whitespace after '~' symbol
* remove whitespace before/after parentheses for switch statement and function parameters as well as after switch keyword
* ensure whitespace before '{' braces
* remove whitespace between function name and '(' parentheses
* ensure whitespace after ',' commas in parameter lists

---
 drivers/staging/media/av7110/av7110_av.c | 28 ++++++++++++------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/staging/media/av7110/av7110_av.c +14 -14
index af3845406626..482dfc548b16 100644
@@ -241,8 +241,8 @@ int av7110_pes_play(void *dest, struct dvb_ringbuffer *buf, int dlen)
 		sync |= DVB_RINGBUFFER_PEEK(buf, 2) << 8;
 		sync |= DVB_RINGBUFFER_PEEK(buf, 3);
 
-		if (((sync &~ 0x0f) == 0x000001e0) ||
-		    ((sync &~ 0x1f) == 0x000001c0) ||
+		if (((sync &~0x0f) == 0x000001e0) ||
+		    ((sync &~0x1f) == 0x000001c0) ||
 		    (sync == 0x000001bd))
 			break;
 		printk("resync\n");
@@ -599,7 +599,7 @@ static int find_pes_header(u8 const *buf, long int length, int *frags)
 	while (c < length - 3 && !found) {
 		if (buf[c] == 0x00 && buf[c + 1] == 0x00 &&
 		    buf[c + 2] == 0x01) {
-			switch ( buf[c + 3] ) {
+			switch (buf[c + 3]) {
 			case PROG_STREAM_MAP:
 			case PRIVATE_STREAM2:
 			case PROG_STREAM_DIR:
@@ -644,9 +644,9 @@ void av7110_p2t_write(u8 const *buf, long int length, u16 pid, struct av7110_p2t
 
 	c = 0;
 	c2 = 0;
-	if (p->frags){
+	if (p->frags) {
 		check = 0;
-		switch(p->frags) {
+		switch (p->frags) {
 		case 1:
 			if (buf[c] == 0x00 && buf[c + 1] == 0x01) {
 				check = 1;
@@ -712,7 +712,7 @@ void av7110_p2t_write(u8 const *buf, long int length, u16 pid, struct av7110_p2t
 		c2 = find_pes_header(buf + c + add, length - c - add, &p->frags);
 		if (c2 >= 0) {
 			c2 += c + add;
-			if (c2 > c){
+			if (c2 > c) {
 				p_to_t(buf + c, c2 - c, pid, &p->counter, p->feed);
 				c = c2;
 				clear_p2t(p);
@@ -798,7 +798,7 @@ static void p_to_t(u8 const *buf, long int length, u16 pid, u8 *counter,
 
 	while (c < length) {
 		memset(obuf, 0, TS_SIZE);
-		if (length - c >= (TS_SIZE - 4)){
+		if (length - c >= (TS_SIZE - 4)) {
 			l = write_ts_header2(pid, counter, pes_start,
 					     obuf, (TS_SIZE - 4));
 			memcpy(obuf + l, buf + c, TS_SIZE - l);
@@ -896,7 +896,7 @@ void dvb_video_add_event(struct av7110 *av7110, struct video_event *event)
 }
 
 
-static int dvb_video_get_event (struct av7110 *av7110, struct video_event *event, int flags)
+static int dvb_video_get_event(struct av7110 *av7110, struct video_event *event, int flags)
 {
 	struct dvb_video_events *events = &av7110->video_events;
 
@@ -1135,11 +1135,11 @@ static int dvb_video_ioctl(struct file *file,
 	unsigned long arg = (unsigned long) parg;
 	int ret = 0;
 
-	dprintk(1, "av7110:%p, cmd=%04x\n", av7110,cmd);
+	dprintk(1, "av7110:%p, cmd=%04x\n", av7110, cmd);
 
 	if ((file->f_flags & O_ACCMODE) == O_RDONLY) {
-		if ( cmd != VIDEO_GET_STATUS && cmd != VIDEO_GET_EVENT &&
-		     cmd != VIDEO_GET_SIZE ) {
+		if (cmd != VIDEO_GET_STATUS && cmd != VIDEO_GET_EVENT &&
+		     cmd != VIDEO_GET_SIZE) {
 			return -EPERM;
 		}
 	}
@@ -1367,7 +1367,7 @@ static int dvb_audio_ioctl(struct file *file,
 	unsigned long arg = (unsigned long) parg;
 	int ret = 0;
 
-	dprintk(1, "av7110:%p, cmd=%04x\n", av7110,cmd);
+	dprintk(1, "av7110:%p, cmd=%04x\n", av7110, cmd);
 
 	if (((file->f_flags & O_ACCMODE) == O_RDONLY) &&
 	    (cmd != AUDIO_GET_STATUS))
@@ -1433,7 +1433,7 @@ static int dvb_audio_ioctl(struct file *file,
 
 	case AUDIO_CHANNEL_SELECT:
 		av7110->audiostate.channel_select = (audio_channel_select_t) arg;
-		switch(av7110->audiostate.channel_select) {
+		switch (av7110->audiostate.channel_select) {
 		case AUDIO_STEREO:
 			ret = audcom(av7110, AUDIO_CMD_STEREO);
 			if (!ret) {
@@ -1642,7 +1642,7 @@ int av7110_av_register(struct av7110 *av7110)
 	spin_lock_init(&av7110->video_events.lock);
 	av7110->video_events.eventw = av7110->video_events.eventr = 0;
 	av7110->video_events.overflow = 0;
-	memset(&av7110->video_size, 0, sizeof (video_size_t));
+	memset(&av7110->video_size, 0, sizeof(video_size_t));
 
 	dvb_register_device(&av7110->dvb_adapter, &av7110->video_dev,
 			    &dvbdev_video, av7110, DVB_DEVICE_VIDEO, 0);
Signature · 1 line
2.40.1
#3 lore raw

Re: [PATCH 2/5] staging: media: av7110: Fix various whitespace checkpatch errors

Quoted 18 lines · Jonathan Bergh

Fixed the following checkpatch errors relating to whitespaces:
* extra whitespace after '~' symbol
* remove whitespace before/after parentheses for switch statement and function parameters as well as after switch keyword
* ensure whitespace before '{' braces
* remove whitespace between function name and '(' parentheses
* ensure whitespace after ',' commas in parameter lists

---
 drivers/staging/media/av7110/av7110_av.c | 28 ++++++++++++------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/staging/media/av7110/av7110_av.c +0 -0
index af3845406626..482dfc548b16 100644

drivers/staging/media/av7110/av7110_av.c int av7110_pes_play(void *dest, struct dvb_ringbuffer *buf, int dlen) · line 245

Quoted 7 lines
drivers/staging/media/av7110/av7110_av.c +2 -2
@@ -241,8 +241,8 @@ int av7110_pes_play(void *dest, struct dvb_ringbuffer *buf, int dlen)
 		sync |= DVB_RINGBUFFER_PEEK(buf, 2) << 8;
 		sync |= DVB_RINGBUFFER_PEEK(buf, 3);
 
-		if (((sync &~ 0x0f) == 0x000001e0) ||
-		    ((sync &~ 0x1f) == 0x000001c0) ||
+		if (((sync &~0x0f) == 0x000001e0) ||
+		    ((sync &~0x1f) == 0x000001c0) ||

These should be:

	if (((sync & ~0x0f) == 0x000001e0) ||
	    ((sync & ~0x1f) == 0x000001c0) ||

drivers/staging/media/av7110/av7110_av.c int av7110_pes_play(void *dest, struct dvb_ringbuffer *buf, int dlen) · line 248

Quoted 3 lines
drivers/staging/media/av7110/av7110_av.c +0 -0
 		    (sync == 0x000001bd))
 			break;
 		printk("resync\n");

regards,
dan carpenter

#4 lore raw

Re: [PATCH 2/5] staging: media: av7110: Fix various whitespace checkpatch errors

Quoted 1 line · Dan Carpenter

On Sat, Oct 21, 2023 at 01:23:29AM +0200, Jonathan Bergh wrote:

[]

Quoted 1 line

drivers/staging/media/av7110/av7110_av.c

Quoted 1 line
drivers/staging/media/av7110/av7110_av.c +0 -0

[]

Quoted 11 lines

drivers/staging/media/av7110/av7110_av.c int av7110_pes_play(void *dest, struct dvb_ringbuffer *buf, int dlen) · line 245

Quoted 8 lines
drivers/staging/media/av7110/av7110_av.c +2 -2
@@ -241,8 +241,8 @@ int av7110_pes_play(void *dest, struct dvb_ringbuffer *buf, int dlen)
 		sync |= DVB_RINGBUFFER_PEEK(buf, 2) << 8;
 		sync |= DVB_RINGBUFFER_PEEK(buf, 3);
 
-		if (((sync &~ 0x0f) == 0x000001e0) ||
-		    ((sync &~ 0x1f) == 0x000001c0) ||
+		if (((sync &~0x0f) == 0x000001e0) ||
+		    ((sync &~0x1f) == 0x000001c0) ||

These should be:

Quoted 2 lines
	if (((sync & ~0x0f) == 0x000001e0) ||
	    ((sync & ~0x1f) == 0x000001c0) ||

Generally, I believe it would be better to avoid '& ~constant' and use the positive form instead

	if ((sync & 0xfffffff0) == 0x000001e0) ||
	    (sync & 0xffffffe0) == 0x000001c0)
#5 lore raw

Re: [PATCH 2/5] staging: media: av7110: Fix various whitespace checkpatch errors

Quoted 16 lines · Joe Perches
Quoted 1 line · Dan Carpenter

On Sat, Oct 21, 2023 at 01:23:29AM +0200, Jonathan Bergh wrote:

[]

Quoted 1 line

drivers/staging/media/av7110/av7110_av.c

Quoted 1 line
drivers/staging/media/av7110/av7110_av.c +0 -0

[]

Quoted 11 lines

drivers/staging/media/av7110/av7110_av.c int av7110_pes_play(void *dest, struct dvb_ringbuffer *buf, int dlen) · line 245

Quoted 8 lines
drivers/staging/media/av7110/av7110_av.c +2 -2
@@ -241,8 +241,8 @@ int av7110_pes_play(void *dest, struct dvb_ringbuffer *buf, int dlen)
 		sync |= DVB_RINGBUFFER_PEEK(buf, 2) << 8;
 		sync |= DVB_RINGBUFFER_PEEK(buf, 3);
 
-		if (((sync &~ 0x0f) == 0x000001e0) ||
-		    ((sync &~ 0x1f) == 0x000001c0) ||
+		if (((sync &~0x0f) == 0x000001e0) ||
+		    ((sync &~0x1f) == 0x000001c0) ||

These should be:

Quoted 9 lines
Quoted 2 lines
	if (((sync & ~0x0f) == 0x000001e0) ||
	    ((sync & ~0x1f) == 0x000001c0) ||

Generally, I believe it would be better to avoid '& ~constant' and use the positive form instead

	if ((sync & 0xfffffff0) == 0x000001e0) ||
	    (sync & 0xffffffe0) == 0x000001c0)

To me it depends on if the 0x0f means something. It would be better as a define instead of a magic number.

regards,
dan carpenter

#6 lore raw

PATCH 3/5 staging: media: av7110: Remove unnecessary whitespace before quoted newlines

In reply to Jonathan Bergh

Fixed multiple instances where whitespaces were placed before quoted newlines

---
 drivers/staging/media/av7110/av7110_av.c | 40 ++++++++++++------------
 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/staging/media/av7110/av7110_av.c +20 -20
index 482dfc548b16..880fa8a314ba 100644
@@ -150,7 +150,7 @@ int av7110_av_start_play(struct av7110 *av7110, int av)
 {
 	int ret = 0;
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);
 
 	if (av7110->rec_mode)
 		return -EBUSY;
@@ -185,7 +185,7 @@ int av7110_av_stop(struct av7110 *av7110, int av)
 {
 	int ret = 0;
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);
 
 	if (!(av7110->playing & av) && !(av7110->rec_mode & av))
 		return 0;
@@ -272,7 +272,7 @@ int av7110_set_volume(struct av7110 *av7110, unsigned int volleft,
 	unsigned int vol, val, balance = 0;
 	int err;
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);
 
 	av7110->mixer.volume_left = volleft;
 	av7110->mixer.volume_right = volright;
@@ -323,7 +323,7 @@ int av7110_set_vidmode(struct av7110 *av7110, enum av7110_video_mode mode)
 {
 	int ret;
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);
 
 	ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, LoadVidCode, 1, mode);
 
@@ -358,7 +358,7 @@ static int get_video_format(struct av7110 *av7110, u8 *buf, int count)
 	u8 *p;
 	int ret = 0;
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);
 
 	if (av7110->sinfo)
 		return 0;
@@ -412,7 +412,7 @@ static void play_video_cb(u8 *buf, int count, void *priv)
 {
 	struct av7110 *av7110 = (struct av7110 *) priv;
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);
 
 	if ((buf[3] & 0xe0) == 0xe0) {
 		get_video_format(av7110, buf, count);
@@ -425,7 +425,7 @@ static void play_audio_cb(u8 *buf, int count, void *priv)
 {
 	struct av7110 *av7110 = (struct av7110 *) priv;
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);
 
 	aux_ring_buffer_write(&av7110->aout, buf, count);
 }
@@ -477,7 +477,7 @@ static ssize_t dvb_play(struct av7110 *av7110, const char __user *buf,
 {
 	unsigned long todo = count, n;
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);
 
 	if (!av7110->kbuf[type])
 		return -ENOBUFS;
@@ -511,7 +511,7 @@ static ssize_t dvb_play_kernel(struct av7110 *av7110, const u8 *buf,
 {
 	unsigned long todo = count, n;
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);
 
 	if (!av7110->kbuf[type])
 		return -ENOBUFS;
@@ -542,7 +542,7 @@ static ssize_t dvb_aplay(struct av7110 *av7110, const char __user *buf,
 {
 	unsigned long todo = count, n;
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);
 
 	if (!av7110->kbuf[type])
 		return -ENOBUFS;
@@ -847,7 +847,7 @@ int av7110_write_to_decoder(struct dvb_demux_feed *feed, const u8 *buf, size_t l
 	struct dvb_demux *demux = feed->demux;
 	struct av7110 *av7110 = demux->priv;
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);
 
 	if (av7110->full_ts && demux->dmx.frontend->source != DMX_MEMORY_FE)
 		return 0;
@@ -937,7 +937,7 @@ static __poll_t dvb_video_poll(struct file *file, poll_table *wait)
 	struct av7110 *av7110 = dvbdev->priv;
 	__poll_t mask = 0;
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);
 
 	if ((file->f_flags & O_ACCMODE) != O_RDONLY)
 		poll_wait(file, &av7110->avout.queue, wait);
@@ -967,7 +967,7 @@ static ssize_t dvb_video_write(struct file *file, const char __user *buf,
 	struct av7110 *av7110 = dvbdev->priv;
 	unsigned char c;
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);
 
 	if ((file->f_flags & O_ACCMODE) == O_RDONLY)
 		return -EPERM;
@@ -989,7 +989,7 @@ static __poll_t dvb_audio_poll(struct file *file, poll_table *wait)
 	struct av7110 *av7110 = dvbdev->priv;
 	__poll_t mask = 0;
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);
 
 	poll_wait(file, &av7110->aout.queue, wait);
 
@@ -1009,7 +1009,7 @@ static ssize_t dvb_audio_write(struct file *file, const char __user *buf,
 	struct av7110 *av7110 = dvbdev->priv;
 	unsigned char c;
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);
 
 	if (av7110->audiostate.stream_source != AUDIO_SOURCE_MEMORY) {
 		printk(KERN_ERR "not audio source memory\n");
@@ -1034,7 +1034,7 @@ static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len
 	int progressive = 0;
 	int match = 0;
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);
 
 	if (len == 0)
 		return 0;
@@ -1516,7 +1516,7 @@ static int dvb_video_open(struct inode *inode, struct file *file)
 	struct av7110 *av7110 = dvbdev->priv;
 	int err;
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);
 
 	if ((err = dvb_generic_open(inode, file)) < 0)
 		return err;
@@ -1540,7 +1540,7 @@ static int dvb_video_release(struct inode *inode, struct file *file)
 	struct dvb_device *dvbdev = file->private_data;
 	struct av7110 *av7110 = dvbdev->priv;
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);
 
 	if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
 		av7110_av_stop(av7110, RP_VIDEO);
@@ -1555,7 +1555,7 @@ static int dvb_audio_open(struct inode *inode, struct file *file)
 	struct av7110 *av7110 = dvbdev->priv;
 	int err = dvb_generic_open(inode, file);
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);
 
 	if (err < 0)
 		return err;
@@ -1569,7 +1569,7 @@ static int dvb_audio_release(struct inode *inode, struct file *file)
 	struct dvb_device *dvbdev = file->private_data;
 	struct av7110 *av7110 = dvbdev->priv;
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);
 
 	av7110_av_stop(av7110, RP_AUDIO);
 	return dvb_generic_release(inode, file);
Signature · 1 line
2.40.1
#7 lore raw

Re: [PATCH 3/5] staging: media: av7110: Remove unnecessary whitespace before quoted newlines

Quoted 13 lines · Jonathan Bergh

Fixed multiple instances where whitespaces were placed before quoted newlines

---
 drivers/staging/media/av7110/av7110_av.c | 40 ++++++++++++------------
 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/staging/media/av7110/av7110_av.c +0 -0
index 482dfc548b16..880fa8a314ba 100644

drivers/staging/media/av7110/av7110_av.c int av7110_av_start_play(struct av7110 *av7110, int av) · line 153

Quoted 5 lines
drivers/staging/media/av7110/av7110_av.c +1 -1
@@ -150,7 +150,7 @@ int av7110_av_start_play(struct av7110 *av7110, int av)
 {
 	int ret = 0;
 
-	dprintk(2, "av7110:%p, \n", av7110);
+	dprintk(2, "av7110:%p,\n", av7110);

Just delete all these printks. They are useless.

regards,
dan carpenter

#8 lore raw

PATCH 4/5 staging: media: av7110: Fix 'long int' and 'unsigned' variable declarations

In reply to Jonathan Bergh

Fixed the following warnings flagged by checkpatch:
* Replaced 'long int' with 'long'
* Replaced 'unsigned' with 'unsigned int'

---
 drivers/staging/media/av7110/av7110_av.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/media/av7110/av7110_av.c +5 -5
index 880fa8a314ba..82d4c02ae3ef 100644
@@ -71,7 +71,7 @@
 #define SEAM_SPLICE	 0x20
 
 
-static void p_to_t(u8 const *buf, long int length, u16 pid,
+static void p_to_t(u8 const *buf, long length, u16 pid,
 		   u8 *counter, struct dvb_demux_feed *feed);
 static int write_ts_to_decoder(struct av7110 *av7110, int type, const u8 *buf, size_t len);
 
@@ -589,7 +589,7 @@ static void clear_p2t(struct av7110_p2t *p)
 }
 
 
-static int find_pes_header(u8 const *buf, long int length, int *frags)
+static int find_pes_header(u8 const *buf, long length, int *frags)
 {
 	int c = 0;
 	int found = 0;
@@ -637,7 +637,7 @@ static int find_pes_header(u8 const *buf, long int length, int *frags)
 	return c;
 }
 
-void av7110_p2t_write(u8 const *buf, long int length, u16 pid, struct av7110_p2t *p)
+void av7110_p2t_write(u8 const *buf, long length, u16 pid, struct av7110_p2t *p)
 {
 	int c, c2, l, add;
 	int check, rest;
@@ -767,7 +767,7 @@ static int write_ts_header2(u16 pid, u8 *counter, int pes_start, u8 *buf, u8 len
 }
 
 
-static void p_to_t(u8 const *buf, long int length, u16 pid, u8 *counter,
+static void p_to_t(u8 const *buf, long length, u16 pid, u8 *counter,
 		   struct dvb_demux_feed *feed)
 {
 	int l, pes_start;
@@ -1030,7 +1030,7 @@ static u8 iframe_header[] = { 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x80, 0x00, 0x
 
 static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len, int nonblock)
 {
-	unsigned i, n;
+	unsigned int i, n;
 	int progressive = 0;
 	int match = 0;
 
Signature · 1 line
2.40.1
#9 lore raw

PATCH 5/5 staging: media: av7110: Fix various formating issues

In reply to Jonathan Bergh

Fixed the following remaining formatting issues:
* ensure balanced whitespaces around '&' symbol
* fix irregular whitespacings in variable assignment statement
* fix suspect identation after if statement
* fix instances were trailing statements after case statements were not on a newline
* fixed a block comment to use '*' on succesive lines
* Remove unneeded braces {} for single line conditional statement

---
 drivers/staging/media/av7110/av7110_av.c | 29 +++++++++++++-----------
 1 file changed, 16 insertions(+), 13 deletions(-)
drivers/staging/media/av7110/av7110_av.c +16 -13
index 82d4c02ae3ef..bdef95244121 100644
@@ -241,8 +241,8 @@ int av7110_pes_play(void *dest, struct dvb_ringbuffer *buf, int dlen)
 		sync |= DVB_RINGBUFFER_PEEK(buf, 2) << 8;
 		sync |= DVB_RINGBUFFER_PEEK(buf, 3);
 
-		if (((sync &~0x0f) == 0x000001e0) ||
-		    ((sync &~0x1f) == 0x000001c0) ||
+		if (((sync & ~0x0f) == 0x000001e0) ||
+		    ((sync & ~0x1f) == 0x000001c0) ||
 		    (sync == 0x000001bd))
 			break;
 		printk("resync\n");
@@ -297,10 +297,10 @@ int av7110_set_volume(struct av7110 *av7110, unsigned int volleft,
 		return 0;
 
 	case DVB_ADAC_MSP34x0:
-		vol  = (volleft > volright) ? volleft : volright;
-		val	= (vol * 0x73 / 255) << 8;
+		vol = (volleft > volright) ? volleft : volright;
+		val = (vol * 0x73 / 255) << 8;
 		if (vol > 0)
-		       balance = ((volright - volleft) * 127) / vol;
+			balance = ((volright - volleft) * 127) / vol;
 		msp_writereg(av7110, MSP_WR_DSP, 0x0001, balance << 8);
 		msp_writereg(av7110, MSP_WR_DSP, 0x0000, val); /* loudspeaker */
 		msp_writereg(av7110, MSP_WR_DSP, 0x0006, val); /* headphonesr */
@@ -367,8 +367,8 @@ static int get_video_format(struct av7110 *av7110, u8 *buf, int count)
 		if (p[0] || p[1] || p[2] != 0x01 || p[3] != 0xb3)
 			continue;
 		p += 4;
-		hsize = ((p[1] &0xF0) >> 4) | (p[0] << 4);
-		vsize = ((p[1] &0x0F) << 8) | (p[2]);
+		hsize = ((p[1] & 0xF0) >> 4) | (p[0] << 4);
+		vsize = ((p[1] & 0x0F) << 8) | (p[2]);
 		sw = (p[3] & 0x0F);
 		ret = av7110_set_vidmode(av7110, sw2mode[sw]);
 		if (!ret) {
@@ -1059,13 +1059,16 @@ static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len
 			continue;
 		}
 		switch (match++) {
-		case 2: if (c == 0x01)
+		case 2:
+			if (c == 0x01)
 				continue;
 			break;
-		case 3: if (c == 0xb5)
+		case 3:
+			if (c == 0xb5)
 				continue;
 			break;
-		case 4: if ((c & 0xf0) == 0x10)
+		case 4:
+			if ((c & 0xf0) == 0x10)
 				continue;
 			break;
 		}
@@ -1073,7 +1076,8 @@ static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len
 	}
 
 	/* setting n always > 1, fixes problems when playing stillframes
-	   consisting of I- and P-Frames */
+	 * consisting of I- and P-Frames
+	 */
 	n = MIN_IFRAME / len + 1;
 
 	/* FIXME: nonblock? */
@@ -1542,9 +1546,8 @@ static int dvb_video_release(struct inode *inode, struct file *file)
 
 	dprintk(2, "av7110:%p,\n", av7110);
 
-	if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
+	if ((file->f_flags & O_ACCMODE) != O_RDONLY)
 		av7110_av_stop(av7110, RP_VIDEO);
-	}
 
 	return dvb_generic_release(inode, file);
 }
Signature · 1 line
2.40.1
#10 lore raw

Re: [PATCH 5/5] staging: media: av7110: Fix various formating issues

Quoted 8 lines · Jonathan Bergh
 drivers/staging/media/av7110/av7110_av.c | 29 +++++++++++++-----------
 1 file changed, 16 insertions(+), 13 deletions(-)
drivers/staging/media/av7110/av7110_av.c +0 -0
index 82d4c02ae3ef..bdef95244121 100644

drivers/staging/media/av7110/av7110_av.c int av7110_pes_play(void *dest, struct dvb_ringbuffer *buf, int dlen) · line 245

Quoted 7 lines
drivers/staging/media/av7110/av7110_av.c +2 -2
@@ -241,8 +241,8 @@ int av7110_pes_play(void *dest, struct dvb_ringbuffer *buf, int dlen)
 		sync |= DVB_RINGBUFFER_PEEK(buf, 2) << 8;
 		sync |= DVB_RINGBUFFER_PEEK(buf, 3);
 
-		if (((sync &~0x0f) == 0x000001e0) ||
-		    ((sync &~0x1f) == 0x000001c0) ||
+		if (((sync & ~0x0f) == 0x000001e0) ||
+		    ((sync & ~0x1f) == 0x000001c0) ||

You introduced this yourself earlier. Which is good. But better to not create the issue in the first place.

regards,
dan carpenter

#11 lore raw
In reply to Jonathan Bergh

Hi Jonathan,

Quoted 16 lines · Jonathan Bergh

These patches cover various formatting and small code issues. Formatting issues include missing newlines, whitespace and miscellaneous formatting issues. The series also fixes small code issues including using preferred integer types ('long' instead of 'long int') and ('unsigned int' instead of 'unsigned').

Jonathan Bergh (5):
staging: media: av7110: Fix missing newlines after declaration
warnings
staging: media: av7110: Fix various whitespace checkpatch errors
staging: media: av7110: Remove unnecessary whitespace before quoted
newlines
staging: media: av7110: Fix 'long int' and 'unsigned' variable
declarations
staging: media: av7110: Fix various formating issues

Quoted 3 lines
 drivers/staging/media/av7110/av7110_av.c | 114 +++++++++++++----------
 1 file changed, 64 insertions(+), 50 deletions(-)

For future reference: when looking at staging drivers always check the TODO file. In this case see drivers/staging/media/av7110/TODO:

- This driver is too old and relies on a different API. Drop it from Kernel on a couple of versions.
- Cleanup patches for the drivers here won't be accepted.

So I'll just drop these cleanup patches.

Regards,

Hans