From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hverkuil@xs4all.nl>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-renesas-soc@vger.kernel.org,
Biju Das <biju.das.jz@bp.renesas.com>,
Fabrizio Castro <fabrizio.castro.jz@renesas.com>,
Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [PATCH] media: renesas: rzg2l-cru: Simplify FIFO empty check
Date: Mon, 28 Apr 2025 14:25:16 +0300 [thread overview]
Message-ID: <20250428112516.GG3371@pendragon.ideasonboard.com> (raw)
In-Reply-To: <CA+V-a8taFdmCgiUAwmDG93OA+P9UH-FEw3PeMFW4sLQ2KPnEPQ@mail.gmail.com>
On Mon, Apr 28, 2025 at 12:17:54PM +0100, Lad, Prabhakar wrote:
> On Mon, Apr 28, 2025 at 10:59 AM Laurent Pinchart wrote:
> > On Mon, Apr 28, 2025 at 10:52:08AM +0100, Prabhakar wrote:
> > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > >
> > > Simplify the `rzg2l_fifo_empty()` helper by removing the redundant
> > > comparison in the return path. Now the function explicitly returns `true`
> > > if the FIFO write and read pointers match, and `false` otherwise, improving
> > > readability without changing behavior.
> > >
> > > Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> > > Closes: https://lore.kernel.org/all/aAtQThCibZCROETx@stanley.mountain/
> > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > ---
> > > drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> > > index 067c6af14e95..97faefcd6019 100644
> > > --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> > > +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> > > @@ -348,7 +348,7 @@ bool rzg2l_fifo_empty(struct rzg2l_cru_dev *cru)
> > > if (amnfifopntr_w == amnfifopntr_r_y)
> > > return true;
> > >
> > > - return amnfifopntr_w == amnfifopntr_r_y;
> > > + return false;
> >
> > So the function always returned true. This seems to be a bug fix, please
> > add a Fixes: tag. The commit message should also make it clear that
> > you're fixing an issue, not just simplifying the code.
>
> No, the function returned true only if the pointers matched;
> otherwise, amnfifopntr_w == amnfifopntr_r_y would return false. I was
> simply removing the repetitive pointer check and directly returning
> false at the end of the function, as we can be certain at that point.
> Hence, I did not add a Fixes tag. Am I missing something?
Oops, you're right, my bad.
> > Personally I'd have written
> >
> > diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> > index 067c6af14e95..3d0810b3c35e 100644
> > --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> > +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> > @@ -345,8 +345,6 @@ bool rzg2l_fifo_empty(struct rzg2l_cru_dev *cru)
> > amnfifopntr_w = amnfifopntr & AMnFIFOPNTR_FIFOWPNTR;
> > amnfifopntr_r_y =
> > (amnfifopntr & AMnFIFOPNTR_FIFORPNTR_Y) >> 16;
> > - if (amnfifopntr_w == amnfifopntr_r_y)
> > - return true;
> >
> > return amnfifopntr_w == amnfifopntr_r_y;
> > }
> >
> > but that's also a bit of a style preference.
>
> I wanted to keep this consistent with the rz3e_fifo_empty(). If you
> prefer the above I'll do that in v2.
Up to you.
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2025-04-28 11:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-28 9:52 [PATCH] media: renesas: rzg2l-cru: Simplify FIFO empty check Prabhakar
2025-04-28 9:59 ` Laurent Pinchart
2025-04-28 11:17 ` Lad, Prabhakar
2025-04-28 11:25 ` Laurent Pinchart [this message]
2025-04-28 11:32 ` Lad, Prabhakar
2025-04-28 11:36 ` Biju Das
2025-04-28 13:23 ` Lad, Prabhakar
2025-04-28 11:36 ` Geert Uytterhoeven
2025-04-28 13:25 ` Lad, Prabhakar
2025-04-28 13:37 ` Geert Uytterhoeven
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=20250428112516.GG3371@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=dan.carpenter@linaro.org \
--cc=fabrizio.castro.jz@renesas.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=prabhakar.csengg@gmail.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=tommaso.merciai.xr@bp.renesas.com \
/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