diff options
| author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-08-15 10:48:49 +0100 |
|---|---|---|
| committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-08-15 11:00:56 +0100 |
| commit | 78ef2d9abad6da3f94489148b4e08359dd2fb4fe (patch) | |
| tree | 971f32e48f9b5773d5a2b1735650401de08c1f8a /tools/perf/scripts/python/net_dropmonitor.py | |
| parent | drm/i915: Create a VMA for an object (diff) | |
| download | linux-78ef2d9abad6da3f94489148b4e08359dd2fb4fe.tar.gz linux-78ef2d9abad6da3f94489148b4e08359dd2fb4fe.zip | |
drm/i915: Add fetch_and_zero() macro
A simple little macro to clear a pointer and return the old value. This
is useful for writing
value = *ptr;
if (!value)
return;
*ptr = 0;
...
free(value);
in a slightly more concise form:
value = fetch_and_zero(ptr);
if (!value)
return;
...
free(value);
with the idea that this establishes a pattern that may be extended for
atomic use (using xchg or cmpxchg) i.e. atomic_fetch_and_zero() and
similar to llist.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1471254551-25805-10-git-send-email-chris@chris-wilson.co.uk
Diffstat (limited to 'tools/perf/scripts/python/net_dropmonitor.py')
0 files changed, 0 insertions, 0 deletions
