From patchwork Tue Oct 3 03:53:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Rowand X-Patchwork-Id: 9981857 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 51E2860291 for ; Tue, 3 Oct 2017 07:19:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 447D3286BE for ; Tue, 3 Oct 2017 07:19:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38DC02872B; Tue, 3 Oct 2017 07:19:39 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BFD55286BE for ; Tue, 3 Oct 2017 07:19:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3D2CB6E3C5; Tue, 3 Oct 2017 07:19:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf0-x242.google.com (mail-pf0-x242.google.com [IPv6:2607:f8b0:400e:c00::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0D2036E254 for ; Tue, 3 Oct 2017 03:54:12 +0000 (UTC) Received: by mail-pf0-x242.google.com with SMTP id i23so7681516pfi.2 for ; Mon, 02 Oct 2017 20:54:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cvaQEQDg3A1vcMMvRHTCyjivZ3Yd86XbWm749CXkCA4=; b=fWHH/GLwQ/tNi/p59ZszIIyXorQi6+dtUrTCTuLH7Sf+ryOV+bwJhLDPXKXjiA+6rP bCQEXUgW6ARn5lTOv6zhGkLYOHIscKzCW5YJCMQhPcQL4MKbgzdBgMipqnUK3sWvOLPo a1vvf9mhaLD4iL2bAGz0uZwmpWPSK1AEykiKa2NMAlGQqO4IBFdQvGcyBHcstNiPaBYT 2NByFQO4NpGHLqs/Dobj2DCSY9OElymf7S7ETMcUgyBq9ZM09IjzEHrFeRL6ftoj1g60 DoK76uaD6f44tIZHPdrzV6H6T5pQxZM82/aTmAoDxMm/sBvIkHx4y9R4WpCdkCXoTSyM TLWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cvaQEQDg3A1vcMMvRHTCyjivZ3Yd86XbWm749CXkCA4=; b=hTCswX2ZeyIfGDuUIT8qpVVKy6pmd1eI/r86Koinr/smd9uasRe1ZkEqhm5Wid7N1S MsrlYzPof8uPH5ImXLYhgoTzmU9kW38MH0+LL0n8L2DAhOytiTCvKXtIWl4y2/Gj021X JOh2ZK85TbzahgktpM1RktySbN1VlJXadJB6P2AVneDoFL/zIoL3FyBjYdQHLQlPXY31 JG/AQlziA1FBBOqqetM/O997rgQKc2PslXho/8CdqJz1SY4TjScVP6YfYi8Sn5uaMMY0 gNAZBQ8OJqcXgfBSIYuvVtMgt0ivvVwvqoBW+hoSp7ZY79LDVd9wOGobY96O+IB57VwT jU8A== X-Gm-Message-State: AMCzsaWd0bfsNfThy12+uzDU6kAalhal62n6FEMGmns7BBDPQiWU/2Qe /wjsCtYMBWbfhvfBMQCQlbM= X-Google-Smtp-Source: AOwi7QBsY7qlgYMrfSBng+52y1akxUQqkiaEiORbs0JXUnu3h1yX65ert1SYOC11h/t96m78SyEgpw== X-Received: by 10.99.1.7 with SMTP id 7mr605555pgb.251.1507002851717; Mon, 02 Oct 2017 20:54:11 -0700 (PDT) Received: from localhost.localdomain (c-73-93-215-6.hsd1.ca.comcast.net. [73.93.215.6]) by smtp.gmail.com with ESMTPSA id c16sm18609930pfj.123.2017.10.02.20.54.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Oct 2017 20:54:11 -0700 (PDT) From: frowand.list@gmail.com To: Rob Herring , Pantelis Antoniou , David Airlie , Jyri Sarha Subject: [PATCH 07/12] of: overlay: expand check of whether overlay changeset can be removed Date: Mon, 2 Oct 2017 20:53:41 -0700 Message-Id: <1507002826-16393-8-git-send-email-frowand.list@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1507002826-16393-1-git-send-email-frowand.list@gmail.com> References: <1507002826-16393-1-git-send-email-frowand.list@gmail.com> X-Mailman-Approved-At: Tue, 03 Oct 2017 07:19:35 +0000 Cc: Mark Rutland , devicetree@vger.kernel.org, Tomi Valkeinen , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Frank Rowand The test of whether it is safe to remove an overlay changeset looked at whether any node in the overlay changeset was in a subtree rooted at any more recently applied overlay changeset node. The test failed to determine whether any node in the overlay changeset was the root of a subtree that contained a more recently applied overlay changeset node. Add this additional check to the test. The test is still lacking any check for any phandle dependencies. Signed-off-by: Frank Rowand --- drivers/of/overlay.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index c7526186b1c8..015d8b112f60 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -698,13 +698,13 @@ static int find_node(struct device_node *tree, struct device_node *np) } /* - * Is @remove_ce_np a child of or the same as any + * Is @remove_ce_node a child of, a parent of, or the same as any * node in an overlay changeset more topmost than @remove_ovcs? * * Returns 1 if found, else 0 */ -static int node_in_later_cs(struct overlay_changeset *remove_ovcs, - struct device_node *remove_ce_np) +static int node_overlaps_later_cs(struct overlay_changeset *remove_ovcs, + struct device_node *remove_ce_node) { struct overlay_changeset *ovcs; struct of_changeset_entry *ce; @@ -714,10 +714,16 @@ static int node_in_later_cs(struct overlay_changeset *remove_ovcs, break; list_for_each_entry(ce, &ovcs->cset.entries, node) { - if (find_node(ce->np, remove_ce_np)) { - pr_err("%s: #%d clashes #%d @%pOF\n", + if (find_node(ce->np, remove_ce_node)) { + pr_err("%s: #%d overlaps with #%d @%pOF\n", __func__, remove_ovcs->id, ovcs->id, - remove_ce_np); + remove_ce_node); + return 1; + } + if (find_node(remove_ce_node, ce->np)) { + pr_err("%s: #%d overlaps with #%d @%pOF\n", + __func__, remove_ovcs->id, ovcs->id, + remove_ce_node); return 1; } } @@ -741,7 +747,7 @@ static int overlay_removal_is_ok(struct overlay_changeset *remove_ovcs) struct of_changeset_entry *remove_ce; list_for_each_entry(remove_ce, &remove_ovcs->cset.entries, node) { - if (node_in_later_cs(remove_ovcs, remove_ce->np)) { + if (node_overlaps_later_cs(remove_ovcs, remove_ce->np)) { pr_err("overlay #%d is not topmost\n", remove_ovcs->id); return 0; }