Re: [Intel-gfx] [PATCH] drm/i915/guc: Update syntax of GuC log functions

2018-03-14 Thread Michał Winiarski
On Tue, Mar 13, 2018 at 12:26:37PM +, Michal Wajdeczko wrote:
> We moved GuC log related data and code to separate files and
> definition but we didn't change functions syntax to follow
> object-verb pattern. Let's fix that before we continue with
> next round of code refactoring.
> 
> Signed-off-by: Michal Wajdeczko 
> Cc: Michal Winiarski 
> Cc: Chris Wilson 

Reviewed-by: Michał Winiarski 

-Michał

> ---
>  drivers/gpu/drm/i915/i915_debugfs.c  |   4 +-
>  drivers/gpu/drm/i915/intel_guc.c |   8 +-
>  drivers/gpu/drm/i915/intel_guc_log.c | 203 
> +++
>  drivers/gpu/drm/i915/intel_guc_log.h |  18 ++--
>  drivers/gpu/drm/i915/intel_uc.c  |   4 +-
>  5 files changed, 126 insertions(+), 111 deletions(-)
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm/i915/guc: Update syntax of GuC log functions

2018-03-13 Thread Michal Wajdeczko
We moved GuC log related data and code to separate files and
definition but we didn't change functions syntax to follow
object-verb pattern. Let's fix that before we continue with
next round of code refactoring.

Signed-off-by: Michal Wajdeczko 
Cc: Michal Winiarski 
Cc: Chris Wilson 
---
 drivers/gpu/drm/i915/i915_debugfs.c  |   4 +-
 drivers/gpu/drm/i915/intel_guc.c |   8 +-
 drivers/gpu/drm/i915/intel_guc_log.c | 203 +++
 drivers/gpu/drm/i915/intel_guc_log.h |  18 ++--
 drivers/gpu/drm/i915/intel_uc.c  |   4 +-
 5 files changed, 126 insertions(+), 111 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index 0eac7dc..904f02b 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2502,7 +2502,7 @@ static int i915_guc_log_control_get(void *data, u64 *val)
if (!USES_GUC(dev_priv))
return -ENODEV;
 
-   *val = intel_guc_log_control_get(&dev_priv->guc);
+   *val = intel_guc_log_control_get(&dev_priv->guc.log);
 
return 0;
 }
@@ -2514,7 +2514,7 @@ static int i915_guc_log_control_set(void *data, u64 val)
if (!USES_GUC(dev_priv))
return -ENODEV;
 
-   return intel_guc_log_control_set(&dev_priv->guc, val);
+   return intel_guc_log_control_set(&dev_priv->guc.log, val);
 }
 
 DEFINE_SIMPLE_ATTRIBUTE(i915_guc_log_control_fops,
diff --git a/drivers/gpu/drm/i915/intel_guc.c b/drivers/gpu/drm/i915/intel_guc.c
index 25f9229..099aa62 100644
--- a/drivers/gpu/drm/i915/intel_guc.c
+++ b/drivers/gpu/drm/i915/intel_guc.c
@@ -64,7 +64,7 @@ void intel_guc_init_early(struct intel_guc *guc)
 {
intel_guc_fw_init_early(guc);
intel_guc_ct_init_early(&guc->ct);
-   intel_guc_log_init_early(guc);
+   intel_guc_log_init_early(&guc->log);
 
mutex_init(&guc->send_mutex);
guc->send = intel_guc_send_nop;
@@ -169,7 +169,7 @@ int intel_guc_init(struct intel_guc *guc)
return ret;
GEM_BUG_ON(!guc->shared_data);
 
-   ret = intel_guc_log_create(guc);
+   ret = intel_guc_log_create(&guc->log);
if (ret)
goto err_shared;
 
@@ -184,7 +184,7 @@ int intel_guc_init(struct intel_guc *guc)
return 0;
 
 err_log:
-   intel_guc_log_destroy(guc);
+   intel_guc_log_destroy(&guc->log);
 err_shared:
guc_shared_data_destroy(guc);
return ret;
@@ -196,7 +196,7 @@ void intel_guc_fini(struct intel_guc *guc)
 
i915_ggtt_disable_guc(dev_priv);
intel_guc_ads_destroy(guc);
-   intel_guc_log_destroy(guc);
+   intel_guc_log_destroy(&guc->log);
guc_shared_data_destroy(guc);
 }
 
diff --git a/drivers/gpu/drm/i915/intel_guc_log.c 
b/drivers/gpu/drm/i915/intel_guc_log.c
index 90b395f..b94443c 100644
--- a/drivers/gpu/drm/i915/intel_guc_log.c
+++ b/drivers/gpu/drm/i915/intel_guc_log.c
@@ -22,13 +22,10 @@
  *
  */
 
-#include 
-#include 
-
 #include "intel_guc_log.h"
 #include "i915_drv.h"
 
-static void guc_log_capture_logs(struct intel_guc *guc);
+static void guc_log_capture_logs(struct intel_guc_log *log);
 
 /**
  * DOC: GuC firmware log
@@ -74,6 +71,11 @@ static int guc_log_control(struct intel_guc *guc, bool 
enable, u32 verbosity)
return intel_guc_send(guc, action, ARRAY_SIZE(action));
 }
 
+static inline struct intel_guc *log_to_guc(struct intel_guc_log *log)
+{
+   return container_of(log, struct intel_guc, log);
+}
+
 /*
  * Sub buffer switch callback. Called whenever relay has to switch to a new
  * sub buffer, relay stays on the same sub buffer if 0 is returned.
@@ -149,8 +151,9 @@ static int remove_buf_file_callback(struct dentry *dentry)
.remove_buf_file = remove_buf_file_callback,
 };
 
-static int guc_log_relay_file_create(struct intel_guc *guc)
+static int guc_log_relay_file_create(struct intel_guc_log *log)
 {
+   struct intel_guc *guc = log_to_guc(log);
struct drm_i915_private *dev_priv = guc_to_i915(guc);
struct dentry *log_dir;
int ret;
@@ -158,7 +161,7 @@ static int guc_log_relay_file_create(struct intel_guc *guc)
if (!i915_modparams.guc_log_level)
return 0;
 
-   mutex_lock(&guc->log.runtime.relay_lock);
+   mutex_lock(&log->runtime.relay_lock);
 
/* For now create the log file in /sys/kernel/debug/dri/0 dir */
log_dir = dev_priv->drm.primary->debugfs_root;
@@ -181,7 +184,8 @@ static int guc_log_relay_file_create(struct intel_guc *guc)
goto out_unlock;
}
 
-   ret = relay_late_setup_files(guc->log.runtime.relay_chan, "guc_log", 
log_dir);
+   ret = relay_late_setup_files(log->runtime.relay_chan, "guc_log",
+log_dir);
if (ret < 0 && ret != -EEXIST) {
DRM_ERROR("Couldn't associate relay chan with file %d\n", ret);
goto out_unlock;
@@ -190,18 +194,18 @@ static int guc_log_relay_file_create(struct int