From patchwork Mon Feb 26 21:45:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 10243601 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 8BBB560386 for ; Mon, 26 Feb 2018 21:44:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7601E29B40 for ; Mon, 26 Feb 2018 21:44:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6AB3129B72; Mon, 26 Feb 2018 21:44:53 +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 0B83229B4D for ; Mon, 26 Feb 2018 21:44:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751813AbeBZVov (ORCPT ); Mon, 26 Feb 2018 16:44:51 -0500 Received: from galahad.ideasonboard.com ([185.26.127.97]:54328 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751518AbeBZVot (ORCPT ); Mon, 26 Feb 2018 16:44:49 -0500 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 883D9203A0; Mon, 26 Feb 2018 22:42:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1519681376; bh=OawD+4Zl2x8ZBLxsyb4yfMZkwYHL1wI3lJSlLu4xSyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k5tdMSocxg0YsJ1bAQlilu6UWmnwDQvSuzJgjM0pIhUBNi4W/JqeBNSZ1pvZR2O1w LT67tGvmWmirrFKmTSFT/9Bn9nrp09vF0oMdHzwsvlPxh3+jrGFzGVoVxvVmAIyNyw sOExyrhRJj6z7ijxeEN8RYJ7P2kf8hVs0boGrvpo= 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 05/15] v4l: vsp1: Use vsp1_entity.pipe to check if entity belongs to a pipeline Date: Mon, 26 Feb 2018 23:45:06 +0200 Message-Id: <20180226214516.11559-6-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180226214516.11559-1-laurent.pinchart+renesas@ideasonboard.com> References: <20180226214516.11559-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; }