From patchwork Sat Jul 20 18:23:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1134427 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="cJipHFM7"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45rbwl3RD4z9s4Y for ; Sun, 21 Jul 2019 04:28:39 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 11B3BC21DFA; Sat, 20 Jul 2019 18:26:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id B8C75C21DA2; Sat, 20 Jul 2019 18:25:21 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id ECEB2C21D8E; Sat, 20 Jul 2019 18:25:10 +0000 (UTC) Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) by lists.denx.de (Postfix) with ESMTPS id 3EF69C21DA6 for ; Sat, 20 Jul 2019 18:25:10 +0000 (UTC) Received: by mail-io1-f67.google.com with SMTP id q22so65243748iog.4 for ; Sat, 20 Jul 2019 11:25:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LHR50tv3h9D1Q5zv/met9dp22KljMGIWg+avE40iXms=; b=cJipHFM7O7tHJT5TuDJLh2BW7zZWWeQ//zuFrPYmzeSofzEwQweneClIRwQ7zU3bBf HjGnx4GfGNm5/Rqpf27lZxqzI5Qlqm7rOkyszwqB5f4ludPjDITAgAPyz+DXagaR9Nbr STsFt2MlZU8Mnv9umXYDC0X0vomjQ+KF3mO48= 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:mime-version:content-transfer-encoding; bh=LHR50tv3h9D1Q5zv/met9dp22KljMGIWg+avE40iXms=; b=GL3fxj3sOga7naTzVgNDP7+t6sNWEqGSeZu++raZiRC77dPe1HlfC4JMEmeLRpuJZ1 9T0fkR5XuHocsO+hsp2axwgECHsjXvDOqiyMdyxMx3nsOLzC8i3TtiSwIDXTgwc35E5d qlpxPJjoTAcBrqjolj/ewz5ZROUZ4eFsyU/WGu9YKAc23nCqsE7OTGZjFWkTJiz+mg5h 5GcKEgWLQKP+LxNAU1/bh05iT79pW3uDIWlOsuyeu33pGLC5zEGWAMbF3/vcdwIw7OlK fNuXDQ4KjP9kA0QuTD80HODBZmZfh23AbxvFp6+lei2Fguz/BzSAyKnagRJXSO8My+Pv xb6Q== X-Gm-Message-State: APjAAAUpsdb0eg2SOFxFhC6vSp/e7xVZtDFU58qGqD7fjA1FnNzUchjl 4lL4O2rjE02XqBEpr2LB3i3vQzjP3dA= X-Google-Smtp-Source: APXvYqwXdk4T7CFmnlObypmxVTzMybFcHIYk+aB+teCw27BFQXhALwbClTznVxadc4oM2popgRNO/w== X-Received: by 2002:a02:1607:: with SMTP id a7mr60653623jaa.123.1563647109111; Sat, 20 Jul 2019 11:25:09 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id z17sm49778933iol.73.2019.07.20.11.25.08 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 20 Jul 2019 11:25:08 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Sat, 20 Jul 2019 12:23:38 -0600 Message-Id: <20190720182416.183626-17-sjg@chromium.org> X-Mailer: git-send-email 2.22.0.657.g960e92d24f-goog In-Reply-To: <20190720182416.183626-1-sjg@chromium.org> References: <20190720182416.183626-1-sjg@chromium.org> MIME-Version: 1.0 Subject: [U-Boot] [PATCH 16/53] dtoc: Update Fdt.FromData() to allow a name X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" It is confusing when something goes wrong with a device tree which was created from data rather than a file, since there is no identifying filename. Add an option to provide this. Use the filename as the name, where available Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- tools/dtoc/fdt.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index 3870eb1fa1b..b341ef3f83b 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -498,29 +498,35 @@ class Fdt: Properties: fname: Filename of fdt _root: Root of device tree (a Node object) + name: Helpful name for this Fdt for the user (useful when creating the + DT from data rather than a file) """ def __init__(self, fname): self._fname = fname self._cached_offsets = False self.phandle_to_node = {} + self.name = '' if self._fname: + self.name = self._fname self._fname = fdt_util.EnsureCompiled(self._fname) with open(self._fname, 'rb') as fd: self._fdt_obj = libfdt.Fdt(fd.read()) @staticmethod - def FromData(data): + def FromData(data, name=''): """Create a new Fdt object from the given data Args: data: Device-tree data blob + name: Helpful name for this Fdt for the user Returns: Fdt object containing the data """ fdt = Fdt(None) fdt._fdt_obj = libfdt.Fdt(bytes(data)) + fdt.name = name return fdt def LookupPhandle(self, phandle):