public inbox for linux-kernel@vger.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 v4 2/2] iio: pressure: driver for Honeywell HSC/SSC series pressure sensors
Date: Tue, 28 Nov 2023 18:54:10 +0200	[thread overview]
Message-ID: <ZWYbMnYEDmwNteEy@smile.fi.intel.com> (raw)
In-Reply-To: <20231128124103.22765-1-petre.rodan@subdimension.ro>

On Tue, Nov 28, 2023 at 02:40:58PM +0200, Petre Rodan wrote:
> Adds driver for digital Honeywell TruStability HSC and SSC series
> pressure and temperature sensors. 

Trailing white space.

> 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.

...

> +	default:
> +		return -EINVAL;
> +	}

> +	return -EINVAL;

Dead code.

...

> +int hsc_common_probe(struct device *dev, void *client,
> +	    int (*recv_fct)(struct hsc_data *data), const char *name)

Make it a typedef

typedef int (*hsc_recv_fn)(struct hsc_data *);

(note the fn suffix as standard in such cases).

...

> +	ret = device_property_read_u32(dev,
> +				       "honeywell,transfer-function",
> +				       &hsc->function);

Strange indentation.

> +	if (ret)
> +		return dev_err_probe(dev, ret,
> +			    "honeywell,transfer-function could not be read\n");

...

> +	ret = device_property_read_string(dev,
> +		"honeywell,pressure-triplet", &triplet);

Strange indentation.

> +	if (ret)
> +		return dev_err_probe(dev, ret,
> +			"honeywell,pressure-triplet could not be read\n");

...

> +	if (strncmp(triplet, "NA", 2) == 0) {
> +		/* "not available" in the nomenclature
> +		   we got a custom-range chip so extract pmin, pmax from dt */

Wrong comment style. And I believe I already said, respect English grammar
and punctuation! Ditto for other multi-line comments in this patch.

> +		ret = device_property_read_u32(dev,
> +					       "honeywell,pmin-pascal",
> +					       &hsc->pmin);

Strange indentation.

> +		if (ret)
> +			return dev_err_probe(dev, ret,
> +				"honeywell,pmin-pascal could not be read\n");
> +		ret = device_property_read_u32(dev,
> +					       "honeywell,pmax-pascal",

Strange indentation.

> +					       &hsc->pmax);
> +		if (ret)
> +			return dev_err_probe(dev, ret,
> +				"honeywell,pmax-pascal could not be read\n");
> +	} else {
> +		/* chip should be defined in the nomenclature */
> +		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");
> +	}

...

> +	tmp = div_s64(((s64)(hsc->pmax - hsc->pmin)) * MICRO,
> +		      (hsc->outmax - hsc->outmin));

Too many parentheses (denominator).

...

> +#include <linux/property.h>
> +#include <linux/types.h>

Missing mutex.h (in the common header file).

...

> +	int (*recv)(struct hsc_data *data);

See about typedef above.

...

> +int hsc_common_probe(struct device *dev, void *client,
> +	    int (*recv_fct)(struct hsc_data *data), const char *name);

Ditto.

...

> +#include <linux/i2c.h>
> +#include <linux/module.h>

Missing mod_devicetable.h, errno.h (I²C driver).

...

> +#include <linux/module.h>
> +#include <linux/spi/spi.h>

Missing mod_devicetable.h (SPI driver).
See below as well.

...

> +		.tx_buf = NULL,

NULL is defined via types.h IIRC.

...

> +static struct spi_driver hsc_spi_driver = {
> +	.driver = {
> +		.name = "hsc030pa",
> +		.of_match_table = hsc_spi_match,
> +		},

Wrong indentation.

> +	.probe = hsc_spi_probe,
> +	.id_table = hsc_spi_id,
> +};

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2023-11-28 16:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-28 12:40 [PATCH v4 2/2] iio: pressure: driver for Honeywell HSC/SSC series pressure sensors Petre Rodan
2023-11-28 16:54 ` Andy Shevchenko [this message]

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=ZWYbMnYEDmwNteEy@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox