drm/print: make drm_err_printer() device specific by using drm_err()
With few users for drm_err_printer(), it's still feasible to convert it to be device specific. Use drm_err() under the hood. While at it, make the prefix optional. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Luca Coelho <luciano.coelho@intel.com> Acked-by: Maxime Ripard <mripard@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/2a9cdcfc1df44568078f7c131e2e7e0f7c94e97e.1705410327.git.jani.nikula@intel.com
This commit is contained in:
parent
27b8f91c08
commit
5e0c04c8c4
@ -191,7 +191,12 @@ EXPORT_SYMBOL(__drm_printfn_debug);
|
||||
|
||||
void __drm_printfn_err(struct drm_printer *p, struct va_format *vaf)
|
||||
{
|
||||
pr_err("*ERROR* %s %pV", p->prefix, vaf);
|
||||
struct drm_device *drm = p->arg;
|
||||
|
||||
if (p->prefix)
|
||||
drm_err(drm, "%s %pV", p->prefix, vaf);
|
||||
else
|
||||
drm_err(drm, "%pV", vaf);
|
||||
}
|
||||
EXPORT_SYMBOL(__drm_printfn_err);
|
||||
|
||||
|
@ -122,7 +122,7 @@ static int __live_idle_pulse(struct intel_engine_cs *engine,
|
||||
GEM_BUG_ON(!llist_empty(&engine->barrier_tasks));
|
||||
|
||||
if (engine_sync_barrier(engine)) {
|
||||
struct drm_printer m = drm_err_printer("pulse");
|
||||
struct drm_printer m = drm_err_printer(&engine->i915->drm, "pulse");
|
||||
|
||||
pr_err("%s: no heartbeat pulse?\n", engine->name);
|
||||
intel_engine_dump(engine, &m, "%s", engine->name);
|
||||
@ -136,7 +136,7 @@ static int __live_idle_pulse(struct intel_engine_cs *engine,
|
||||
pulse_unlock_wait(p); /* synchronize with the retirement callback */
|
||||
|
||||
if (!i915_active_is_idle(&p->active)) {
|
||||
struct drm_printer m = drm_err_printer("pulse");
|
||||
struct drm_printer m = drm_err_printer(&engine->i915->drm, "pulse");
|
||||
|
||||
pr_err("%s: heartbeat pulse did not flush idle tasks\n",
|
||||
engine->name);
|
||||
|
@ -156,7 +156,7 @@ static int live_active_wait(void *arg)
|
||||
|
||||
__i915_active_wait(&active->base, TASK_UNINTERRUPTIBLE);
|
||||
if (!READ_ONCE(active->retired)) {
|
||||
struct drm_printer p = drm_err_printer(__func__);
|
||||
struct drm_printer p = drm_err_printer(&i915->drm, __func__);
|
||||
|
||||
pr_err("i915_active not retired after waiting!\n");
|
||||
i915_active_print(&active->base, &p);
|
||||
@ -189,7 +189,7 @@ static int live_active_retire(void *arg)
|
||||
err = -EIO;
|
||||
|
||||
if (!READ_ONCE(active->retired)) {
|
||||
struct drm_printer p = drm_err_printer(__func__);
|
||||
struct drm_printer p = drm_err_printer(&i915->drm, __func__);
|
||||
|
||||
pr_err("i915_active not retired after flushing!\n");
|
||||
i915_active_print(&active->base, &p);
|
||||
|
@ -35,6 +35,8 @@
|
||||
|
||||
#include <drm/drm.h>
|
||||
|
||||
struct drm_device;
|
||||
|
||||
/* Do *not* use outside of drm_print.[ch]! */
|
||||
extern unsigned long __drm_debug;
|
||||
|
||||
@ -235,16 +237,19 @@ static inline struct drm_printer drm_debug_printer(const char *prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_err_printer - construct a &drm_printer that outputs to pr_err()
|
||||
* @prefix: debug output prefix
|
||||
* drm_err_printer - construct a &drm_printer that outputs to drm_err()
|
||||
* @drm: the &struct drm_device pointer
|
||||
* @prefix: debug output prefix, or NULL for no prefix
|
||||
*
|
||||
* RETURNS:
|
||||
* The &drm_printer object
|
||||
*/
|
||||
static inline struct drm_printer drm_err_printer(const char *prefix)
|
||||
static inline struct drm_printer drm_err_printer(struct drm_device *drm,
|
||||
const char *prefix)
|
||||
{
|
||||
struct drm_printer p = {
|
||||
.printfn = __drm_printfn_err,
|
||||
.arg = drm,
|
||||
.prefix = prefix
|
||||
};
|
||||
return p;
|
||||
|
Loading…
x
Reference in New Issue
Block a user