Patch "PM: runtime: Have devm_pm_runtime_enable() handle pm_runtime_dont_use_autosuspend()" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    PM: runtime: Have devm_pm_runtime_enable() handle pm_runtime_dont_use_autosuspend()

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     pm-runtime-have-devm_pm_runtime_enable-handle-pm_runtime_dont_use_autosuspend.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From stable+bounces-17405-greg=kroah.com@xxxxxxxxxxxxxxx Tue Jan 30 13:59:31 2024
From: Amit Pundir <amit.pundir@xxxxxxxxxx>
Date: Tue, 30 Jan 2024 18:28:46 +0530
Subject: PM: runtime: Have devm_pm_runtime_enable() handle pm_runtime_dont_use_autosuspend()
To: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>, Sasha Levin <sashal@xxxxxxxxxx>, Konrad Dybcio <konrad.dybcio@xxxxxxxxxx>, Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>, Douglas Anderson <dianders@xxxxxxxxxxxx>
Cc: Stable <stable@xxxxxxxxxxxxxxx>, Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>, Ulf Hansson <ulf.hansson@xxxxxxxxxx>, "Rafael J . Wysocki" <rafael.j.wysocki@xxxxxxxxx>
Message-ID: <20240130125847.3915432-2-amit.pundir@xxxxxxxxxx>

From: Douglas Anderson <dianders@xxxxxxxxxxxx>

[ Upstream commit b4060db9251f919506e4d672737c6b8ab9a84701 ]

The PM Runtime docs say:

  Drivers in ->remove() callback should undo the runtime PM changes done
  in ->probe(). Usually this means calling pm_runtime_disable(),
  pm_runtime_dont_use_autosuspend() etc.

>From grepping code, it's clear that many people aren't aware of the
need to call pm_runtime_dont_use_autosuspend().

When brainstorming solutions, one idea that came up was to leverage
the new-ish devm_pm_runtime_enable() function. The idea here is that:

 * When the devm action is called we know that the driver is being
   removed. It's the perfect time to undo the use_autosuspend.

 * The code of pm_runtime_dont_use_autosuspend() already handles the
   case of being called when autosuspend wasn't enabled.

Suggested-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
Signed-off-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
Reviewed-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Stable-dep-of: 3d07a411b4fa ("drm/msm/dsi: Use pm_runtime_resume_and_get to prevent refcnt leaks")
Signed-off-by: Amit Pundir <amit.pundir@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/base/power/runtime.c |    5 +++++
 include/linux/pm_runtime.h   |    4 ++++
 2 files changed, 9 insertions(+)

--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -1479,11 +1479,16 @@ EXPORT_SYMBOL_GPL(pm_runtime_enable);
 
 static void pm_runtime_disable_action(void *data)
 {
+	pm_runtime_dont_use_autosuspend(data);
 	pm_runtime_disable(data);
 }
 
 /**
  * devm_pm_runtime_enable - devres-enabled version of pm_runtime_enable.
+ *
+ * NOTE: this will also handle calling pm_runtime_dont_use_autosuspend() for
+ * you at driver exit time if needed.
+ *
  * @dev: Device to handle.
  */
 int devm_pm_runtime_enable(struct device *dev)
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -542,6 +542,10 @@ static inline void pm_runtime_disable(st
  * Allow the runtime PM autosuspend mechanism to be used for @dev whenever
  * requested (or "autosuspend" will be handled as direct runtime-suspend for
  * it).
+ *
+ * NOTE: It's important to undo this with pm_runtime_dont_use_autosuspend()
+ * at driver exit time unless your driver initially enabled pm_runtime
+ * with devm_pm_runtime_enable() (which handles it for you).
  */
 static inline void pm_runtime_use_autosuspend(struct device *dev)
 {


Patches currently in stable-queue which might be from kroah.com@xxxxxxxxxxxxxxx are

queue-5.15/btrfs-refresh-dir-last-index-during-a-rewinddir-3-call.patch
queue-5.15/btrfs-set-last-dir-index-to-the-current-last-index-when-opening-dir.patch
queue-5.15/ksmbd-set-v2-lease-version-on-lease-upgrade.patch
queue-5.15/drm-msm-dsi-enable-runtime-pm.patch
queue-5.15/ksmbd-add-missing-set_freezable-for-freezable-kthread.patch
queue-5.15/btrfs-fix-infinite-directory-reads.patch
queue-5.15/ksmbd-don-t-increment-epoch-if-current-state-and-request-state-are-same.patch
queue-5.15/pm-runtime-have-devm_pm_runtime_enable-handle-pm_runtime_dont_use_autosuspend.patch
queue-5.15/ksmbd-send-lease-break-notification-on-file_rename_information.patch
queue-5.15/ksmbd-fix-potential-circular-locking-issue-in-smb2_set_ea.patch
queue-5.15/btrfs-fix-race-between-reading-a-directory-and-adding-entries-to-it.patch




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux