[PATCH 10/12] drm/i915: extract some common olr+wedge code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 26 Apr 2012 16:03:07 -0700, Ben Widawsky <ben at bwidawsk.net> wrote:
> +/*
> + * Compare seqno against outstanding lazy request. Emit a request if they are
> + * equal. Seqno is updated with the new value if a request was emitted.
> + */
> +static int
> +i915_gem_check_olr(struct intel_ring_buffer *ring, u32 *seqno)
> +{
> +	int ret = 0;
> +
> +	BUG_ON(!mutex_is_locked(&ring->dev->struct_mutex));
> +
> +	if (*seqno == ring->outstanding_lazy_request) {
> +		struct drm_i915_gem_request *request;
> +
> +		request = kzalloc(sizeof(*request), GFP_KERNEL);
> +		if (request == NULL)
> +			return -ENOMEM;
> +
> +		ret = i915_add_request(ring, NULL, request);
> +		if (ret) {
> +			kfree(request);
> +			return ret;
> +		}
> +
> +		*seqno = request->seqno;
I'd love for this to be BUG_ON(seqno != request->seqno) and so drop the
out parameter, as it would tidy all the callers up.
> +	}
> +
> +	return ret;
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux