All of lore.kernel.org
 help / color / mirror / Atom feed
From: Angel Iglesias <ang.iglesiasg@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Paul Cercueil <paul@crapouillou.net>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-iio <linux-iio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 5/5] iio: pressure: bmp280: Adds more tunable config parameters for BMP380
Date: Wed, 06 Jul 2022 00:51:03 +0200	[thread overview]
Message-ID: <b9280ecbf78424882878ef2ff6c3da6671064ed5.camel@gmail.com> (raw)
In-Reply-To: <CAHp75VdBv8BJVzBCMzWKpm0RrqX=K_QPQ4cgdshqXP3Uy+hVHQ@mail.gmail.com>

Thank you for your comments!

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@gmail.com> wrote:
> > 
> > Allows to configure the IIR filter coefficient and the sampling frequency
> > The IIR filter coefficient is exposed using the sysfs attribute
> > "filter_low_pass_3db_frequency"
> 
> In all your commit messages, please pay attention to English grammar.
> Here you forgot all the periods.
> 
> ...
> 
> > +       BMP380_ODR_0_0015HZ
> 
> Keep a comma here.
> 
> ...
> 
> > +       /* BMP380 devices introduce sampling frequecy configuration. See
> 
> frequency.
> 
> > +        * datasheet sections 3.3.3. and 4.3.19.
> > +        *
> > +        * BMx280 devices allowed indirect configuration of sampling
> > frequency
> > +        * changing the t_standby duration between measurements. See
> > datasheet
> > +        * section 3.6.3
> > +        */
> 
> /*
>  * Multi-line comment style
>  * example. Use it.
>  */
> 
> ...
> 
> > +               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.
> 
> ...
> 
> > +                               /*
> > +                                * Error applying new configuration. Might
> > be
> > +                                * an invalid configuration, will try to
> > +                                * restore previous value just to be sure
> 
> Missed period. Please, check all your texts (commit messages,
> comments, etc) for proper English grammar.

Apologies, I'll be more careful before sending the revised patches next time

> 
> > +                                */
> 
> ...
> 
> > +                               /*
> > +                                * Error applying new configuration. Might
> > be
> > +                                * an invalid configuration, will try to
> > +                                * restore previous value just to be sure
> 
> Ditto.
> 
> > +                                */
> 
> ...
> 
> > +                               /*
> > +                                * Error applying new configuration. Might
> > be
> > +                                * an invalid configuration, will try to
> > +                                * restore previous value just to be sure
> 
> Ditto.
> 
> > +                                */
> 
> ...
> 
> > +                               /*
> > +                                * Error applying new configuration. Might
> > be
> > +                                * an invalid configuration, will try to
> > +                                * restore previous value just to be sure
> 
> Ditto.
> 
> > +                                */
> 
> ...
> 
> > +                               /*
> > +                                * Error applying new configuration. Might
> > be
> > +                                * an invalid configuration, will try to
> > +                                * restore previous value just to be sure
> 
> Ditto.
> 
> > +                                */
> 
> 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)?
> 
> ...
> 
> >         u8 osrs;
> >         unsigned int tmp;
> >         int ret;
> > +       bool change, aux;
> 
> Move them up, and probably use reversed xmas tree ordering ("longest
> line first" rule).
> 
> Also should be
>   bool change = false, aux;
> 
> ...
> 
> > +       change = change || aux;
> 
> change ||= aux;

I think I'm missing something, do you mean to use '|='?

> 
> And in other cases.
> 
> ...
> 
> > +               /* cycle sensor state machine to reset any measurement in
> > progress
> > +                * configuration errors are detected in a measurment cycle.
> 
> measurement
> 
> > +                * If the sampling frequency is too low, it is faster to
> > reset
> > +                * measurement cycle and restart measurements
> > +                */
> 
> Completely wrong comment style. Be consistent and follow the common
> standards in the Linux kernel.
> 
> ...
> 
> > +               /* wait before checking the configuration error flag.
> > +                * Worst case value for measure time indicated in the
> > datashhet
> 
> datasheet
> 
> > +                * in section 3.9.1 is used.
> > +                */
> 
> Ditto.
> 


  reply	other threads:[~2022-07-05 22:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-04  0:33 [PATCH v2 5/5] iio: pressure: bmp280: Adds more tunable config parameters for BMP380 Angel Iglesias
2022-07-04  2:32 ` kernel test robot
2022-07-04 20:08 ` Andy Shevchenko
2022-07-05 22:51   ` Angel Iglesias [this message]
2022-07-06 12:42     ` Andy Shevchenko
2022-07-06 14:39       ` Angel Iglesias
2022-07-06 17:49         ` Andy Shevchenko

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=b9280ecbf78424882878ef2ff6c3da6671064ed5.camel@gmail.com \
    --to=ang.iglesiasg@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul@crapouillou.net \
    --cc=rafael.j.wysocki@intel.com \
    --cc=ulf.hansson@linaro.org \
    /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.