From patchwork Mon Oct 8 19:50:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 12052 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id D87EC23FB3 for ; Mon, 8 Oct 2012 19:51:32 +0000 (UTC) Received: from mail-pb0-f52.google.com (mail-pb0-f52.google.com [209.85.160.52]) by fiordland.canonical.com (Postfix) with ESMTP id 76613A18F34 for ; Mon, 8 Oct 2012 19:51:32 +0000 (UTC) Received: by mail-pb0-f52.google.com with SMTP id rr13so4871142pbb.11 for ; Mon, 08 Oct 2012 12:51:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :dkim-signature:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=UfLsBT0nziTfYyDf1iGXia/rwzee3IE6hslFwTUP7mc=; b=pVGnpE7xCjFmZrYDdszgVXhpIgM7DhrjdRiDRF0kUoHoNeCPjpK8+fj36I0/lcUci8 toXroefm/6G+FnGiAmQ/SV2lGhgWhSSY91ob1ZGOYuSptUnntM2eF+ZoqLa92WB/0jVr ZOVO1nrFbAaKdktnGz4+xl9Q277oVTWtJYAXkUkaLtBwqfPUzhzYwIKWp3c28X0emNWB 9LzQ/kgB/1zAsCs2m6Ofh4flMuQDI91eOoa2t2a4l5nok67ljBC9AbleN8sS4aTAXYX7 mfQqNgwzhG2Co6cxGFSgA16bFJ6sB+G5w0YjhRR8YyfBwFHc1QKonJd1EUP6S3bHj3i8 14Vg== Received: by 10.68.226.38 with SMTP id rp6mr57090898pbc.116.1349725892192; Mon, 08 Oct 2012 12:51:32 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.68.34.137 with SMTP id z9csp314538pbi; Mon, 8 Oct 2012 12:51:31 -0700 (PDT) Received: by 10.60.5.197 with SMTP id u5mr14618659oeu.129.1349725891235; Mon, 08 Oct 2012 12:51:31 -0700 (PDT) Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178]) by mx.google.com with ESMTPS id b5si4948733obl.208.2012.10.08.12.51.31 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 08 Oct 2012 12:51:31 -0700 (PDT) Received-SPF: pass (google.com: domain of robdclark@gmail.com designates 209.85.214.178 as permitted sender) client-ip=209.85.214.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of robdclark@gmail.com designates 209.85.214.178 as permitted sender) smtp.mail=robdclark@gmail.com; dkim=pass header.i=@gmail.com Received: by mail-ob0-f178.google.com with SMTP id tb18so4877681obb.37 for ; Mon, 08 Oct 2012 12:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=UfLsBT0nziTfYyDf1iGXia/rwzee3IE6hslFwTUP7mc=; b=pOuZ+1+cdrv3+z+5gyTDhYE/4Sf0Ije2DOzzB18l11lG735lJTpynjO9gyemESH7C/ BF1V7RTpTAr8S2f1ShNObKSBOCmVjSj2viHcwuTPxk9e/Uc3p379XDooX8ncW1lhWZM6 rq2+loE5PQ9sXKvW8okWz0rGjKiuChQHW4gz32e/poUaVOlTl1RhJ7GWl5xhVzY5QVjf ppM471LjzsgGGcvdVG3R/aeg0KatHkH0tFSGgS7F1rkdH4e+f2j/pgKSehwY6vINtGBZ 3/g2Ly8tpfhLlGmTD/nPjtFQR8tELEhYzG7wkYpBS0G4EFInmqBUrLOpdskVCzESNyMh 8rDw== Received: by 10.182.0.1 with SMTP id 1mr1012216oba.18.1349725890965; Mon, 08 Oct 2012 12:51:30 -0700 (PDT) Received: from localhost (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id fw9sm15901292obc.19.2012.10.08.12.51.29 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 08 Oct 2012 12:51:29 -0700 (PDT) Sender: Rob Clark From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: patches@linaro.org, airlied@linux.ie, daniel.vetter@ffwll.ch, bskeggs@redhat.com, inki.dae@samsung.com, laurent.pinchart@ideasonboard.com, s.hauer@pengutronix.de, gregkh@linuxfoundation.org, Rob Clark Subject: [PATCH 09/11] drm/imx: page flip fixes Date: Mon, 8 Oct 2012 14:50:47 -0500 Message-Id: <1349725849-22433-10-git-send-email-rob.clark@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1349725849-22433-1-git-send-email-rob.clark@linaro.org> References: <1349725849-22433-1-git-send-email-rob.clark@linaro.org> X-Gm-Message-State: ALoCoQkerG+mD1UYsbyLyQB1h3MGV88abUkX/Hb484kW9QXgFKJlNKC2mPGRHA4hmtCle1zk+4qV From: Rob Clark The 'event' could be null, so don't list_del(&event->base.link).. and in fact even if it wasn't null there is no reason to do this. Also, this looks racy with the irq handler, so throw in a spinlock for good measure. Signed-off-by: Rob Clark --- drivers/staging/imx-drm/ipuv3-crtc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c index 8fa0f4d..6745766 100644 --- a/drivers/staging/imx-drm/ipuv3-crtc.c +++ b/drivers/staging/imx-drm/ipuv3-crtc.c @@ -135,23 +135,26 @@ static int ipu_page_flip(struct drm_crtc *crtc, struct drm_pending_vblank_event *event) { struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc); + struct drm_device *drm = ipu_crtc->base.dev; + unsigned long flags; int ret; if (ipu_crtc->newfb) return -EBUSY; + spin_lock_irqsave(&drm->event_lock, flags); ret = imx_drm_crtc_vblank_get(ipu_crtc->imx_crtc); if (ret) { dev_dbg(ipu_crtc->dev, "failed to acquire vblank counter\n"); - list_del(&event->base.link); - - return ret; + goto out; } ipu_crtc->newfb = fb; ipu_crtc->page_flip_event = event; - return 0; +out: + spin_unlock_irqrestore(&drm->event_lock, flags); + return ret; } static const struct drm_crtc_funcs ipu_crtc_funcs = {