aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma-buf/sw_sync.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-06-29 13:59:27 +0100
committerGustavo Padovan <gustavo.padovan@collabora.com>2017-06-29 18:52:19 -0300
commita6aa8fca4d792c72947e341d7842d2f700534335 (patch)
tree2c7ec852941c833728e8badb2c2c70e4b2b66e50 /drivers/dma-buf/sw_sync.c
parentdma-buf/sw-sync: Prevent user overflow on timeline advance (diff)
downloadlinux-dev-a6aa8fca4d792c72947e341d7842d2f700534335.tar.xz
linux-dev-a6aa8fca4d792c72947e341d7842d2f700534335.zip
dma-buf/sw-sync: Reduce irqsave/irqrestore from known context
If we know the context under which we are called, then we can use the simpler form of spin_lock_irq (saving the save/restore). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Sumit Semwal <sumit.semwal@linaro.org> Cc: Sean Paul <seanpaul@chromium.org> Cc: Gustavo Padovan <gustavo@padovan.org> Reviewed-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170629125930.821-4-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/dma-buf/sw_sync.c')
-rw-r--r--drivers/dma-buf/sw_sync.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/dma-buf/sw_sync.c b/drivers/dma-buf/sw_sync.c
index 0e676d08aa70..fc733621987d 100644
--- a/drivers/dma-buf/sw_sync.c
+++ b/drivers/dma-buf/sw_sync.c
@@ -135,12 +135,11 @@ static void sync_timeline_put(struct sync_timeline *obj)
*/
static void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc)
{
- unsigned long flags;
struct sync_pt *pt, *next;
trace_sync_timeline(obj);
- spin_lock_irqsave(&obj->child_list_lock, flags);
+ spin_lock_irq(&obj->child_list_lock);
obj->value += inc;
@@ -150,7 +149,7 @@ static void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc)
list_del_init(&pt->active_list);
}
- spin_unlock_irqrestore(&obj->child_list_lock, flags);
+ spin_unlock_irq(&obj->child_list_lock);
}
/**
@@ -167,7 +166,6 @@ static void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc)
static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size,
unsigned int value)
{
- unsigned long flags;
struct sync_pt *pt;
if (size < sizeof(*pt))
@@ -177,13 +175,16 @@ static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size,
if (!pt)
return NULL;
- spin_lock_irqsave(&obj->child_list_lock, flags);
+ spin_lock_irq(&obj->child_list_lock);
+
sync_timeline_get(obj);
dma_fence_init(&pt->base, &timeline_fence_ops, &obj->child_list_lock,
obj->context, value);
list_add_tail(&pt->child_list, &obj->child_list_head);
INIT_LIST_HEAD(&pt->active_list);
- spin_unlock_irqrestore(&obj->child_list_lock, flags);
+
+ spin_unlock_irq(&obj->child_list_lock);
+
return pt;
}
@@ -206,9 +207,11 @@ static void timeline_fence_release(struct dma_fence *fence)
unsigned long flags;
spin_lock_irqsave(fence->lock, flags);
+
list_del(&pt->child_list);
if (!list_empty(&pt->active_list))
list_del(&pt->active_list);
+
spin_unlock_irqrestore(fence->lock, flags);
sync_timeline_put(parent);