Commit 649c10ff authored by Pankaj Bharadiya's avatar Pankaj Bharadiya Committed by Jani Nikula

drm/i915/runtime_pm: Prefer drm_WARN* over WARN*

struct drm_device specific drm_WARN* macros include device information
in the backtrace, so we know what device the warnings originate from.

Prefer drm_WARN* over WARN*.

Conversion is done with below semantic patch:

@@
identifier func, T;
@@
func(struct intel_runtime_pm *T,...) {
+ struct drm_i915_private *i915 = container_of(T, struct drm_i915_private, runtime_pm);
<+...
(
-WARN(
+drm_WARN(&i915->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&i915->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&i915->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&i915->drm,
...)
)
...+>

}
Signed-off-by: default avatarPankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200504181600.18503-10-pankaj.laxminarayan.bharadiya@intel.com
parent 19edeb38
...@@ -116,6 +116,9 @@ track_intel_runtime_pm_wakeref(struct intel_runtime_pm *rpm) ...@@ -116,6 +116,9 @@ track_intel_runtime_pm_wakeref(struct intel_runtime_pm *rpm)
static void untrack_intel_runtime_pm_wakeref(struct intel_runtime_pm *rpm, static void untrack_intel_runtime_pm_wakeref(struct intel_runtime_pm *rpm,
depot_stack_handle_t stack) depot_stack_handle_t stack)
{ {
struct drm_i915_private *i915 = container_of(rpm,
struct drm_i915_private,
runtime_pm);
unsigned long flags, n; unsigned long flags, n;
bool found = false; bool found = false;
...@@ -134,9 +137,9 @@ static void untrack_intel_runtime_pm_wakeref(struct intel_runtime_pm *rpm, ...@@ -134,9 +137,9 @@ static void untrack_intel_runtime_pm_wakeref(struct intel_runtime_pm *rpm,
} }
spin_unlock_irqrestore(&rpm->debug.lock, flags); spin_unlock_irqrestore(&rpm->debug.lock, flags);
if (WARN(!found, if (drm_WARN(&i915->drm, !found,
"Unmatched wakeref (tracking %lu), count %u\n", "Unmatched wakeref (tracking %lu), count %u\n",
rpm->debug.count, atomic_read(&rpm->wakeref_count))) { rpm->debug.count, atomic_read(&rpm->wakeref_count))) {
char *buf; char *buf;
buf = kmalloc(PAGE_SIZE, GFP_NOWAIT | __GFP_NOWARN); buf = kmalloc(PAGE_SIZE, GFP_NOWAIT | __GFP_NOWARN);
...@@ -355,10 +358,14 @@ intel_runtime_pm_release(struct intel_runtime_pm *rpm, int wakelock) ...@@ -355,10 +358,14 @@ intel_runtime_pm_release(struct intel_runtime_pm *rpm, int wakelock)
static intel_wakeref_t __intel_runtime_pm_get(struct intel_runtime_pm *rpm, static intel_wakeref_t __intel_runtime_pm_get(struct intel_runtime_pm *rpm,
bool wakelock) bool wakelock)
{ {
struct drm_i915_private *i915 = container_of(rpm,
struct drm_i915_private,
runtime_pm);
int ret; int ret;
ret = pm_runtime_get_sync(rpm->kdev); ret = pm_runtime_get_sync(rpm->kdev);
WARN_ONCE(ret < 0, "pm_runtime_get_sync() failed: %d\n", ret); drm_WARN_ONCE(&i915->drm, ret < 0,
"pm_runtime_get_sync() failed: %d\n", ret);
intel_runtime_pm_acquire(rpm, wakelock); intel_runtime_pm_acquire(rpm, wakelock);
...@@ -539,6 +546,9 @@ void intel_runtime_pm_put(struct intel_runtime_pm *rpm, intel_wakeref_t wref) ...@@ -539,6 +546,9 @@ void intel_runtime_pm_put(struct intel_runtime_pm *rpm, intel_wakeref_t wref)
*/ */
void intel_runtime_pm_enable(struct intel_runtime_pm *rpm) void intel_runtime_pm_enable(struct intel_runtime_pm *rpm)
{ {
struct drm_i915_private *i915 = container_of(rpm,
struct drm_i915_private,
runtime_pm);
struct device *kdev = rpm->kdev; struct device *kdev = rpm->kdev;
/* /*
...@@ -565,7 +575,8 @@ void intel_runtime_pm_enable(struct intel_runtime_pm *rpm) ...@@ -565,7 +575,8 @@ void intel_runtime_pm_enable(struct intel_runtime_pm *rpm)
pm_runtime_dont_use_autosuspend(kdev); pm_runtime_dont_use_autosuspend(kdev);
ret = pm_runtime_get_sync(kdev); ret = pm_runtime_get_sync(kdev);
WARN(ret < 0, "pm_runtime_get_sync() failed: %d\n", ret); drm_WARN(&i915->drm, ret < 0,
"pm_runtime_get_sync() failed: %d\n", ret);
} else { } else {
pm_runtime_use_autosuspend(kdev); pm_runtime_use_autosuspend(kdev);
} }
...@@ -580,11 +591,14 @@ void intel_runtime_pm_enable(struct intel_runtime_pm *rpm) ...@@ -580,11 +591,14 @@ void intel_runtime_pm_enable(struct intel_runtime_pm *rpm)
void intel_runtime_pm_disable(struct intel_runtime_pm *rpm) void intel_runtime_pm_disable(struct intel_runtime_pm *rpm)
{ {
struct drm_i915_private *i915 = container_of(rpm,
struct drm_i915_private,
runtime_pm);
struct device *kdev = rpm->kdev; struct device *kdev = rpm->kdev;
/* Transfer rpm ownership back to core */ /* Transfer rpm ownership back to core */
WARN(pm_runtime_get_sync(kdev) < 0, drm_WARN(&i915->drm, pm_runtime_get_sync(kdev) < 0,
"Failed to pass rpm ownership back to core\n"); "Failed to pass rpm ownership back to core\n");
pm_runtime_dont_use_autosuspend(kdev); pm_runtime_dont_use_autosuspend(kdev);
...@@ -594,12 +608,15 @@ void intel_runtime_pm_disable(struct intel_runtime_pm *rpm) ...@@ -594,12 +608,15 @@ void intel_runtime_pm_disable(struct intel_runtime_pm *rpm)
void intel_runtime_pm_driver_release(struct intel_runtime_pm *rpm) void intel_runtime_pm_driver_release(struct intel_runtime_pm *rpm)
{ {
struct drm_i915_private *i915 = container_of(rpm,
struct drm_i915_private,
runtime_pm);
int count = atomic_read(&rpm->wakeref_count); int count = atomic_read(&rpm->wakeref_count);
WARN(count, drm_WARN(&i915->drm, count,
"i915 raw-wakerefs=%d wakelocks=%d on cleanup\n", "i915 raw-wakerefs=%d wakelocks=%d on cleanup\n",
intel_rpm_raw_wakeref_count(count), intel_rpm_raw_wakeref_count(count),
intel_rpm_wakelock_count(count)); intel_rpm_wakelock_count(count));
untrack_all_intel_runtime_pm_wakerefs(rpm); untrack_all_intel_runtime_pm_wakerefs(rpm);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment