diff options
Diffstat (limited to 'drivers/gpu/drm/i915/intel_guc_log.c')
| -rw-r--r-- | drivers/gpu/drm/i915/intel_guc_log.c | 32 | 
1 files changed, 17 insertions, 15 deletions
| diff --git a/drivers/gpu/drm/i915/intel_guc_log.c b/drivers/gpu/drm/i915/intel_guc_log.c index d3ebdbc0182e..806fdfd7c78a 100644 --- a/drivers/gpu/drm/i915/intel_guc_log.c +++ b/drivers/gpu/drm/i915/intel_guc_log.c @@ -140,6 +140,9 @@ static struct dentry *create_buf_file_callback(const char *filename,  	buf_file = debugfs_create_file(filename, mode,  				       parent, buf, &relay_file_operations); +	if (IS_ERR(buf_file)) +		return NULL; +  	return buf_file;  } @@ -436,6 +439,7 @@ static void guc_log_capture_logs(struct intel_guc_log *log)  {  	struct intel_guc *guc = log_to_guc(log);  	struct drm_i915_private *dev_priv = guc_to_i915(guc); +	intel_wakeref_t wakeref;  	guc_read_update_log_buffer(log); @@ -443,9 +447,8 @@ static void guc_log_capture_logs(struct intel_guc_log *log)  	 * Generally device is expected to be active only at this  	 * time, so get/put should be really quick.  	 */ -	intel_runtime_pm_get(dev_priv); -	guc_action_flush_log_complete(guc); -	intel_runtime_pm_put(dev_priv); +	with_intel_runtime_pm(dev_priv, wakeref) +		guc_action_flush_log_complete(guc);  }  int intel_guc_log_create(struct intel_guc_log *log) @@ -505,7 +508,8 @@ int intel_guc_log_set_level(struct intel_guc_log *log, u32 level)  {  	struct intel_guc *guc = log_to_guc(log);  	struct drm_i915_private *dev_priv = guc_to_i915(guc); -	int ret; +	intel_wakeref_t wakeref; +	int ret = 0;  	BUILD_BUG_ON(GUC_LOG_VERBOSITY_MIN != 0);  	GEM_BUG_ON(!log->vma); @@ -519,16 +523,14 @@ int intel_guc_log_set_level(struct intel_guc_log *log, u32 level)  	mutex_lock(&dev_priv->drm.struct_mutex); -	if (log->level == level) { -		ret = 0; +	if (log->level == level)  		goto out_unlock; -	} -	intel_runtime_pm_get(dev_priv); -	ret = guc_action_control_log(guc, GUC_LOG_LEVEL_IS_VERBOSE(level), -				     GUC_LOG_LEVEL_IS_ENABLED(level), -				     GUC_LOG_LEVEL_TO_VERBOSITY(level)); -	intel_runtime_pm_put(dev_priv); +	with_intel_runtime_pm(dev_priv, wakeref) +		ret = guc_action_control_log(guc, +					     GUC_LOG_LEVEL_IS_VERBOSE(level), +					     GUC_LOG_LEVEL_IS_ENABLED(level), +					     GUC_LOG_LEVEL_TO_VERBOSITY(level));  	if (ret) {  		DRM_DEBUG_DRIVER("guc_log_control action failed %d\n", ret);  		goto out_unlock; @@ -601,6 +603,7 @@ void intel_guc_log_relay_flush(struct intel_guc_log *log)  {  	struct intel_guc *guc = log_to_guc(log);  	struct drm_i915_private *i915 = guc_to_i915(guc); +	intel_wakeref_t wakeref;  	/*  	 * Before initiating the forceful flush, wait for any pending/ongoing @@ -608,9 +611,8 @@ void intel_guc_log_relay_flush(struct intel_guc_log *log)  	 */  	flush_work(&log->relay.flush_work); -	intel_runtime_pm_get(i915); -	guc_action_flush_log(guc); -	intel_runtime_pm_put(i915); +	with_intel_runtime_pm(i915, wakeref) +		guc_action_flush_log(guc);  	/* GuC would have updated log buffer by now, so capture it */  	guc_log_capture_logs(log); | 
