From: Guenter Roeck <linux@roeck-us.net>
To: Chu Lin <linchuyuan@google.com>
Cc: belgaied@google.com, jasonling@google.com, jdelvare@suse.com,
linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
zhongqil@google.com, kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v3 2/2] hwmon:max6697: fixing the type issue where the comparison is always true
Date: Mon, 6 Jul 2020 17:54:22 -0700 [thread overview]
Message-ID: <1d6c34f5-6da2-a081-3d13-559f9dbbe352@roeck-us.net> (raw)
In-Reply-To: <20200707002203.2494094-3-linchuyuan@google.com>
On 7/6/20 5:22 PM, Chu Lin wrote:
> - Use reverse christmas tree order convension
> - fix the type issue where comparision is always true
> - Change the line limit to 100 char instead of 80 char
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Chu Lin <linchuyuan@google.com>
Unless I am missing something, this patch fixes the first patch
of the series. This is not reviewable. Please combine with the
first patch.
Thanks,
Guenter
> ---
> drivers/hwmon/max6697.c | 26 +++++++++-----------------
> 1 file changed, 9 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/hwmon/max6697.c b/drivers/hwmon/max6697.c
> index 8c814c544116..6b213e146fbe 100644
> --- a/drivers/hwmon/max6697.c
> +++ b/drivers/hwmon/max6697.c
> @@ -329,15 +329,13 @@ static ssize_t offset_store(struct device *dev,
> struct device_attribute *devattr, const char *buf,
> size_t count)
> {
> - long temp;
> - u8 val, select;
> - int ret, index;
> + int val, ret, index, select;
> struct max6697_data *data;
> + long temp;
>
> index = to_sensor_dev_attr(devattr)->index;
> data = dev_get_drvdata(dev);
> - select = i2c_smbus_read_byte_data(data->client,
> - MAX6581_REG_OFFSET_SELECT);
> + select = i2c_smbus_read_byte_data(data->client, MAX6581_REG_OFFSET_SELECT);
> if (select < 0)
> return select;
> ret = kstrtol(buf, 10, &temp);
> @@ -345,22 +343,18 @@ static ssize_t offset_store(struct device *dev,
> return ret;
> /* disable the offset for channel */
> if (temp == 0) {
> - ret = i2c_smbus_write_byte_data(data->client,
> - MAX6581_REG_OFFSET_SELECT,
> + ret = i2c_smbus_write_byte_data(data->client, MAX6581_REG_OFFSET_SELECT,
> select & ~(1 << (index - 1)));
> return ret < 0 ? ret : count;
> }
> temp = clamp_val(temp, MAX6581_OFFSET_MIN, MAX6581_OFFSET_MAX);
> val = DIV_ROUND_CLOSEST(temp, 250);
> mutex_lock(&data->update_lock);
> - ret = i2c_smbus_write_byte_data(data->client,
> - MAX6581_REG_OFFSET_SELECT,
> + ret = i2c_smbus_write_byte_data(data->client, MAX6581_REG_OFFSET_SELECT,
> select | (1 << (index - 1)));
> if (ret < 0)
> return ret;
> - ret = i2c_smbus_write_byte_data(data->client,
> - MAX6581_REG_OFFSET,
> - val);
> + ret = i2c_smbus_write_byte_data(data->client, MAX6581_REG_OFFSET, val);
> mutex_unlock(&data->update_lock);
> return ret < 0 ? ret : count;
> }
> @@ -368,18 +362,16 @@ static ssize_t offset_store(struct device *dev,
> static ssize_t offset_show(struct device *dev, struct device_attribute *devattr,
> char *buf)
> {
> - int select, ret, index;
> struct max6697_data *data;
> + int select, ret, index;
>
> index = to_sensor_dev_attr(devattr)->index;
> data = dev_get_drvdata(dev);
> - select = i2c_smbus_read_byte_data(data->client,
> - MAX6581_REG_OFFSET_SELECT);
> + select = i2c_smbus_read_byte_data(data->client, MAX6581_REG_OFFSET_SELECT);
> if (select < 0)
> return select;
> if (select & (1 << (index - 1))) {
> - ret = i2c_smbus_read_byte_data(data->client,
> - MAX6581_REG_OFFSET);
> + ret = i2c_smbus_read_byte_data(data->client, MAX6581_REG_OFFSET);
> if (ret < 0)
> return ret;
> } else {
>
next prev parent reply other threads:[~2020-07-07 0:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-07 0:22 [PATCH v3 0/2] hwmon:max6697: Allow max6581 to create tempX_offset Chu Lin
2020-07-07 0:22 ` [PATCH v3 1/2] " Chu Lin
2020-07-07 0:22 ` [PATCH v3 2/2] hwmon:max6697: fixing the type issue where the comparison is always true Chu Lin
2020-07-07 0:54 ` Guenter Roeck [this message]
2020-07-07 0:56 ` Chu Lin
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=1d6c34f5-6da2-a081-3d13-559f9dbbe352@roeck-us.net \
--to=linux@roeck-us.net \
--cc=belgaied@google.com \
--cc=jasonling@google.com \
--cc=jdelvare@suse.com \
--cc=linchuyuan@google.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=zhongqil@google.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;
as well as URLs for NNTP newsgroup(s).