Linux IIO development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy@kernel.org>
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 v5 3/4] iio: chemical: add support for winsen MHZ19B CO2 sensor
Date: Tue, 22 Apr 2025 20:39:50 +0300	[thread overview]
Message-ID: <aAfUZuujO0FUkJEG@smile.fi.intel.com> (raw)
In-Reply-To: <20250422155302.669960-4-gye976@gmail.com>

On Wed, Apr 23, 2025 at 12:53:01AM +0900, Gyeyoung Baek wrote:
> Add support for winsen MHZ19B CO2 sensor.

Winsen (name capitalisation)?

...

> +static ssize_t calibration_forced_value_store(struct device *dev,
> +					      struct device_attribute *attr,
> +					      const char *buf, size_t len)
> +{
> +	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> +	u16 ppm;
> +	int cmd, ret;
> +
> +	ret = kstrtou16(buf, 0, &ppm);
> +	if (ret)
> +		return ret;
> +
> +	if (ppm) {
> +		if (!in_range(ppm, 1000, 4001)) {
> +			dev_dbg(&indio_dev->dev,
> +				"span point ppm should be between 1000 and 5000 inclusive.");
> +			return -EINVAL;
> +		}

I proposed to define the _MIN and _MAX constants for the range and use them in
the parameters. Any objection?

> +		cmd = MHZ19B_SPAN_POINT_CMD;
> +	} else {
> +		cmd = MHZ19B_ZERO_POINT_CMD;
> +	}
> +
> +	ret = mhz19b_serdev_cmd(indio_dev, cmd, ppm);
> +	if (ret < 0)
> +		return ret;
> +
> +	return len;
> +}

Otherwise LGTM, thanks!

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2025-04-22 17:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-22 15:52 [PATCH v5 0/4] add support for winsen MHZ19B CO2 sensor Gyeyoung Baek
2025-04-22 15:52 ` [PATCH v5 1/4] dt-bindings: add winsen to the vendor prefixes Gyeyoung Baek
2025-04-22 15:53 ` [PATCH v5 2/4] dt-bindings: add device tree support for winsen MHZ19B CO2 sensor Gyeyoung Baek
2025-04-22 15:53 ` [PATCH v5 3/4] iio: chemical: add " Gyeyoung Baek
2025-04-22 17:39   ` Andy Shevchenko [this message]
2025-04-23 15:59     ` Gyeyoung Baek
2025-04-22 15:53 ` [PATCH v5 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=aAfUZuujO0FUkJEG@smile.fi.intel.com \
    --to=andy@kernel.org \
    --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