mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: <victor.duicu@microchip.com>
Cc: <matteomartelli3@gmail.com>, <lars@metafoo.de>,
	<marius.cristea@microchip.com>, <linux-iio@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3] iio: adc: pac1921: add ACPI support to Microchip pac1921.
Date: Sat, 12 Oct 2024 12:39:23 +0100	[thread overview]
Message-ID: <20241012123923.23000c34@jic23-huawei> (raw)
In-Reply-To: <20241011134454.45283-1-victor.duicu@microchip.com>

On Fri, 11 Oct 2024 16:44:54 +0300
<victor.duicu@microchip.com> wrote:

> From: Victor Duicu <victor.duicu@microchip.com>
> 
> This patch implements ACPI support to Microchip pac1921.
> The driver can read shunt resistor value and label from ACPI table.
> 
> The patch was tested on a minnowboard(64b) and sama5(32b).
> In order to avoid overflow when reading 64b values from ACPi table or
> devicetree it is necessary:
> - the revision of .dsl file must be 2 or greater to enable 64b arithmetic.
> - the shunt resistor variable in devicetree must have the prefix "/bits/ 64".
> 

Change log should be below the --- as it doesn't want to end up in the git history.


> Differences related to previous versions:
> v3:
> - simplify and make inline function pac1921_shunt_is_valid. Make argument u64.
> - fix link to DSM documentation.
> - in pac1921_match_acpi_device and pac1921_parse_of_fw, the shunt value is
> read as u64.
> - in pac1921_parse_of_fw remove code for reading label value from
> devicetree.
> - in pac1921_write_shunt_resistor cast the multiply result to u64 in order
> to fix overflow.
> 
> v2:
> - remove name variable from priv. Driver reads label attribute with
> sysfs.
> - define pac1921_shunt_is_valid function.
> - move default assignments in pac1921_probe to original position.
> - roll back coding style changes.
> - add documentation for DSM(the linked document was used as reference).
> - remove acpi_match_device in pac1921_match_acpi_device.
> - remove unnecessary null assignment and comment.
> - change name of function pac1921_match_of_device to
> pac1921_parse_of_fw.
> 
> v1:
> - initial version for review.
> 
> Signed-off-by: Victor Duicu <victor.duicu@microchip.com>
A few comments in line.

J

 int pac1921_parse_of_fw(struct i2c_client *client, struct pac1921_priv *priv,
> +			       struct iio_dev *indio_dev)
> +{
> +	int ret;
> +	struct device *dev = &client->dev;
> +	u64 temp;
> +
> +	ret = device_property_read_u64(dev, "shunt-resistor-micro-ohms", &temp);
> +
No line break here.  Want to associate that error check with the line above
as clearly as possible.

> +	if (ret)
> +		return dev_err_probe(dev, ret,
> +				     "Cannot read shunt resistor property\n");
> +
> +	if (pac1921_shunt_is_valid(temp))
> +		return dev_err_probe(dev, -EINVAL, "Invalid shunt resistor: %u\n",
> +				     priv->rshunt_uohm);
> +
> +	priv->rshunt_uohm = (u32)temp;
> +	pac1921_calc_current_scales(priv);
> +
> +	return 0;
> +}

      parent reply	other threads:[~2024-10-12 11:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-11 13:44 victor.duicu
2024-10-12 10:05 ` Matteo Martelli
2024-10-14 10:08   ` Victor.Duicu
2024-10-14 15:46     ` Matteo Martelli
2024-10-14 18:46       ` Jonathan Cameron
2024-10-15  8:02         ` Victor.Duicu
2024-10-12 11:39 ` Jonathan Cameron [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=20241012123923.23000c34@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marius.cristea@microchip.com \
    --cc=matteomartelli3@gmail.com \
    --cc=victor.duicu@microchip.com \
    /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®