From: Hans Verkuil <hverkuil+cisco@kernel.org>
To: "André Moreira" <andrem.33333@gmail.com>,
mchehab@kernel.org, gregkh@linuxfoundation.org
Cc: linux-media@vger.kernel.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: av7110: refactor deeply nested PTS loops
Date: Wed, 15 Jul 2026 10:14:05 +0200 [thread overview]
Message-ID: <4a9b9842-8d51-4ddc-9b24-b69440091345@kernel.org> (raw)
In-Reply-To: <20260620054654.122464-1-andrem.33333@gmail.com>
On 20/06/2026 07:46, André Moreira wrote:
> Extract the deeply nested loops handling PTS flags in the MPEG-1
> block into a separate helper function `av7110_ipack_m1_pts()`.
>
> This fixes a checkpatch warning regarding too many leading tabs and
> improves code readability without changing the underlying parser logic.
>
> Signed-off-by: André Moreira <andrem.33333@gmail.com>
> ---
> drivers/staging/media/av7110/av7110_ipack.c | 35 +++++++++++----------
> 1 file changed, 18 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/staging/media/av7110/av7110_ipack.c b/drivers/staging/media/av7110/av7110_ipack.c
> index 4be6e225f08e8..a3e69a737e97d 100644
> --- a/drivers/staging/media/av7110/av7110_ipack.c
> +++ b/drivers/staging/media/av7110/av7110_ipack.c
> @@ -136,6 +136,22 @@ static void write_ipack(struct ipack *p, const u8 *data, int count)
> }
> }
>
> +static int av7110_ipack_m1_pts(struct ipack *p, const u8 *buf,
> + int c, int count, int max_which)
> +{
> + while (c < count && p->which < max_which) {
> + if (p->which < 7)
> + p->pts[p->which - 2] = buf[c];
> +
> + write_ipack(p, buf + c, 1);
> + c++;
> + p->found++;
> + p->which++;
> + p->hlength++;
> + }
> + return c;
> +}
> +
> int av7110_ipack_instant_repack(const u8 *buf, int count, struct ipack *p)
> {
> int l;
> @@ -335,26 +351,11 @@ int av7110_ipack_instant_repack(const u8 *buf, int count, struct ipack *p)
> return count;
> if (p->which > 2) {
> if ((p->flag2 & PTS_DTS_FLAGS) == PTS_ONLY) {
> - while (c < count && p->which < 7) {
> - p->pts[p->which - 2] = buf[c];
> - write_ipack(p, buf + c, 1);
> - c++;
> - p->found++;
> - p->which++;
> - p->hlength++;
> - }
> + c = av7110_ipack_m1_pts(p, buf, c, count, 7);
> if (c == count)
> return count;
> } else if ((p->flag2 & PTS_DTS_FLAGS) == PTS_DTS) {
> - while (c < count && p->which < 12) {
> - if (p->which < 7)
> - p->pts[p->which - 2] = buf[c];
> - write_ipack(p, buf + c, 1);
> - c++;
> - p->found++;
> - p->which++;
> - p->hlength++;
> - }
> + c = av7110_ipack_m1_pts(p, buf, c, count, 12);
> if (c == count)
> return count;
> }
Hmm, I think I'll just keep the code as-is. Creating a separate function for this makes
the repack function actually harder to understand.
Regards,
Hans
prev parent reply other threads:[~2026-07-15 8:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-20 5:46 André Moreira
2026-07-15 8:14 ` Hans Verkuil [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4a9b9842-8d51-4ddc-9b24-b69440091345@kernel.org \
--to=hverkuil+cisco@kernel.org \
--cc=andrem.33333@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox