[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200211160321.22124-1-paul@crapouillou.net>
Date: Tue, 11 Feb 2020 13:03:18 -0300
From: Paul Cercueil <paul@...pouillou.net>
To: "Rafael J . Wysocki" <rjw@...ysocki.net>,
Len Brown <len.brown@...el.com>, Pavel Machek <pavel@....cz>
Cc: Ulf Hansson <ulf.hansson@...aro.org>, od@...c.me,
linux-pm@...r.kernel.org, linux-mmc@...r.kernel.org,
linux-kernel@...r.kernel.org, Paul Cercueil <paul@...pouillou.net>
Subject: [RFC PATCH 0/3] Introduce pm_ptr() / pm_sleep_ptr()
Hi,
I've seen many times things like:
#ifdef CONFIG_PM_SLEEP
static SIMPLE_DEV_PM_OPS(foo_pm_ops, foo_suspend, foo_resume);
#define FOO_PM_OPS (&foo_pm_ops)
#else
#define FOO_PM_OPS NULL
#endif
static struct platform_driver foo_driver = {
.driver.pm = FOO_PM_OPS,
};
And always wondered why there was no of-match-ptr-like macro to make
things cleaner.
So this RFC adds two macros, pm_ptr() and pm_sleep_ptr(), which resolve
to their argument when CONFIG_PM or CONFIG_PM_SLEEP (respectively) are
enabled, or NULL otherwise.
Patch 3/3 is an example of what it would look like when used in a
driver.
Comments welcome.
Cheers,
-Paul
Paul Cercueil (3):
PM: introduce pm_ptr() and pm_sleep_ptr()
PM: Make *_DEV_PM_OPS macros use __maybe_unused
mmc: jz4740: Use pm_sleep_ptr() macro
drivers/mmc/host/jz4740_mmc.c | 12 +++---------
include/linux/pm.h | 16 ++++++++++++++--
2 files changed, 17 insertions(+), 11 deletions(-)
--
2.25.0
Powered by blists - more mailing lists