Re: [PATCH 2/2] staging: media: av7110: refactor av7110_start_feed to reduce indentation

From: Dan Carpenter

Date: Sat Jun 20 2026 - 05:41:43 EST


On Fri, Jun 19, 2026 at 07:15:24PM -0300, André Moreira wrote:
> The av7110_start_feed function contains heavily nested if-statements,
> causing excessive indentation and violating code style guidelines.
> Refactor the logic inside the DMX_MEMORY_FE case by inverting the
> conditional check to break early, reducing the indentation level.
>
> Signed-off-by: André Moreira <andrem.33333@xxxxxxxxx>

Imagine I read this commit message

> ---
> drivers/staging/media/av7110/av7110.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/staging/media/av7110/av7110.c b/drivers/staging/media/av7110/av7110.c
> index e77be16f442c..2e32acf897ff 100644
> --- a/drivers/staging/media/av7110/av7110.c
> +++ b/drivers/staging/media/av7110/av7110.c
> @@ -942,16 +942,16 @@ 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)

And the first thing that I saw is that you removed this check. There
is no information in the email why this is okay. I have to look at
the code itself to see that.

The patch is fine, but I don't want to have to read the code to find my
answers. Re-write the commit message and resend.

regards,
dan carpenter

> - 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;
> - }
> + if (feed->pes_type >= 2 ||
> + (demux->pids[0] & 0x8000) ||
> + (demux->pids[1] & 0x8000))
> + break;
> +
> + 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;
> break;
> default:
> ret = dvb_feed_start_pid(feed);