[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcEAtpVsfp2CCtJR_e_eSSFaMkODFwd-ZuHKGsNPcVWfA@mail.gmail.com>
Date: Wed, 6 Jul 2022 14:42:51 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Angel Iglesias <ang.iglesiasg@...il.com>
Cc: Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
Paul Cercueil <paul@...pouillou.net>,
Ulf Hansson <ulf.hansson@...aro.org>,
linux-iio <linux-iio@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 5/5] iio: pressure: bmp280: Adds more tunable config
parameters for BMP380
On Wed, Jul 6, 2022 at 12:51 AM Angel Iglesias <ang.iglesiasg@...il.com> wrote:
> On Mon, 2022-07-04 at 22:08 +0200, Andy Shevchenko wrote:
> > On Mon, Jul 4, 2022 at 2:41 AM Angel Iglesias <ang.iglesiasg@...il.com> wrote:
...
> > > + if (unlikely(!data->chip_info->sampling_freq_avail)) {
> >
> > Why unlikely() ? How does this improve code generation / performance?
>
> As Jonathan Cameron sugested on a previous version of the patch, even thought
> this code should be safe (as if we are checking sampling frequency is because
> the sensor is a BMP380 and has that property), it would be better to have a
> sanity check just to be sure the property is really available. I used unlikely
> macro to take into account that the property would be almost always initialized.
>
> Now that you mention, probably this code won't be called too often to make the
> "unlikely" branching hint make a meaningful performance difference
>
> > > + if (unlikely(!data->chip_info->iir_filter_coeffs_avail)) {
> >
> > Ditto.
Is this really a performance-critical path? How did you check that
unlikely() makes sense?
More evidence, please!
...
> > Why do you need to copy'n'paste dozens of the very same comment?
> > Wouldn't it be enough to explain it somewhere at the top of the file
> > or in the respective documentation (if it exists)?
No answer?
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists