From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Shuah Khan <shuah.kh@samsung.com>
Cc: pavel@ucw.cz, len.brown@intel.com, gregkh@linuxfoundation.org,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
shuahkhan@gmail.com
Subject: Re: [PATCH] power: Add legacy pm ops usage warning
Date: Sat, 02 Nov 2013 00:04:50 +0100 [thread overview]
Message-ID: <7710681.pPuGuuagq2@vostro.rjw.lan> (raw)
In-Reply-To: <1383318424-4072-1-git-send-email-shuah.kh@samsung.com>
On Friday, November 01, 2013 09:07:04 AM Shuah Khan wrote:
> Add legacy pm_ops usage checks to device_pm_add() when a device gets added
> to PM core's list of active devices. If legacy pm_ops usage is found at its
> class, bus, driver level, print warning message to indicate the driver code
> needs updating to use dev pm ops interfaces. This will help serve as a way
> to track drivers that still use legacy pm ops and fix them.
I think it would be much better to do these checks during bus type, class or
driver registration, because if you register a bus type with legacy PM, for
example, the check in device_pm_add() will trigger for all devices with that
bus type.
Thanks!
> Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
> ---
> drivers/base/power/main.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
> index 9f098a8..4dc26dc 100644
> --- a/drivers/base/power/main.c
> +++ b/drivers/base/power/main.c
> @@ -112,6 +112,23 @@ void device_pm_unlock(void)
> }
>
> /**
> + * check for lgeacy pm_ops usage and warn
> + */
> +static void device_legacy_pm_ops_check(struct device *dev)
> +{
> + char *info = "Please update driver to use dev pm_ops";
> +
> + if (dev->class && (dev->class->suspend || dev->class->resume))
> + dev_warn(dev, "Driver uses legacy class pm ops - %s\n", info);
> +
> + if (dev->bus && (dev->bus->suspend || dev->bus->resume))
> + dev_warn(dev, "Driver uses legacy bus pm ops - %s\n", info);
> +
> + if (dev->driver && (dev->driver->suspend || dev->driver->resume))
> + dev_warn(dev, "Driver uses legacy pm ops - %s\n", info);
> +}
> +
> +/**
> * device_pm_add - Add a device to the PM core's list of active devices.
> * @dev: Device to add to the list.
> */
> @@ -123,6 +140,7 @@ void device_pm_add(struct device *dev)
> if (dev->parent && dev->parent->power.is_prepared)
> dev_warn(dev, "parent %s should not be sleeping\n",
> dev_name(dev->parent));
> + device_legacy_pm_ops_check(dev);
> list_add_tail(&dev->power.entry, &dpm_list);
> mutex_unlock(&dpm_list_mtx);
> }
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
next prev parent reply other threads:[~2013-11-01 22:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-01 15:07 Shuah Khan
2013-11-01 23:04 ` Rafael J. Wysocki [this message]
2013-11-05 18:41 ` Shuah Khan
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=7710681.pPuGuuagq2@vostro.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=gregkh@linuxfoundation.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=shuah.kh@samsung.com \
--cc=shuahkhan@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
all inboxes | Powered by JetHome®