Move the code around in order to acquire and release the spinlock in the
same function and in the same block. This keeps static analysers happy
and the reader sane.
Suggested-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-static void invalidate_range__linear(struct i915_mmu_notifier *mn,
- struct mm_struct *mm,
- unsigned long start,
- unsigned long end)
+static void *invalidate_range__linear(struct i915_mmu_notifier *mn,
+ struct mm_struct *mm,
+ unsigned long start,
+ unsigned long end)
{
struct i915_mmu_object *mmu;
unsigned long serial;
{
struct i915_mmu_object *mmu;
unsigned long serial;
- spin_unlock(&mn->lock);
}
static void i915_gem_userptr_mn_invalidate_range_start(struct mmu_notifier *_mn,
}
static void i915_gem_userptr_mn_invalidate_range_start(struct mmu_notifier *_mn,
end--; /* interval ranges are inclusive, but invalidate range is exclusive */
while (next < end) {
end--; /* interval ranges are inclusive, but invalidate range is exclusive */
while (next < end) {
- struct drm_i915_gem_object *obj;
+ struct drm_i915_gem_object *obj = NULL;
spin_lock(&mn->lock);
if (mn->has_linear)
spin_lock(&mn->lock);
if (mn->has_linear)
- return invalidate_range__linear(mn, mm, start, end);
- if (serial == mn->serial)
+ it = invalidate_range__linear(mn, mm, start, end);
+ else if (serial == mn->serial)
it = interval_tree_iter_next(it, next, end);
else
it = interval_tree_iter_first(&mn->objects, start, end);
it = interval_tree_iter_next(it, next, end);
else
it = interval_tree_iter_first(&mn->objects, start, end);