From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Gyeyoung Baek <gye976@gmail.com>
Cc: jic23@kernel.org, linux-iio@vger.kernel.org,
devicetree@vger.kernel.org, dlechner@baylibre.com,
nuno.sa@analog.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org
Subject: Re: [PATCH v4 3/4] iio: chemical: add support for winsen MHZ19B CO2 sensor
Date: Tue, 22 Apr 2025 10:50:39 +0300 [thread overview]
Message-ID: <aAdKT41RRPOU4eZG@smile.fi.intel.com> (raw)
In-Reply-To: <CAKbEznvax5maXFH9V7ZLkME2=Ydt4DiJ9pwfyL_nbsJ5_G3B8A@mail.gmail.com>
On Mon, Apr 21, 2025 at 03:41:58PM +0900, Gyeyoung Baek wrote:
> On Mon, Apr 21, 2025 at 4:22 AM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Sun, Apr 20, 2025 at 9:10 PM Gyeyoung Baek <gye976@gmail.com> wrote:
...
> > > The datasheet is available at
> > > Link: https://www.winsen-sensor.com/d/files/infrared-gas-sensor/mh-z19b-co2-ver1_0.pdf
> >
> > Instead, just make it Datasheet: tag.
> > >
> > Should not be this blank line here.
> > > Signed-off-by: Gyeyoung Baek <gye976@gmail.com>
>
> Sorry, I now understand what you mean.
> ('Datasheet:' is a tag, not an explanation. So there should be no
> space between the tags.)
> However, when I use the 'Datasheet:' tag, I get the following warning
> by checkpatch.pl.
> Would it be OK? then I'll use 'Datasheet:' tag.
>
> "WARNING: Unknown link reference 'Datasheet:', use 'Link:' or
> 'Closes:' instead
> #8:
> Datasheet:
> https://www.winsen-sensor.com/d/files/infrared-gas-sensor/mh-z19b-co2-ver1_0.pdf"
checkpatch is recommendation and sometimes has not fully suitable warnings. You
may ignore this one.
...
> > > +#include <linux/completion.h>
> > > +#include <linux/device.h>
> > > +#include <linux/iio/iio.h>
> > > +#include <linux/iio/sysfs.h>
> > > +#include <linux/mod_devicetable.h>
> > > +#include <linux/module.h>
> > > +#include <linux/regulator/consumer.h>
> > > +#include <linux/serdev.h>
> > > +#include <linux/unaligned.h>
> >
> > Semi-baked list, see below what's missing (actually a lot). I believe
> > I already pointed that out.
>
> From the last review, I understood the two main points as:
> (1) Avoid using large headers and explicitly include only the necessary ones.
> (2) Reduce including headers as much as possible to improve build times.
>
> However, I found that removing headers like 'types.h' didn't cause any
> build failure,
Because we have other headers that may use it, but you shouldn't do that.
> So I thought it would be better to remove headers that are unnecessary
> to improve build time.
> But in the next patch, I'll explicitly include the headers you've pointed out.
You should follow IWYU principle, i.e. Include What You Use, e.g., types.h.
...
> > > + if (ppm) {
> > > + if (!in_range(ppm, 1000, 4001)) {
> >
> > Missing minmax.h.
> >
> > The second parameter is length of the range.
> >
> > > + dev_dbg(&indio_dev->dev,
> > > + "span point ppm should be 1000~5000");
> >
> > The above range check doesn't agree with this message.
>
> in_range() uses the range 'start <= val && val < (start + len)'.
> So, to allow 5000, the 'len' should be 4001, not 4000.
> I have tested this.
> But would it be correct that I understand your point?
I see now, I recommend then to define those two:
#define ..._PPM_MIN 1000
#define ..._PPM_MAX 5000
And use here as
if (!in_range(ppm, ..._MIN, ..._MAX - ..._MIN + 1)) {
dev_dbg(&indio_dev->dev,
"span point PPM should be in a range [%d-%d]\n",
_MIN, _MAX);
Note, you missed \n as well.
> > > + return -EINVAL;
> > > + }
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2025-04-22 7:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-20 18:10 [PATCH v4 0/4] add support for winsen MHZ19B CO2 sensor Gyeyoung Baek
2025-04-20 18:10 ` [PATCH v4 1/4] dt-bindings: add winsen to the vendor prefixes Gyeyoung Baek
2025-04-20 18:10 ` [PATCH v4 2/4] dt-bindings: add device tree support for winsen MHZ19B CO2 sensor Gyeyoung Baek
2025-04-20 18:10 ` [PATCH v4 3/4] iio: chemical: add " Gyeyoung Baek
2025-04-20 19:21 ` Andy Shevchenko
2025-04-20 19:23 ` Andy Shevchenko
2025-04-21 13:25 ` Jonathan Cameron
2025-04-22 8:42 ` Gyeyoung Baek
2025-04-22 8:38 ` Gyeyoung Baek
2025-04-22 17:30 ` Andy Shevchenko
2025-04-25 8:22 ` Jonathan Cameron
2025-04-21 6:41 ` Gyeyoung Baek
2025-04-22 7:50 ` Andy Shevchenko [this message]
2025-04-20 18:10 ` [PATCH v4 4/4] MAINTAINERS: Add WINSEN MHZ19B Gyeyoung Baek
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=aAdKT41RRPOU4eZG@smile.fi.intel.com \
--to=andy.shevchenko@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=gye976@gmail.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).