From patchwork Tue Oct 17 01:17:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Rowand X-Patchwork-Id: 10011037 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 1130360211 for ; Tue, 17 Oct 2017 07:39:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 027E22876A for ; Tue, 17 Oct 2017 07:39:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB5AF2877C; Tue, 17 Oct 2017 07:39:03 +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 E1999287A9 for ; Tue, 17 Oct 2017 07:39:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C47B56E597; Tue, 17 Oct 2017 07:36:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf0-x243.google.com (mail-pf0-x243.google.com [IPv6:2607:f8b0:400e:c00::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6038D6E56E for ; Tue, 17 Oct 2017 01:18:15 +0000 (UTC) Received: by mail-pf0-x243.google.com with SMTP id t188so113061pfd.10 for ; Mon, 16 Oct 2017 18:18:15 -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=jisi42HNj6wD1BuzM83o9/YIJY5inhyNQmMZn9B1/kv/AIq+Pl3g5ah+U8T4Mz2+7e AgMNSQ1tRGe7KGPzoromQOlc48AV9bWLeHgHiGw4lYW6xEz2eBIYCD+90iMyvx4lHceR oE7MtmEScXHnC1d01cVhWza4VtoevRAQMg9uYQ15k0Lpo9L/U461C52GVdtX3mWnafBN pDsYMsqxBeKEBWq9tyN2SxCWoGz+HEcENX0DNsG1Jc/bda84h8A3VKEC0IeS9SdIW7Na wIS4AyvEOt5pt9QZFRGod+9rAVxk/5BE40tAFnbVZFjRihlGqaLtfkySS5CKMP2pKgJ6 yUtQ== 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=cn9F1tXfOT/HDE5gdzWUIBDezgYUC1oOIrf3tqVnuLywI90UnS6Hyg8foiAkH1Xdqv TXy68wxPkueXkEUzd/AOzNzypmzBtmzUGO2kp5p0TcbMsOmOcnHYVFlJc0FV64ID9my2 Tf2p8Nh1qHfulVJpI6C9uHrOLCbEx4NjAUBAqYD0851suXbaj6k3I+htDTtjmEpIwhTb U4WabL7Ot11W6DdX0hPJIvnCMu+8rnORcZzb9Lp7vEB432UGxl+52gGVpDoOAFZEBjxm 3cDRNivL5OviQUEfsexwtN4ZzM5krsqzKrq/FiOJcLdFX4lmg48gyZGsozNicoNT0R1W xk7w== X-Gm-Message-State: AMCzsaV+TrEqhHx9skwmfsF5eYOf9dFROUpXln/NKw0SwXHS1DaL4MRO 6vhgdWkqPv+KAc1g5TVCii4= X-Google-Smtp-Source: AOwi7QAbP6mqRbNL4Z4MhCUu1Nczi7Dt7W4p8KXUHk+A3yxJKjCT7rPdEu6N0qr0i8lWE0oO6OsEGg== X-Received: by 10.84.135.129 with SMTP id 1mr10774132plj.47.1508203095056; Mon, 16 Oct 2017 18:18:15 -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 f1sm16874283pfe.150.2017.10.16.18.18.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Oct 2017 18:18:14 -0700 (PDT) From: frowand.list@gmail.com To: Rob Herring , Pantelis Antoniou , David Airlie , Jyri Sarha Subject: [PATCH v2 07/12] of: overlay: expand check of whether overlay changeset can be removed Date: Mon, 16 Oct 2017 18:17:49 -0700 Message-Id: <1508203074-26917-8-git-send-email-frowand.list@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508203074-26917-1-git-send-email-frowand.list@gmail.com> References: <1508203074-26917-1-git-send-email-frowand.list@gmail.com> X-Mailman-Approved-At: Tue, 17 Oct 2017 07:35:19 +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; }