All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Kieran Bingham <kieran.bingham@ideasonboard.com>
Cc: Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
	Sakari Ailus <sakari.ailus@iki.fi>,
	Daniel Scally <dan.scally@ideasonboard.com>,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, nayden.kanchev@arm.com,
	robh+dt@kernel.org, mchehab@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
	jerome.forissier@linaro.org
Subject: Re: [PATCH v2 3/5] media: mali-c55: Add Mali-C55 ISP driver
Date: Wed, 28 Feb 2024 15:38:47 +0200	[thread overview]
Message-ID: <20240228133847.GA9863@pendragon.ideasonboard.com> (raw)
In-Reply-To: <170912697659.1011926.1657561990919797055@ping.linuxembedded.co.uk>

On Wed, Feb 28, 2024 at 01:29:36PM +0000, Kieran Bingham wrote:
> Quoting Sakari Ailus (2024-02-28 13:11:39)
> > On Wed, Feb 28, 2024 at 01:50:14PM +0100, Jacopo Mondi wrote:
> > > > > +const struct mali_c55_fmt *mali_c55_cap_fmt_next(const struct mali_c55_fmt *fmt,
> > > > > +                                          bool allow_raw, bool unique)
> > > > > +{
> > > > > + if (!fmt)
> > > > > +         fmt = &mali_c55_fmts[0];
> > > > > + else
> > > > > +         ++fmt;
> > > >
> > > > fmt++, please.
> > > 
> > > Can I ask why ? (here and in the next occurrences you have reported)
> > 
> > It's much, much more common and using that form makes the code easier to
> > read. The rest of the driver primarily uses variable++, too, AFAIR.
> > 
> > So you should use ++variable only when you need it.
> 
> I don't think this is a hot path, but I'll never forget my C tutor
> telling us how ++i is more efficient than i++ somewhere to do with the
> opcode ordering, and not having to make a copy [*1]
> 
> Though I bet any clever optimising compiler could spot this anyway.
> 
> [*1]. Whatever plausibility there is based on a 20 year old memory and
> should be verified elsewhere.

In C I wouldn't expect any practical difference. C++ is a different
matter, as the prefix and postfix operators can have different
implementations.

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Kieran Bingham <kieran.bingham@ideasonboard.com>
Cc: Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
	Sakari Ailus <sakari.ailus@iki.fi>,
	Daniel Scally <dan.scally@ideasonboard.com>,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, nayden.kanchev@arm.com,
	robh+dt@kernel.org, mchehab@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
	jerome.forissier@linaro.org
Subject: Re: [PATCH v2 3/5] media: mali-c55: Add Mali-C55 ISP driver
Date: Wed, 28 Feb 2024 15:38:47 +0200	[thread overview]
Message-ID: <20240228133847.GA9863@pendragon.ideasonboard.com> (raw)
In-Reply-To: <170912697659.1011926.1657561990919797055@ping.linuxembedded.co.uk>

On Wed, Feb 28, 2024 at 01:29:36PM +0000, Kieran Bingham wrote:
> Quoting Sakari Ailus (2024-02-28 13:11:39)
> > On Wed, Feb 28, 2024 at 01:50:14PM +0100, Jacopo Mondi wrote:
> > > > > +const struct mali_c55_fmt *mali_c55_cap_fmt_next(const struct mali_c55_fmt *fmt,
> > > > > +                                          bool allow_raw, bool unique)
> > > > > +{
> > > > > + if (!fmt)
> > > > > +         fmt = &mali_c55_fmts[0];
> > > > > + else
> > > > > +         ++fmt;
> > > >
> > > > fmt++, please.
> > > 
> > > Can I ask why ? (here and in the next occurrences you have reported)
> > 
> > It's much, much more common and using that form makes the code easier to
> > read. The rest of the driver primarily uses variable++, too, AFAIR.
> > 
> > So you should use ++variable only when you need it.
> 
> I don't think this is a hot path, but I'll never forget my C tutor
> telling us how ++i is more efficient than i++ somewhere to do with the
> opcode ordering, and not having to make a copy [*1]
> 
> Though I bet any clever optimising compiler could spot this anyway.
> 
> [*1]. Whatever plausibility there is based on a 20 year old memory and
> should be verified elsewhere.

In C I wouldn't expect any practical difference. C++ is a different
matter, as the prefix and postfix operators can have different
implementations.

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2024-02-28 13:39 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-14 14:19 [PATCH v2 0/5] Add Arm Mali-C55 Image Signal Processor Driver Daniel Scally
2024-02-14 14:19 ` Daniel Scally
2024-02-14 14:19 ` [PATCH v2 1/5] media: uapi: Add MEDIA_BUS_FMT_RGB202020_1X60 format code Daniel Scally
2024-02-14 14:19   ` Daniel Scally
2024-02-14 14:19 ` [PATCH v2 2/5] dt-bindings: media: Add bindings for ARM mali-c55 Daniel Scally
2024-02-14 14:19   ` Daniel Scally
2024-02-14 14:28   ` Laurent Pinchart
2024-02-14 14:28     ` Laurent Pinchart
2024-02-14 17:37     ` Conor Dooley
2024-02-14 17:37       ` Conor Dooley
2024-02-15 11:02       ` Laurent Pinchart
2024-02-15 11:02         ` Laurent Pinchart
2024-02-16 13:09         ` Dan Scally
2024-02-16 13:09           ` Dan Scally
2024-02-16 13:27           ` Laurent Pinchart
2024-02-16 13:27             ` Laurent Pinchart
2024-02-16 14:45             ` Dan Scally
2024-02-16 14:45               ` Dan Scally
2024-02-16 19:07               ` Conor Dooley
2024-02-16 19:07                 ` Conor Dooley
2024-02-22 18:07                 ` Rob Herring
2024-02-22 18:07                   ` Rob Herring
2024-02-26 11:54   ` Sakari Ailus
2024-02-26 11:54     ` Sakari Ailus
2024-02-26 12:04     ` Laurent Pinchart
2024-02-26 12:04       ` Laurent Pinchart
2024-02-26 12:20       ` Sakari Ailus
2024-02-26 12:20         ` Sakari Ailus
2024-02-26 12:58         ` Laurent Pinchart
2024-02-26 12:58           ` Laurent Pinchart
2024-02-26 13:37           ` Sakari Ailus
2024-02-26 13:37             ` Sakari Ailus
2024-02-26 13:42             ` Dan Scally
2024-02-26 13:42               ` Dan Scally
2024-02-14 14:19 ` [PATCH v2 3/5] media: mali-c55: Add Mali-C55 ISP driver Daniel Scally
2024-02-26 11:03   ` Sakari Ailus
2024-02-28 12:50     ` Jacopo Mondi
2024-02-28 12:50       ` Jacopo Mondi
2024-02-28 13:11       ` Sakari Ailus
2024-02-28 13:11         ` Sakari Ailus
2024-02-28 13:29         ` Kieran Bingham
2024-02-28 13:29           ` Kieran Bingham
2024-02-28 13:38           ` Laurent Pinchart [this message]
2024-02-28 13:38             ` Laurent Pinchart
2024-03-01 15:15     ` Dan Scally
2024-03-01 16:21     ` Dan Scally
2024-03-01 16:21       ` Dan Scally
2024-02-14 14:19 ` [PATCH v2 4/5] media: Documentation: Add Mali-C55 ISP Documentation Daniel Scally
2024-02-14 14:19   ` Daniel Scally
2024-02-25 21:22   ` Kieran Bingham
2024-02-25 21:22     ` Kieran Bingham
2024-02-26  7:48     ` Dan Scally
2024-02-26  7:48       ` Dan Scally
2024-02-26  9:12       ` Kieran Bingham
2024-02-26  9:12         ` Kieran Bingham
2024-02-14 14:19 ` [PATCH v2 5/5] MAINTAINERS: Add entry for mali-c55 driver Daniel Scally
2024-02-14 14:19   ` Daniel Scally

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=20240228133847.GA9863@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=conor+dt@kernel.org \
    --cc=dan.scally@ideasonboard.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=jerome.forissier@linaro.org \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nayden.kanchev@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sakari.ailus@iki.fi \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.