mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wadim Mueller <wafgo01@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: lars@metafoo.de, dlechner@baylibre.com, nuno.sa@analog.com,
	andy@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, linux@roeck-us.net, jdelvare@suse.com,
	ak@it-klinger.de, linux-iio@vger.kernel.org,
	linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v1 3/4] iio: flow: add Sensirion SLF3x liquid flow sensor driver
Date: Wed, 27 May 2026 16:35:01 +0200	[thread overview]
Message-ID: <20260527143515.102794-4-wafgo01@gmail.com> (raw)
In-Reply-To: <20260526173531.4422ae40@jic23-huawei>

On Tue, 26 May 2026 17:35:31 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> Hopefully I haven't overlapped too much with the review Guenter did.

No overlap problem - replying to all the inline points below.

> > +	  Say yes here to build support for the Sensirion SLF3S family of
> > +	  digital liquid-flow sensors (SLF3S-0600F, SLF3S-4000B, ...).  
> 
> We try to have full listings of supported parts in the help text as it
> gets searched by folk looking for a driver. To minimize the churn consider
> a bulleted list with one per line.

Done in v2 - bulleted list with all currently supported parts
(SLF3S-0600F, SLF3S-1300F, SLF3S-4000B).

> > +#include <linux/unaligned.h>  
> The gap before this header and others in other drivers is an historical oddity ...
> No need to separate it.

Done in v2.

> > +static const struct slf3x_variant slf3x_variants[] = {
> > +	{ .sub_type = 0x03, .name = "slf3s-0600f",
> > +	  .scale_num = 1, .scale_den = 6000000 },
> > +	{ .sub_type = 0x05, .name = "slf3s-4000b",
> > +	  .scale_num = 1, .scale_den = 1666680000 },  
> 
> Maybe format this as one per line.

Done in v2.  One variant entry per line; the list grew by
SLF3S-1300F as Guenter asked.

> > +static int slf3x_write_cmd(struct i2c_client *client, const u8 *cmd)  
> 
> Might be good to use
> const u8 cmd[at_least 2])
> to let the compiler know the constraints.

Done in v2 - declared as `const u8 cmd[static 2]`.

> > +	for (i = 0; i < SLF3X_PRODUCT_ID_LEN; i += 3) {
> > +		if (slf3x_verify_crc(&buf[i])) {
> > +			dev_err(&client->dev,
> > +				"product-info CRC mismatch at byte %d\n", i);
> > +			return -EIO;  
> For all returns in stuff only called from probe() use dev_err_probe().

Done in v2.  All probe-path log+return pairs use dev_err_probe()
now; the remaining dev_err() calls are in the runtime read_raw
path.

> > +	for (i = 0; i < SLF3X_MEAS_LEN; i += 3) {  
> Fine to do
> 	for (unsigned int i = 0; i < ..

Done in v2.

> > +	*flow = (s16)get_unaligned_be16(&buf[0]);  
> 
> Prefer to make this a little more self documenting as
> 
> 	*flow = sign_extend32(get_unaligned_be16(&buf[0]), 15);

Done in v2 for both flow and temp.

> > +	ret = devm_regulator_get_enable_optional(dev, "vdd");  
> 
> No need to turn this on until we are somewhere nearer ready to chat
> to the device.  Normally we do it just before first access.
> I'd move it down a little. It's also not optional unless
> there is some other way of powering the device.
> Just let the regulator framework provide a stub regulator if it's not
> in the firmware description.

Done in v2.  Switched to devm_regulator_get_enable() and moved it
down so it runs just before the first I2C access (the product-info
read).

> > +	ret = slf3x_read_product_info(sf);
> > +	if (ret)
> > +		return dev_err_probe(dev, ret, "product info read failed\n");  
> As in the other review thread, this shouldn't be an error a we want
> those fallback compatibles to work in future.

Done in v2.  Unknown sub-type is dev_dbg() now and falls back to
the variant from the DT compatible (or the of_device_id .data for
the generic fallback).  CRC/family mismatches stay real errors.

> > +	usleep_range(SLF3X_MEAS_DELAY_US, SLF3X_MEAS_DELAY_US + 1000);  
> 
> fsleep() for fuzzy sleeps like this - it applies a standard amount of 'slack' time
> and means we don't need to reason about whether that is a good value or not.

Done in v2.

> > +static const struct i2c_device_id slf3x_id[] = {
> > +	{ "slf3s" },  
> 
> Please use a named initializer here like you do for the of_device_id.
> Uwe is working on making sure all drivers do this and I just took a patch
> that updated most of the IIO ones to do so.

Done in v2 - `{ .name = "slf3s-0600f" }` etc.  The i2c id table
mirrors the of_device_id list, with .driver_data pointing at the
matching slf3s_variant.

Thanks,
Wadim

  reply	other threads:[~2026-05-27 14:35 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-24 20:49 [RFC PATCH v1 0/4] iio: add Sensirion SLF3x liquid flow sensor support Wadim Mueller
2026-05-24 20:49 ` [RFC PATCH v1 1/4] iio: types: add IIO_VOLUMEFLOW channel type Wadim Mueller
2026-05-24 21:39   ` Guenter Roeck
2026-05-26 15:59     ` Jonathan Cameron
2026-05-27 14:35       ` Wadim Mueller
2026-05-27 14:35     ` Wadim Mueller
2026-05-26 16:13   ` Jonathan Cameron
2026-05-27 14:35     ` Wadim Mueller
2026-05-24 20:49 ` [RFC PATCH v1 2/4] dt-bindings: iio: flow: add Sensirion SLF3x liquid flow sensor Wadim Mueller
2026-05-26 16:19   ` Jonathan Cameron
2026-05-27 14:35     ` Wadim Mueller
2026-05-24 20:49 ` [RFC PATCH v1 3/4] iio: flow: add Sensirion SLF3x liquid flow sensor driver Wadim Mueller
2026-05-24 21:40   ` Guenter Roeck
2026-05-26 16:06     ` Jonathan Cameron
2026-05-27 14:35       ` Wadim Mueller
2026-05-27 14:35     ` Wadim Mueller
2026-05-26 16:35   ` Jonathan Cameron
2026-05-27 14:35     ` Wadim Mueller [this message]
2026-05-26 16:43   ` Jonathan Cameron
2026-05-27 14:34     ` Wadim Mueller
2026-05-24 20:49 ` [RFC PATCH v1 4/4] MAINTAINERS: add entry for Sensirion SLF3x " Wadim Mueller
2026-05-26 16:36   ` Jonathan Cameron
2026-05-27 14:35     ` Wadim Mueller
2026-05-27 14:42       ` Maxwell Doose
2026-05-27 18:36         ` Wadim Mueller
2026-05-26 16:12 ` [RFC PATCH v1 0/4] iio: add Sensirion SLF3x liquid flow sensor support Jonathan Cameron
2026-05-27 14:34   ` Wadim Mueller
2026-05-27 18:32     ` Jonathan Cameron
2026-05-27 18:42 ` [PATCH v2 0/3] iio: flow: Sensirion SLF3S liquid flow sensor Wadim Mueller
2026-05-27 18:42   ` [PATCH v2 1/3] iio: types: add IIO_VOLUMEFLOW channel type Wadim Mueller
2026-05-28 10:20     ` Jonathan Cameron
2026-05-27 18:42   ` [PATCH v2 2/3] dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor Wadim Mueller
2026-05-28  9:07     ` Krzysztof Kozlowski
2026-05-30 20:42       ` Wadim Mueller
2026-05-27 18:42   ` [PATCH v2 3/3] iio: flow: add Sensirion SLF3S liquid flow sensor driver Wadim Mueller
2026-05-28 11:22     ` Jonathan Cameron
2026-05-28 13:56       ` Rodrigo Alencar
2026-05-30 20:42       ` Wadim Mueller
2026-05-31  8:52         ` Jonathan Cameron
2026-05-28 10:14   ` [PATCH v2 0/3] iio: flow: Sensirion SLF3S liquid flow sensor Jonathan Cameron
2026-05-30 20:42     ` Wadim Mueller

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=20260527143515.102794-4-wafgo01@gmail.com \
    --to=wafgo01@gmail.com \
    --cc=ak@it-klinger.de \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jdelvare@suse.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --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

all inboxes | Powered by JetHome®