diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2017-07-07 15:55:45 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2017-12-08 12:17:19 +0000 |
commit | 901bb88991654537a35ca1da5709ac4bf3a2d01e (patch) | |
tree | e7ee5fd97661eece9c189cdfa410fae569a78bc5 | |
parent | d3b842154383a037cd38cd7e31234c3723c1f31d (diff) | |
download | linux-901bb88991654537a35ca1da5709ac4bf3a2d01e.tar.bz2 |
drm/armada: add a common frame work allocator
Add and use a common frame work allocator, initialising the frame work
to a sane state.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r-- | drivers/gpu/drm/armada/armada_crtc.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c index 7d2dfdfffb5e..8606f6e35986 100644 --- a/drivers/gpu/drm/armada/armada_crtc.c +++ b/drivers/gpu/drm/armada/armada_crtc.c @@ -293,6 +293,21 @@ static void armada_drm_crtc_complete_frame_work(struct armada_crtc *dcrtc, kfree(fwork); } +static struct armada_frame_work *armada_drm_crtc_alloc_frame_work(void) +{ + struct armada_frame_work *work; + int i = 0; + + work = kzalloc(sizeof(*work), GFP_KERNEL); + if (!work) + return NULL; + + work->work.fn = armada_drm_crtc_complete_frame_work; + armada_reg_queue_end(work->regs, i); + + return work; +} + static void armada_drm_crtc_finish_fb(struct armada_crtc *dcrtc, struct drm_framebuffer *fb, bool force) { @@ -307,13 +322,9 @@ static void armada_drm_crtc_finish_fb(struct armada_crtc *dcrtc, return; } - work = kmalloc(sizeof(*work), GFP_KERNEL); + work = armada_drm_crtc_alloc_frame_work(); if (work) { - int i = 0; - work->work.fn = armada_drm_crtc_complete_frame_work; - work->event = NULL; work->old_fb = fb; - armada_reg_queue_end(work->regs, i); if (armada_drm_crtc_queue_frame_work(dcrtc, work) == 0) return; @@ -1033,11 +1044,10 @@ static int armada_drm_crtc_page_flip(struct drm_crtc *crtc, if (fb->format != crtc->primary->fb->format) return -EINVAL; - work = kmalloc(sizeof(*work), GFP_KERNEL); + work = armada_drm_crtc_alloc_frame_work(); if (!work) return -ENOMEM; - work->work.fn = armada_drm_crtc_complete_frame_work; work->event = event; work->old_fb = dcrtc->crtc.primary->fb; |