All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Petre Rodan <petre.rodan@subdimension.ro>
Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
	Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Angel Iglesias <ang.iglesiasg@gmail.com>,
	Matti Vaittinen <mazziesaccount@gmail.com>,
	Andreas Klinger <ak@it-klinger.de>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Subject: Re: [PATCH v5 2/2] iio: pressure: driver for Honeywell HSC/SSC series pressure sensors
Date: Wed, 29 Nov 2023 12:36:46 +0200	[thread overview]
Message-ID: <ZWcUPkzfGqxYsysp@smile.fi.intel.com> (raw)
In-Reply-To: <20231129070452.1521-1-petre.rodan@subdimension.ro>

On Wed, Nov 29, 2023 at 09:04:49AM +0200, Petre Rodan wrote:
> Adds driver for digital Honeywell TruStability HSC and SSC series
> pressure and temperature sensors.
> Communication is one way. The sensor only requires 4 bytes worth of
> clock pulses on both i2c and spi in order to push the data out.
> The i2c address is hardcoded and depends on the part number.
> There is no additional GPIO control.

Thank you for an update!

Much better now, only one important thing is left unaddressed, see below.

...

> +	if (strncmp(triplet, "NA", 2) == 0) {

str_has_prefix()

...

> +		for (index = 0; index < ARRAY_SIZE(hsc_range_config); index++) {
> +			if (strncmp(hsc_range_config[index].triplet,
> +				    triplet,
> +				    HSC_PRESSURE_TRIPLET_LEN - 1) == 0) {
> +				hsc->pmin = hsc_range_config[index].pmin;
> +				hsc->pmax = hsc_range_config[index].pmax;
> +				found = 1;
> +				break;
> +			}
> +		}
> +		if (hsc->pmin == hsc->pmax || !found)
> +			return dev_err_probe(dev, -EINVAL,
> +				"honeywell,pressure-triplet is invalid\n");

This one is important. I think I told already twice that this is NIH
device_property_match_property_string(). Please, use this API directly.

...

> +	tmp = div_s64(((s64)(hsc->pmax - hsc->pmin)) * MICRO,
> +		      hsc->outmax - hsc->outmin);
> +	hsc->p_scale = div_s64_rem(tmp, NANO, &hsc->p_scale_dec);
> +	tmp = div_s64(((s64)hsc->pmin * (s64)(hsc->outmax - hsc->outmin)) *
> +		      MICRO, hsc->pmax - hsc->pmin);

I would leave MICRO on the previous line for better understanding the code.

...

> +#ifndef _HSC030PA_H
> +#define _HSC030PA_H

> +#include <linux/mutex.h>

> +#include <linux/property.h>

Is not used here.

> +#include <linux/types.h>

...

> +/*
> + * get all conversions (4 bytes) in one go
> + * since transfers are not address-based
> +*/

Missing space at the last line and missing capitalization and grammar period.

...

> +int hsc_common_probe(struct device *dev, void *client,
> +	hsc_recv_fn recv_fn, const char *name);

Indentation is unusual on the second line, also you can use just "recv" as
parameter name. But both are minor and I leave them to you and maintainer.

...

> +static const struct of_device_id hsc_spi_match[] = {
> +	{.compatible = "honeywell,hsc030pa"},

I believe Jonathan asks for inner spaces, like { ...foo... }.

> +	{}
> +};

...

> +static const struct spi_device_id hsc_spi_id[] = {
> +	{"hsc030pa"},

Ditto.

> +	{}
> +};

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2023-11-29 10:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29  7:04 [PATCH v5 2/2] iio: pressure: driver for Honeywell HSC/SSC series pressure sensors Petre Rodan
2023-11-29 10:36 ` Andy Shevchenko [this message]
2023-11-29 13:51   ` Petre Rodan
2023-11-29 14:14     ` Andy Shevchenko
2023-11-29 14:16       ` 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=ZWcUPkzfGqxYsysp@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=ak@it-klinger.de \
    --cc=ang.iglesiasg@gmail.com \
    --cc=jic23@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mazziesaccount@gmail.com \
    --cc=petre.rodan@subdimension.ro \
    --cc=robh+dt@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 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.