[Intel-gfx] [PATCH 04/10] drm/i915/uc: Move intel_uc_fw_fetch() to intel_uc.c
Chris Wilson
chris at chris-wilson.co.uk
Thu Mar 2 16:36:05 UTC 2017
On Thu, Mar 02, 2017 at 05:03:48PM +0100, Arkadiusz Hiler wrote:
> The file fits better.
>
> Additionally rename it to intel_uc_prepare_fw(), as the function does
> more than simple fetch.
>
> v2: remove second declaration, reorder (M. Wajdeczko)
>
> Cc: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
> ---
> drivers/gpu/drm/i915/intel_guc_loader.c | 137 +-------------------------------
> drivers/gpu/drm/i915/intel_huc.c | 2 +-
> drivers/gpu/drm/i915/intel_uc.c | 135 +++++++++++++++++++++++++++++++
> drivers/gpu/drm/i915/intel_uc.h | 4 +-
> 4 files changed, 139 insertions(+), 139 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c
> index 9f09e26..20e3337 100644
> --- a/drivers/gpu/drm/i915/intel_guc_loader.c
> +++ b/drivers/gpu/drm/i915/intel_guc_loader.c
> @@ -26,7 +26,6 @@
> * Dave Gordon <david.s.gordon at intel.com>
> * Alex Dai <yu.dai at intel.com>
> */
> -#include <linux/firmware.h>
> #include "i915_drv.h"
> #include "intel_uc.h"
>
> +void intel_uc_prepare_fw(struct drm_i915_private *dev_priv,
> + struct intel_uc_fw *uc_fw)
> +{
> + struct pci_dev *pdev = dev_priv->drm.pdev;
> + struct drm_i915_gem_object *obj;
> + const struct firmware *fw = NULL;
> + struct uc_css_header *css;
> + size_t size;
> + int err;
...
> +
> + mutex_lock(&dev_priv->drm.struct_mutex);
> + obj = i915_gem_object_create_from_data(dev_priv, fw->data, fw->size);
> + mutex_unlock(&dev_priv->drm.struct_mutex);
> + if (IS_ERR_OR_NULL(obj)) {
> + err = obj ? PTR_ERR(obj) : -ENOMEM;
> + goto fail;
> + }
> +
> + uc_fw->obj = obj;
> + uc_fw->size = fw->size;
> +
> + DRM_DEBUG_DRIVER("uC fw fetch status SUCCESS, obj %p\n",
> + uc_fw->obj);
> +
> + release_firmware(fw);
> + uc_fw->fetch_status = INTEL_UC_FIRMWARE_SUCCESS;
> + return;
> +
> +fail:
> + DRM_WARN("Failed to fetch valid uC firmware from %s (error %d)\n",
> + uc_fw->path, err);
> + DRM_DEBUG_DRIVER("uC fw fetch status FAIL; err %d, fw %p, obj %p\n",
> + err, fw, uc_fw->obj);
> +
> + obj = fetch_and_zero(&uc_fw->obj);
> + if (obj)
> + i915_gem_object_put(obj);
I missed whether you fixed this in later patches, but uc_fw->obj can
never be set at this point.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list