mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sebastian Reichel <sre@kernel.org>
To: "Pierre Bourdon (delroth)" <delroth@google.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Andre Heider <a.heider@gmail.com>,
	Linux PM <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] max17042: propagate of_node to power supply device
Date: Thu, 22 Feb 2018 21:46:15 +0100	[thread overview]
Message-ID: <20180222204615.ogyplmoq5oxpudtk@earth.universe> (raw)
In-Reply-To: <CANEr7oWE7Po4ReN8+oX4CEzrbjmnhSJpwmfgjyidB6dqP0m8Gg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1812 bytes --]

Hi,

On Tue, Feb 20, 2018 at 06:58:56PM +0100, Pierre Bourdon (delroth) wrote:
> On Tue, Feb 20, 2018 at 6:34 PM, Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Tue, Feb 20, 2018 at 5:03 PM, Pierre Bourdon <delroth@google.com> wrote:
> >> max17042_get_status uses the core power_supply_am_i_supplied. That
> >> function relies on DT properties to figure out the power supply
> >> topology, and will error out without DT.
> >
> >> +       psy_cfg.of_node = dev->of_node;
> >
> > Perhaps do this in general manner, see how GPIOLIB takes care of it:
> >
> > $ git grep -n -A4 -w CONFIG_OF_GPIO -- drivers/gpio/gpiolib.c
> > drivers/gpio/gpiolib.c:1161:#ifdef CONFIG_OF_GPIO
> > drivers/gpio/gpiolib.c-1162-    /* If the gpiochip has an assigned OF
> > node this takes precedence */
> > drivers/gpio/gpiolib.c-1163-    if (chip->of_node)
> > drivers/gpio/gpiolib.c-1164-            gdev->dev.of_node = chip->of_node;
> > drivers/gpio/gpiolib.c-1165-#endif
> > ...
> 
> Makes sense. From a quick look in existing drivers, it looks like the
> only values being used currently as psy_cfg.of_node are the nodes from
> the parent device, so it seems like it could be made generic.
> 
> Are we aware of any driver that is not propagating the of_node on
> purpose? Is this something that should be supported? If not, I guess
> we could get rid of power_supply_config.of_node and always use the one
> from the parent device in __power_supply_register.
> 
> (I'm very new to this codebase, sorry for the possibly dumb questions!)

I think it makes sense to keep psy_cfg.of_node in case a driver
needs to use a subnode for some reason. I think it makes sense
to use dev->of_node as default value, though. Anyways I have
applied this patch to my fixes branch.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-02-22 20:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-20 15:03 Pierre Bourdon
2018-02-20 17:34 ` Andy Shevchenko
2018-02-20 17:58   ` Pierre Bourdon (delroth)
2018-02-22 20:46     ` Sebastian Reichel [this message]
2018-02-22 20:40 ` Sebastian Reichel

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=20180222204615.ogyplmoq5oxpudtk@earth.universe \
    --to=sre@kernel.org \
    --cc=a.heider@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=delroth@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.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

all inboxes | Powered by JetHome®