* [PATCH 1/2] staging: media: av7110: replace msleep with usleep_range
@ 2026-06-19 22:15 André Moreira
2026-06-19 22:15 ` [PATCH 2/2] staging: media: av7110: refactor av7110_start_feed to reduce indentation André Moreira
2026-06-20 9:40 ` [PATCH 1/2] staging: media: av7110: replace msleep with usleep_range Dan Carpenter
0 siblings, 2 replies; 4+ messages in thread
From: André Moreira @ 2026-06-19 22:15 UTC (permalink / raw)
To: mchehab, gregkh
Cc: linux-media, linux-staging, linux-kernel, André Moreira
The msleep() function is not precise for short delays under 20ms.
Replace it with usleep_range() to provide more accurate timing
and avoid unnecessary scheduler overhead.
Signed-off-by: André Moreira <andrem.33333@gmail.com>
---
drivers/staging/media/av7110/av7110.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/media/av7110/av7110.c b/drivers/staging/media/av7110/av7110.c
index 862aee993889..e77be16f442c 100644
--- a/drivers/staging/media/av7110/av7110.c
+++ b/drivers/staging/media/av7110/av7110.c
@@ -1818,7 +1818,7 @@ static int nexusca_stv0297_tuner_set_params(struct dvb_frontend *fe)
if (i2c_transfer(&av7110->i2c_adap, &readmsg, 1) == 1)
if (data[0] & 0x40)
break;
- msleep(10);
+ usleep_range(10000, 11000);
}
return 0;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] staging: media: av7110: refactor av7110_start_feed to reduce indentation
2026-06-19 22:15 [PATCH 1/2] staging: media: av7110: replace msleep with usleep_range André Moreira
@ 2026-06-19 22:15 ` André Moreira
2026-06-20 8:42 ` Dan Carpenter
2026-06-20 9:40 ` [PATCH 1/2] staging: media: av7110: replace msleep with usleep_range Dan Carpenter
1 sibling, 1 reply; 4+ messages in thread
From: André Moreira @ 2026-06-19 22:15 UTC (permalink / raw)
To: mchehab, gregkh
Cc: linux-media, linux-staging, linux-kernel, André Moreira
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@gmail.com>
---
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)
- 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);
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] staging: media: av7110: refactor av7110_start_feed to reduce indentation
2026-06-19 22:15 ` [PATCH 2/2] staging: media: av7110: refactor av7110_start_feed to reduce indentation André Moreira
@ 2026-06-20 8:42 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2026-06-20 8:42 UTC (permalink / raw)
To: André Moreira
Cc: mchehab, gregkh, linux-media, linux-staging, linux-kernel
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@gmail.com>
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);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] staging: media: av7110: replace msleep with usleep_range
2026-06-19 22:15 [PATCH 1/2] staging: media: av7110: replace msleep with usleep_range André Moreira
2026-06-19 22:15 ` [PATCH 2/2] staging: media: av7110: refactor av7110_start_feed to reduce indentation André Moreira
@ 2026-06-20 9:40 ` Dan Carpenter
1 sibling, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2026-06-20 9:40 UTC (permalink / raw)
To: André Moreira
Cc: mchehab, gregkh, linux-media, linux-staging, linux-kernel
On Fri, Jun 19, 2026 at 07:15:23PM -0300, André Moreira wrote:
> The msleep() function is not precise for short delays under 20ms.
> Replace it with usleep_range() to provide more accurate timing
> and avoid unnecessary scheduler overhead.
>
> Signed-off-by: André Moreira <andrem.33333@gmail.com>
> ---
We don't accept this kind of patch without testing. But also this
is not the current way to do it. Do a search for "usleep_range staging"
on lore.kernel.org to find the current way.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-06-20 9:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-19 22:15 [PATCH 1/2] staging: media: av7110: replace msleep with usleep_range André Moreira
2026-06-19 22:15 ` [PATCH 2/2] staging: media: av7110: refactor av7110_start_feed to reduce indentation André Moreira
2026-06-20 8:42 ` Dan Carpenter
2026-06-20 9:40 ` [PATCH 1/2] staging: media: av7110: replace msleep with usleep_range Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox