mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Neel Bullywon <neelb2403@gmail.com>
To: rafael@kernel.org
Cc: jic23@kernel.org, paul@crapouillou.net, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, Neel Bullywon <neelb2403@gmail.com>
Subject: [PATCH] PM: runtime: add system sleep callbacks to EXPORT_*_RUNTIME_DEV_PM_OPS()
Date: Sat, 28 Feb 2026 20:22:46 -0500	[thread overview]
Message-ID: <20260301012246.66404-1-neelb2403@gmail.com> (raw)

DEFINE_RUNTIME_DEV_PM_OPS() sets pm_runtime_force_suspend() and
pm_runtime_force_resume() as system sleep callbacks via
_DEFINE_DEV_PM_OPS(), but the exported variants
(EXPORT_RUNTIME_DEV_PM_OPS, EXPORT_GPL_RUNTIME_DEV_PM_OPS,
EXPORT_NS_RUNTIME_DEV_PM_OPS, EXPORT_NS_GPL_RUNTIME_DEV_PM_OPS)
only set RUNTIME_PM_OPS() and omit SYSTEM_SLEEP_PM_OPS(). This
means drivers using the export macros do not get system sleep
support, contrary to what the documentation suggests.

Add SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
pm_runtime_force_resume) to all four export variants to match the
behavior of DEFINE_RUNTIME_DEV_PM_OPS().

All current users of these macros are IIO drivers (bme680, bmp280,
kxsd9, mpl115, bmi088-accel) and none implement custom system sleep
callbacks, so this change is safe for all existing callers.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Suggested-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Neel Bullywon <neelb2403@gmail.com>
---
 include/linux/pm_runtime.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 41037c513f06..c6a6a0569b11 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -42,18 +42,26 @@
 
 #define EXPORT_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \
 	EXPORT_DEV_PM_OPS(name) = { \
+		SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, \
+				    pm_runtime_force_resume) \
 		RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
 	}
 #define EXPORT_GPL_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \
 	EXPORT_GPL_DEV_PM_OPS(name) = { \
+		SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, \
+				    pm_runtime_force_resume) \
 		RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
 	}
 #define EXPORT_NS_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn, ns) \
 	EXPORT_NS_DEV_PM_OPS(name, ns) = { \
+		SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, \
+				    pm_runtime_force_resume) \
 		RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
 	}
 #define EXPORT_NS_GPL_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn, ns) \
 	EXPORT_NS_GPL_DEV_PM_OPS(name, ns) = { \
+		SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, \
+				    pm_runtime_force_resume) \
 		RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
 	}
 
-- 
2.44.0


             reply	other threads:[~2026-03-01  1:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-01  1:22 Neel Bullywon [this message]
2026-03-06 18:30 ` Rafael J. Wysocki

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=20260301012246.66404-1-neelb2403@gmail.com \
    --to=neelb2403@gmail.com \
    --cc=jic23@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=paul@crapouillou.net \
    --cc=rafael@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®