Re: [PATCH v2 3/5] media: mali-c55: Add Mali-C55 ISP driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Sakari Ailus (2024-02-28 13:11:39)
> Hi Jacopo,
> 
> 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.

--
Kieran


> 
> -- 
> Sakari Ailus





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux