[PATCH 08/20] drm/armada: use xchg() to atomically update dplane->old_fb

Emil Velikov emil.l.velikov at gmail.com
Wed Sep 30 03:49:44 PDT 2015


Hi Russell,

On 29 September 2015 at 19:10, Russell King <rmk+kernel at arm.linux.org.uk> wrote:
> Rather than using a spinlock, use xchg() to atomically update
> dplane->old_fb.  This allows us to eliminate dplane->lock.
>
> Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
> ---
[...]
> @@ -76,13 +75,10 @@ static void armada_ovl_retire_fb(struct armada_ovl_plane *dplane,
>  {
>         struct drm_framebuffer *old_fb;
>
> -       spin_lock(&dplane->lock);
> -       old_fb = dplane->old_fb;
> -       dplane->old_fb = fb;
> -       spin_unlock(&dplane->lock);
> +       old_fb = xchg(&dplane->old_fb, fb);
>
>         if (old_fb)
> -               armada_drm_queue_unref_work(dplane->base.dev, old_fb);
> +               armada_drm_queue_unref_work(dplane->base.base.dev, old_fb);
Shouldn't this be part of another patch ?

-Emil


More information about the dri-devel mailing list