From: Guenter Roeck <linux@roeck-us.net>
To: "Nuno Sá" <nuno.sa@analog.com>
Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
linux-doc@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Jean Delvare <jdelvare@suse.com>,
Jonathan Corbet <corbet@lwn.net>
Subject: Re: [PATCH v3 1/2] hwmon: Add support for ltc2947
Date: Tue, 29 Oct 2019 05:27:59 -0700 [thread overview]
Message-ID: <20191029122759.GA19337@roeck-us.net> (raw)
In-Reply-To: <20191021154115.319073-1-nuno.sa@analog.com>
On Mon, Oct 21, 2019 at 05:41:14PM +0200, Nuno Sá wrote:
> The ltc2947 is a high precision power and energy monitor with an
> internal sense resistor supporting up to +/- 30A. Three internal no
> Latency ADCs ensure accurate measurement of voltage and current, while
> high-bandwidth analog multiplication of voltage and current provides
> accurate power measurement in a wide range of applications. Internal or
> external clocking options enable precise charge and energy measurements.
>
> Signed-off-by: Nuno Sá <nuno.sa@analog.com>
[ ... ]
> +
> +static ssize_t ltc2947_show_value(struct device *dev,
> + struct device_attribute *da, char *buf)
> +{
> + struct ltc2947_data *st = dev_get_drvdata(dev);
> + struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
> + int ret;
> + s64 val = 0;
> +
> + switch (attr->index) {
> + case LTC2947_REG_ENERGY1:
> + case LTC2947_REG_ENERGY2:
> + ret = ltc2947_val_read(st, attr->index, PAGE0, 6, &val);
> + break;
> + default:
> + return -EINVAL;
> + }
This complexity is also unnecessary: index is either LTC2947_REG_ENERGY1 or
LTC2947_REG_ENERGY2. I removed the case statement when applying.
Guenter
prev parent reply other threads:[~2019-10-29 12:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-21 15:41 [PATCH v3 1/2] hwmon: Add support for ltc2947 Nuno Sá
2019-10-21 15:41 ` [PATCH v3 2/2] dt-bindings: hwmon: Add ltc2947 documentation Nuno Sá
2019-10-24 22:46 ` Rob Herring
2019-10-25 10:32 ` Sa, Nuno
2019-10-29 12:30 ` Guenter Roeck
2019-10-29 12:24 ` [PATCH v3 1/2] hwmon: Add support for ltc2947 Guenter Roeck
2019-10-29 12:27 ` Guenter Roeck [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=20191029122759.GA19337@roeck-us.net \
--to=linux@roeck-us.net \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=jdelvare@suse.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=nuno.sa@analog.com \
--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;
as well as URLs for NNTP newsgroup(s).