Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jacopo Mondi <jacopo@jmondi.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Matt Ranostay <matt.ranostay@konsulko.com>,
	Magnus Damm <magnus.damm@gmail.com>,
	linux-iio@vger.kernel.org, Peter Rosin <peda@axentia.se>,
	Wolfram Sang <wsa@kernel.org>
Subject: Re: [PATCH v5 3/4] iio: chemical: Add Senseair Sunrise 006-0-007 driver
Date: Sat, 11 Sep 2021 16:12:52 +0100	[thread overview]
Message-ID: <20210911161252.1f8b1be6@jic23-huawei> (raw)
In-Reply-To: <YToFvPooJpCpqr28@smile.fi.intel.com>

On Thu, 9 Sep 2021 16:01:48 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Thu, Sep 09, 2021 at 11:45:36AM +0200, Jacopo Mondi wrote:
> > Add support for the Senseair Sunrise 006-0-0007 driver through the
> > IIO subsystem.  
> 
> ...
> 
> > +	/*
> > +	 * Wake up sensor by sending sensor address: START, sensor address,
> > +	 * STOP. Sensor will not ACK this byte.
> > +	 *
> > +	 * The chip enters a low power state after 15msec without  
> 
> msec --> ms (everybody understands 'ms' unit)

yup. millisiemens :)
(couldn't resist)

Context is fine either way here.

> 
> > +	 * communications or after a complete read/write sequence.
> > +	 */  
> 
> ...
> 
> > +	struct i2c_client *client = context;
> > +	union i2c_smbus_data data;
> > +
> > +	/* Discard reg address from values count. */
> > +	if (count < 1)
> > +		return -EINVAL;
> > +	count--;  
> 
> Wouldn't be more natural to decrement and then check against 0?
> 
> ...
> 
> > +	memcpy(&data.block[1], (u8 *)val_buf + 1, count);  
> 
> Not sure I understand why you need an explicit casting here.

C doesn't allow pointer arithmetic on void * (gcc has it as an extension
though so it's probably fine without the cast)



> 
> 
> ...
> 
> > +	mutex_lock(&sunrise->lock);
> > +	ret = sunrise_read_word(sunrise, SUNRISE_ERROR_STATUS_REG, &value);
> > +	if (ret) {
> > +		mutex_unlock(&sunrise->lock);  
> 
> > +		return -EINVAL;  
> 
> Why shadowing an actual error code?
> 
> > +	}  
> 
> ...
> 
> > +			/*
> > +			 * / 10^4 to comply with IIO scale for CO2 (percentage).  
> 
> "1 / 10^4"
> 
> > +			 * The chip CO2 reading range is [400 - 5000] ppm
> > +			 * which corresponds to [0,004 - 0,5] %.
> > +			 */  
> 


  parent reply	other threads:[~2021-09-11 15:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09  9:45 [PATCH v5 0/4] iio: chemical: Add Senseair Sunrise CO2 sensor Jacopo Mondi
2021-09-09  9:45 ` [PATCH v5 1/4] dt-bindings: iio: chemical: Document senseair,sunrise " Jacopo Mondi
2021-09-09  9:45 ` [PATCH v5 2/4] iio: ABI: docs: Document Senseair Sunrise ABI Jacopo Mondi
2021-09-09  9:45 ` [PATCH v5 3/4] iio: chemical: Add Senseair Sunrise 006-0-007 driver Jacopo Mondi
2021-09-09 12:04   ` Peter Rosin
2021-09-20 13:02     ` Jacopo Mondi
2021-09-09 13:01   ` Andy Shevchenko
2021-09-09 13:03     ` Andy Shevchenko
2021-09-11 15:12     ` Jonathan Cameron [this message]
2021-09-11 15:29   ` Jonathan Cameron
2021-09-09  9:45 ` [PATCH v5 4/4] iio: ABI: Document in_concentration_co2_scale Jacopo Mondi
2021-09-09 13:05   ` Andy Shevchenko
2021-09-10 10:47     ` Jonathan Cameron
2021-09-11 15:04       ` Jonathan Cameron

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=20210911161252.1f8b1be6@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=jacopo@jmondi.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=matt.ranostay@konsulko.com \
    --cc=peda@axentia.se \
    --cc=wsa@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