From: linux@roeck-us.net
To: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: jdelvare@suse.com, linux-hwmon@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/5] hwmon: (core) Inherit power properties to hdev
Date: Thu, 25 Oct 2018 00:13:01 +0000 [thread overview]
Message-ID: <20181025001301.Horde.VCevVrrSs6rOyXT41xiPOzW@cp2.active-venture.com> (raw)
In-Reply-To: <20181024193402.16698-2-nicoleotsuka@gmail.com>
Quoting Nicolin Chen <nicoleotsuka@gmail.com>:
> The new hdev is a child device related to the original parent
> hwmon driver and its device. However, it doesn't support the
> power features, typically being defined in the parent driver.
>
> So this patch inherits three necessary power properties from
> the parent dev to hdev: power, pm_domain and driver pointers.
>
> Note that the dev->driver pointer is the place that contains
> a dev_pm_ops pointer defined in the parent device driver and
> the pm runtime core also checks this pointer:
> if (!cb && dev->driver && dev->driver->pm)
>
> Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
> ---
> Changelog
> v2->v3:
> * N/A
> v1->v2:
> * Added device pointers
>
> drivers/hwmon/hwmon.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
> index 975c95169884..14cfab64649f 100644
> --- a/drivers/hwmon/hwmon.c
> +++ b/drivers/hwmon/hwmon.c
> @@ -625,7 +625,12 @@ __hwmon_device_register(struct device *dev,
> const char *name, void *drvdata,
> hwdev->name = name;
> hdev->class = &hwmon_class;
> hdev->parent = dev;
> - hdev->of_node = dev ? dev->of_node : NULL;
> + if (dev) {
> + hdev->driver = dev->driver;
> + hdev->power = dev->power;
> + hdev->pm_domain = dev->pm_domain;
> + hdev->of_node = dev->of_node;
> + }
We'l need to dig into this more; I suspect it may be inappropriate to do this.
With this change, every hwmon driver supporting (runtime ?) suspend/resume
will have the problem worked around in #5, and that just seems wrong.
Guenter
> hwdev->chip = chip;
> dev_set_drvdata(hdev, drvdata);
> dev_set_name(hdev, HWMON_ID_FORMAT, id);
> --
> 2.17.1
next prev parent reply other threads:[~2018-10-25 0:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-24 19:33 [PATCH v3 0/5] hwmon: (ina3221) Implement PM runtime to save power Nicolin Chen
2018-10-24 19:33 ` [PATCH v3 1/5] hwmon: (core) Inherit power properties to hdev Nicolin Chen
2018-10-25 0:13 ` linux [this message]
2018-10-25 1:01 ` Nicolin Chen
2018-10-25 1:33 ` Nicolin Chen
2018-10-25 6:55 ` linux
2018-10-25 23:21 ` Nicolin Chen
2018-10-24 19:33 ` [PATCH v3 2/5] hwmon: (ina3221) Check channel status for alarms attribute read Nicolin Chen
2018-10-24 19:34 ` [PATCH v3 3/5] hwmon: (ina3221) Serialize sysfs ABI accesses Nicolin Chen
2018-10-24 19:34 ` [PATCH v3 4/5] hwmon: (ina3221) Make sure data is ready before reading Nicolin Chen
2018-10-24 19:34 ` [PATCH v3 5/5] hwmon: (ina3221) Add PM runtime support Nicolin Chen
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=20181025001301.Horde.VCevVrrSs6rOyXT41xiPOzW@cp2.active-venture.com \
--to=linux@roeck-us.net \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nicoleotsuka@gmail.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).