From: Tobias Schramm <t.schramm@manjaro.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Tobias Schramm <t.schramm@manjaro.org>
Cc: Sebastian Reichel <sre@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] power: supply: add CellWise cw2015 fuel gauge driver
Date: Tue, 10 Mar 2020 19:55:42 +0100 [thread overview]
Message-ID: <eb732216-dd19-f18d-9ace-e14c7e8de991@manjaro.org> (raw)
In-Reply-To: <20200310101050.GG1922688@smile.fi.intel.com>
Hi Andy,
thanks for your review. Please find my comments inline.
>> +#define CW2015_DEFAULT_MONITOR_MS 8000
>
> 8 seconds? Any comments about this?
>
Default suggested by CellWise Android example code. I'll add a comment
explaining that.
>> +static int cw_read(struct cw_battery *cw_bat, u8 reg, u8 *val)
>> +{
>> + u32 tmp;
>> + int ret;
>> +
>> + ret = regmap_read(cw_bat->regmap, reg, &tmp);
>> + *val = tmp;
>> + return ret;
>> +}
>> +
[ ... ]
>
> This two has no value. Why?
>
This helper translates the memory write size. An u8 * is passed in while
regmap_read takes an unsigned int *. I'll drop it and just use an
unsigned int in the first place though.
>> +static int cw_read_word(struct cw_battery *cw_bat, u8 reg, u16 *val)
>> +{
>> + u8 reg_val[2];
>> + int ret;
>> +
>> + ret = regmap_raw_read(cw_bat->regmap, reg, reg_val, 2);
>> + *val = (reg_val[0] << 8) + reg_val[1];
>> + return ret;
>> +}
>
> NIH BE type of readings? Can REGMAP_ENDIAN_BIG help?
Not really, or can it? Registers on the cw2015 are a wild mix of single
bytes and words. There does not seem to be a per register override for
reg_/val_bits.
>
> I didn't review some parts because of style issues. Please, fix all of them and
> send v2.
>
I'll fix all style issues I find.
>> + cancel_delayed_work(&cw_bat->battery_delay_work);
>
> Are you sure you have no scheduled work after that?
>
Will replace that with cancel_delayed_work_sync.
Best Regards,
Tobias
next prev parent reply other threads:[~2020-03-10 18:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-09 16:03 [PATCH v2 0/2] Add support for CellWise cw2015 fuel gauge Tobias Schramm
2020-03-09 16:03 ` [PATCH v2 1/2] dt-bindings: power: supply: cw2015_battery: add device tree binding documentation Tobias Schramm
2020-03-10 18:34 ` Rob Herring
2020-03-09 16:03 ` [PATCH v2 2/2] power: supply: add CellWise cw2015 fuel gauge driver Tobias Schramm
2020-03-10 10:10 ` Andy Shevchenko
2020-03-10 18:55 ` Tobias Schramm [this message]
2020-03-11 8:14 ` Andy Shevchenko
2020-03-11 8:48 ` Tobias Schramm
2020-03-11 9:11 ` 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=eb732216-dd19-f18d-9ace-e14c7e8de991@manjaro.org \
--to=t.schramm@manjaro.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mchehab+huawei@kernel.org \
--cc=robh+dt@kernel.org \
--cc=sre@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).