Skip to contentSkip to conversation

staging: media: av7110: coding style fixes: too many tabs

PATCH Superseded Sudarshan Srinivasan 3 participants 3 messages Mar 18 – Mar 19

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: media: av7110: coding style fixes: too many tabs

This patch fixes below warning reported by checkpatch.pl
WARNING: Too many leading tabs - consider code refactoring

---
 drivers/staging/media/av7110/av7110.c | 32 ++++++++++++++++++---------
 1 file changed, 22 insertions(+), 10 deletions(-)
drivers/staging/media/av7110/av7110.c +22 -10
index 607992100baf..970343c4ec51 100644
@@ -932,6 +932,27 @@ static int dvb_feed_stop_pid(struct dvb_demux_feed *dvbdmxfeed)
 	return ret;
 }
 
+static int handle_ts_memory_fe(struct dvb_demux_feed *feed,
+			       struct dvb_demux *demux,
+			       struct av7110 *av7110)
+{
+		int ret = 0;
+
+		if (feed->pes_type >= 2)
+			return 0;
+
+		if ((demux->pids[0] & 0x8000) || (demux->pids[1] & 0x8000))
+			return 0;
+
+		dvb_ringbuffer_flush_spinlock_wakeup(&av7110->avout);
+		dvb_ringbuffer_flush_spinlock_wakeup(&av7110->aout);
+
+		ret = av7110_av_start_play(av7110, RP_AV);
+		demux->playing = (ret) ? true : false;
+
+		return ret;
+}
+
 static int av7110_start_feed(struct dvb_demux_feed *feed)
 {
 	struct dvb_demux *demux = feed->demux;
@@ -951,16 +972,7 @@ static int av7110_start_feed(struct dvb_demux_feed *feed)
 		    (feed->pes_type <= DMX_PES_PCR)) {
 			switch (demux->dmx.frontend->source) {
 			case DMX_MEMORY_FE:
-				if (feed->ts_type & TS_DECODER)
-					if (feed->pes_type < 2 &&
-					    !(demux->pids[0] & 0x8000) &&
-					    !(demux->pids[1] & 0x8000)) {
-						dvb_ringbuffer_flush_spinlock_wakeup(&av7110->avout);
-						dvb_ringbuffer_flush_spinlock_wakeup(&av7110->aout);
-						ret = av7110_av_start_play(av7110, RP_AV);
-						if (!ret)
-							demux->playing = 1;
-					}
+				ret = handle_ts_memory_fe(feed, demux, av7110);
 				break;
 			default:
 				ret = dvb_feed_start_pid(feed);
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 26 lines · Sudarshan Srinivasan

This patch fixes below warning reported by checkpatch.pl
WARNING: Too many leading tabs - consider code refactoring

---
 drivers/staging/media/av7110/av7110.c | 32 ++++++++++++++++++---------
 1 file changed, 22 insertions(+), 10 deletions(-)
drivers/staging/media/av7110/av7110.c +10 -0
index 607992100baf..970343c4ec51 100644
@@ -932,6 +932,27 @@ static int dvb_feed_stop_pid(struct dvb_demux_feed *dvbdmxfeed)
 	return ret;
 }
 
+static int handle_ts_memory_fe(struct dvb_demux_feed *feed,
+			       struct dvb_demux *demux,
+			       struct av7110 *av7110)
+{
+		int ret = 0;
+
+		if (feed->pes_type >= 2)
+			return 0;
+
+		if ((demux->pids[0] & 0x8000) || (demux->pids[1] & 0x8000))

drivers/staging/media/av7110/av7110.c static int dvb_feed_stop_pid(struct dvb_demux_feed *dvbdmxfeed) · line 954

Quoted 10 lines
drivers/staging/media/av7110/av7110.c +10 -0
+			return 0;
+
+		dvb_ringbuffer_flush_spinlock_wakeup(&av7110->avout);
+		dvb_ringbuffer_flush_spinlock_wakeup(&av7110->aout);
+
+		ret = av7110_av_start_play(av7110, RP_AV);
+		demux->playing = (ret) ? true : false;
+
+		return ret;
+}

I think you still have too many tabs here :(

#2 lore raw
In reply to Sudarshan Srinivasan
Quoted 23 lines · Sudarshan Srinivasan

This patch fixes below warning reported by checkpatch.pl
WARNING: Too many leading tabs - consider code refactoring

---
 drivers/staging/media/av7110/av7110.c | 32 ++++++++++++++++++---------
 1 file changed, 22 insertions(+), 10 deletions(-)
drivers/staging/media/av7110/av7110.c +7 -0
index 607992100baf..970343c4ec51 100644
@@ -932,6 +932,27 @@ static int dvb_feed_stop_pid(struct dvb_demux_feed *dvbdmxfeed)
 	return ret;
 }
 
+static int handle_ts_memory_fe(struct dvb_demux_feed *feed,
+			       struct dvb_demux *demux,
+			       struct av7110 *av7110)
+{
+		int ret = 0;
+
+		if (feed->pes_type >= 2)

drivers/staging/media/av7110/av7110.c static int dvb_feed_stop_pid(struct dvb_demux_feed *dvbdmxfeed) · line 951

Quoted 10 lines
drivers/staging/media/av7110/av7110.c +10 -0
+			return 0;
+
+		if ((demux->pids[0] & 0x8000) || (demux->pids[1] & 0x8000))
+			return 0;
+
+		dvb_ringbuffer_flush_spinlock_wakeup(&av7110->avout);
+		dvb_ringbuffer_flush_spinlock_wakeup(&av7110->aout);
+
+		ret = av7110_av_start_play(av7110, RP_AV);
+		demux->playing = (ret) ? true : false;

Keep this as:

	if (!ret)
		demux->playing = true;

1: It matches the original code. Don't make unnecessary style changes. 2: The original better style. The old code said, if there were no
errors set playing to true. The new code is ambiguous. You might think ret is a bool or something.
3: How do we know that the playing wasn't true at the start? This
could potentially introduce a behavior change. That wasn't mentioned in the commit message.

drivers/staging/media/av7110/av7110.c static int dvb_feed_stop_pid(struct dvb_demux_feed *dvbdmxfeed) · line 954

Quoted 3 lines
drivers/staging/media/av7110/av7110.c +3 -0
+
+		return ret;
+}

regards,
dan carpenter