[RFC 0/2] PM guard classes

Michal Wajdeczko michal.wajdeczko at intel.com
Mon Jun 17 14:01:18 UTC 2024


There is support for 'classes' with constructor and destructor
semantics that can be used for scope-based resource management,
like our device power management.

Use provided macros from linux/cleanup.h to generate required
code definitions.

This should allow us to use:

	scoped_guard(xe_pm, xe)
		foo();
or
	CLASS(xe_pm, var)(xe);

without any concern of leaking the pm reference.

Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
Cc: Lucas De Marchi <lucas.demarchi at intel.com>

Michal Wajdeczko (2):
  drm/xe: Introduce PM guard classes
  drm/xe: Use new PM guard in xe_gt_debugfs.c

 drivers/gpu/drm/xe/xe_gt_debugfs.c | 91 +++++++++++-------------------
 drivers/gpu/drm/xe/xe_pm.h         |  5 ++
 2 files changed, 39 insertions(+), 57 deletions(-)

-- 
2.43.0



More information about the Intel-xe mailing list