]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/uc: Unify initialization of the uC firmware helper
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Wed, 4 Oct 2017 18:13:43 +0000 (18:13 +0000)
committerJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Fri, 6 Oct 2017 06:37:24 +0000 (09:37 +0300)
Unify initialization of the uC firmware helper as we want to
maximize code reuse.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171004181343.66348-6-michal.wajdeczko@intel.com
drivers/gpu/drm/i915/intel_guc_loader.c
drivers/gpu/drm/i915/intel_huc.c
drivers/gpu/drm/i915/intel_uc_fw.h

index c9e25be4db406be2b4e5a1c17f4c3abe2e7998f7..c7a800a3798dd2c43c721dd9222dfe4ffb744168 100644 (file)
@@ -386,10 +386,7 @@ int intel_guc_select_fw(struct intel_guc *guc)
 {
        struct drm_i915_private *dev_priv = guc_to_i915(guc);
 
-       guc->fw.path = NULL;
-       guc->fw.fetch_status = INTEL_UC_FIRMWARE_NONE;
-       guc->fw.load_status = INTEL_UC_FIRMWARE_NONE;
-       guc->fw.type = INTEL_UC_FW_TYPE_GUC;
+       intel_uc_fw_init(&guc->fw, INTEL_UC_FW_TYPE_GUC);
 
        if (i915_modparams.guc_firmware_path) {
                guc->fw.path = i915_modparams.guc_firmware_path;
index 8b4b5352542281ef3c78c963cfd39f5dadac8b4f..3f796fed35afdc9b3db7f155aef764ea584c8f0b 100644 (file)
@@ -150,10 +150,7 @@ void intel_huc_select_fw(struct intel_huc *huc)
 {
        struct drm_i915_private *dev_priv = huc_to_i915(huc);
 
-       huc->fw.path = NULL;
-       huc->fw.fetch_status = INTEL_UC_FIRMWARE_NONE;
-       huc->fw.load_status = INTEL_UC_FIRMWARE_NONE;
-       huc->fw.type = INTEL_UC_FW_TYPE_HUC;
+       intel_uc_fw_init(&huc->fw, INTEL_UC_FW_TYPE_HUC);
 
        if (i915_modparams.huc_firmware_path) {
                huc->fw.path = i915_modparams.huc_firmware_path;
index 849b2ce685c0fe6efadfcabfdbc7f680d7e06a38..fcaf597183009a23f018d26fdde294d5d575cb00 100644 (file)
@@ -91,6 +91,15 @@ static inline const char *intel_uc_fw_type_repr(enum intel_uc_fw_type type)
        return "uC";
 }
 
+static inline
+void intel_uc_fw_init(struct intel_uc_fw *uc_fw, enum intel_uc_fw_type type)
+{
+       uc_fw->path = NULL;
+       uc_fw->fetch_status = INTEL_UC_FIRMWARE_NONE;
+       uc_fw->load_status = INTEL_UC_FIRMWARE_NONE;
+       uc_fw->type = type;
+}
+
 void intel_uc_fw_fetch(struct drm_i915_private *dev_priv,
                       struct intel_uc_fw *uc_fw);
 void intel_uc_fw_fini(struct intel_uc_fw *uc_fw);