From patchwork Thu Apr 5 09:18:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 10323905 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E68AB60545 for ; Thu, 5 Apr 2018 09:18:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D73402911B for ; Thu, 5 Apr 2018 09:18:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB7F729123; Thu, 5 Apr 2018 09:18:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73E3C2911B for ; Thu, 5 Apr 2018 09:18:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751956AbeDEJSj (ORCPT ); Thu, 5 Apr 2018 05:18:39 -0400 Received: from galahad.ideasonboard.com ([185.26.127.97]:54331 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751414AbeDEJSh (ORCPT ); Thu, 5 Apr 2018 05:18:37 -0400 Received: from avalon.bb.dnainternet.fi (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id 99EA220FC8; Thu, 5 Apr 2018 11:16:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1522919763; bh=LVjIxF/tqzGsKfFfCF/k7TSKjxPj/3OGp2nW6LCLOBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k1vQoEJYO8B2OZ2gU8JxFXTcuI/MtuntZV7FiOshXgNAurt0w1QttH+ycZ1jaEsVT f/V+crNsVR1Q7x83C46hl+j4eQEvK2jjWiWQmDKFafnOgVuz1+gc8tQ22aUJahiVRR npi8BqLUsUpwvJT+Vb+25ThX2cK3iZwpXO3lsw0M= From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, Kieran Bingham Subject: [PATCH v2 04/15] v4l: vsp1: Use vsp1_entity.pipe to check if entity belongs to a pipeline Date: Thu, 5 Apr 2018 12:18:29 +0300 Message-Id: <20180405091840.30728-5-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180405091840.30728-1-laurent.pinchart+renesas@ideasonboard.com> References: <20180405091840.30728-1-laurent.pinchart+renesas@ideasonboard.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The DRM pipeline handling code uses the entity's pipe list head to check whether the entity is already included in a pipeline. This method is a bit fragile in the sense that it uses list_empty() on a list_head that is a list member. Replace it by a simpler check for the entity pipe pointer. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- drivers/media/platform/vsp1/vsp1_drm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c index a7ad85ab0b08..e210917fdc3f 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.c +++ b/drivers/media/platform/vsp1/vsp1_drm.c @@ -119,9 +119,9 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int pipe_index, * Remove the RPF from the pipe and the list of BRU * inputs. */ - WARN_ON(list_empty(&rpf->entity.list_pipe)); + WARN_ON(!rpf->entity.pipe); rpf->entity.pipe = NULL; - list_del_init(&rpf->entity.list_pipe); + list_del(&rpf->entity.list_pipe); pipe->inputs[i] = NULL; bru->inputs[rpf->bru_input].rpf = NULL; @@ -537,7 +537,7 @@ void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index) continue; } - if (list_empty(&rpf->entity.list_pipe)) { + if (!rpf->entity.pipe) { rpf->entity.pipe = pipe; list_add_tail(&rpf->entity.list_pipe, &pipe->entities); } @@ -566,7 +566,7 @@ void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index) VI6_DPR_NODE_UNUSED); entity->pipe = NULL; - list_del_init(&entity->list_pipe); + list_del(&entity->list_pipe); continue; }