From: Paul Kocialkowski <contact@paulk.fr>
To: Liam Breck <liam@networkimprov.net>
Cc: "Andrew F. Davis" <afd@ti.com>,
linux-pm@vger.kernel.org, Sebastian Reichel <sre@kernel.org>
Subject: Re: [PATCH 1/5] power: supply: bq27xxx: Pass of_node along to allow device-tree supply
Date: Mon, 01 May 2017 12:46:31 +0200 [thread overview]
Message-ID: <1493635591.6493.10.camel@paulk.fr> (raw)
In-Reply-To: <CAKvHMgSijN8vQUePoTKRC5nqaW-Shh4_9ZKiKq0Uae3ZLkiDSA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3614 bytes --]
Le dimanche 30 avril 2017 à 15:03 -0700, Liam Breck a écrit :
> [dropped some CCs]
>
>
> On Sun, Apr 30, 2017 at 1:37 PM, Paul Kocialkowski <contact@paulk.fr> wrote:
> > This passes the of_node from the bq27xxx i2c battery driver to the
> > common code, so that it can be registered and provide external supplies
> > linked with device-tree.
> >
> > Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> > ---
> > drivers/power/supply/bq27xxx_battery.c | 5 ++++-
> > drivers/power/supply/bq27xxx_battery_i2c.c | 1 +
> > include/linux/power/bq27xxx_battery.h | 1 +
> > 3 files changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/power/supply/bq27xxx_battery.c
> > b/drivers/power/supply/bq27xxx_battery.c
> > index 398801a21b86..6ef95442a918 100644
> > --- a/drivers/power/supply/bq27xxx_battery.c
> > +++ b/drivers/power/supply/bq27xxx_battery.c
> > @@ -1351,7 +1351,10 @@ static void bq27xxx_external_power_changed(struct
> > power_supply *psy)
> > int bq27xxx_battery_setup(struct bq27xxx_device_info *di)
> > {
> > struct power_supply_desc *psy_desc;
> > - struct power_supply_config psy_cfg = { .drv_data = di, };
> > + struct power_supply_config psy_cfg = {};
> > +
> > + psy_cfg.drv_data = di;
> > + psy_cfg.of_node = di->of_node;
>
> I don't think you need di->of_node, just the following -- we do this
> to obtain data from devicetree via power_supply_get_battery_info()
> https://patchwork.kernel.org/patch/9692335/
>
> struct power_supply_config psy_cfg = {
> .drv_data = di,
> .of_node = di->dev->of_node,
> };
That's a good point, thanks! Should I prepare v2 with this or rebase on top of
the series you mentioned previously?
> There is some (gcc?) bug on armv7 or omap which causes separate
> assignments to corrupt the stack.
That's weird, but definitely good to know.
> > INIT_DELAYED_WORK(&di->work, bq27xxx_battery_poll);
> > mutex_init(&di->lock);
> > diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c
> > b/drivers/power/supply/bq27xxx_battery_i2c.c
> > index c68fbc3fe50a..38a0422a4192 100644
> > --- a/drivers/power/supply/bq27xxx_battery_i2c.c
> > +++ b/drivers/power/supply/bq27xxx_battery_i2c.c
> > @@ -96,6 +96,7 @@ static int bq27xxx_battery_i2c_probe(struct i2c_client
> > *client,
> > di->chip = id->driver_data;
> > di->name = name;
> > di->bus.read = bq27xxx_battery_i2c_read;
> > + di->of_node = client->dev.of_node;
> >
> > ret = bq27xxx_battery_setup(di);
> > if (ret)
> > diff --git a/include/linux/power/bq27xxx_battery.h
> > b/include/linux/power/bq27xxx_battery.h
> > index b312bcef53da..94637b77ecbf 100644
> > --- a/include/linux/power/bq27xxx_battery.h
> > +++ b/include/linux/power/bq27xxx_battery.h
> > @@ -63,6 +63,7 @@ struct bq27xxx_device_info {
> > const char *name;
> > struct bq27xxx_access_methods bus;
> > struct bq27xxx_reg_cache cache;
> > + struct device_node *of_node;
> > int charge_design_full;
> > unsigned long last_update;
> > struct delayed_work work;
> > --
> > 2.12.2
> >
--
Paul Kocialkowski, developer of free digital technology and hardware support
Website: https://www.paulk.fr/
Coding blog: https://code.paulk.fr/
Git repositories: https://git.paulk.fr/ https://git.code.paulk.fr/
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-05-01 10:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20170430203801.32357-1-contact@paulk.fr>
2017-04-30 22:03 ` [PATCH 1/5] power: supply: bq27xxx: Pass of_node along to allow device-tree supply Liam Breck
2017-05-01 10:46 ` Paul Kocialkowski [this message]
2017-05-01 18:30 ` Liam Breck
2017-05-01 18:40 ` Paul Kocialkowski
[not found] ` <20170430203801.32357-4-contact@paulk.fr>
2017-04-30 22:13 ` [PATCH 4/5] power: supply: bq27xxx: Look for status change on external power change Liam Breck
2017-05-01 10:45 ` Paul Kocialkowski
2017-05-01 18:22 ` Liam Breck
2017-05-01 18:34 ` Paul Kocialkowski
[not found] ` <20170430203801.32357-5-contact@paulk.fr>
2017-04-30 22:35 ` [PATCH 5/5] power: supply: bq27xxx: Correct supply status with current draw Liam Breck
2017-05-01 10:39 ` Paul Kocialkowski
2017-05-01 18:18 ` Liam Breck
2017-05-01 18:37 ` Paul Kocialkowski
2017-04-30 18:27 [PATCH 1/5] power: supply: bq27xxx: Pass of_node along to allow device-tree supply Paul Kocialkowski
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=1493635591.6493.10.camel@paulk.fr \
--to=contact@paulk.fr \
--cc=afd@ti.com \
--cc=liam@networkimprov.net \
--cc=linux-pm@vger.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).