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