Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8315C07E95 for ; Sun, 4 Jul 2021 18:20:24 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 26DE4613DA for ; Sun, 4 Jul 2021 18:20:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 26DE4613DA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CBFA382BD1; Sun, 4 Jul 2021 20:20:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="LWmd8pE9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D918B82BD5; Sun, 4 Jul 2021 20:20:07 +0200 (CEST) Received: from mail-oo1-xc2f.google.com (mail-oo1-xc2f.google.com [IPv6:2607:f8b0:4864:20::c2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 71D6F82BAA for ; Sun, 4 Jul 2021 20:20:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-oo1-xc2f.google.com with SMTP id s10-20020a4aeaca0000b029024c2acf6eecso3911518ooh.9 for ; Sun, 04 Jul 2021 11:20:03 -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=hzWTFmCrtl2x9OYDH3wvXGWRHQbB/MkrTAoLU1Qte7Q=; b=LWmd8pE94YOY80x486HbAp8d/l2zF3st4ThC+6bNdyu8dl0VYdcXZVJNVkdSMo5ZJN WRQCyzD04G3W4Uku0jYd14q2eMuxwW21idV931UUQBv1dIHjcqqjCuex5SFvtq3l8mlH 2kG99M4Wd2WO1zH3poGoY6Op1VaBNBLTLSCME= 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=hzWTFmCrtl2x9OYDH3wvXGWRHQbB/MkrTAoLU1Qte7Q=; b=eMmGgNwwx5cEyecggJk9vcvQmqWnh1fAD5FIEWi3E1mh2uOsjeIfKrTzIQfqk0KInQ Tpr55+Prl4OmtW8MCh0Zt33xBWOymKKjoNng+P46BR6ZH6NuGYtWUqzXHCB+deqU91TU 5yYQuSHCGeV8gcA7CZsfEu0hYs82oOXomsH0630u0VJOlVIsTS1JI/rySd+m2ermyacA YsnPboKqvFRWP0gDaYgd/mwJKf36LK3XvNMV+ggLb5jXORrjlAknVJONiqdBTOfZP/EE E/wcTvB54S9aKM8dlv8I2lXeQnfi9a9vbfx0pauryPktbDkP9Ld1gLYwyl/uah0GBZTR 3bmA== X-Gm-Message-State: AOAM530Xbc2FB+0gERxFIBusNL+O9zL2latwmrWEy46CeHNtbM79JZ73 DaUht56MWyKlZM97fwDCNYPFDbYVrcbojGPY X-Google-Smtp-Source: ABdhPJy4FpH6hCwolZz89gtClkFiM9BGr+LBFKmXbCJZavo0fuEb2r4TKN2NfQhCZAojhDmOugJC9Q== X-Received: by 2002:a4a:97ab:: with SMTP id w40mr7623580ooi.19.1625422801838; Sun, 04 Jul 2021 11:20:01 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id z2sm2092953otm.2.2021.07.04.11.20.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jul 2021 11:20:00 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Johan Jonker , Simon Glass Subject: [PATCH 3/8] dtoc: Allow multiple warnings for a driver Date: Sun, 4 Jul 2021 12:19:45 -0600 Message-Id: <20210704181950.1917106-4-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210704181950.1917106-1-sjg@chromium.org> References: <20210704181950.1917106-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean At present we show when a driver is missing but this is not always that useful. There are various reasons way a driver may appear to be missing, such as a parse error in the source code or a missing field in the driver declaration. Update the implementation to record all warnings for each driver, showing only those which relate to drivers that are actually used. This avoids spamming the user with warnings related to a driver for a different board. Signed-off-by: Simon Glass --- tools/dtoc/src_scan.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/tools/dtoc/src_scan.py b/tools/dtoc/src_scan.py index 1dbb56712a3..6c37a71e978 100644 --- a/tools/dtoc/src_scan.py +++ b/tools/dtoc/src_scan.py @@ -13,6 +13,7 @@ U_BOOT_DRIVER(), UCLASS_DRIVER and all struct declarations in header files. See doc/driver-model/of-plat.rst for more informaiton """ +import collections import os import re import sys @@ -190,6 +191,9 @@ class Scanner: value: Driver name declared with U_BOOT_DRIVER(driver_name) _drivers_additional (list or str): List of additional drivers to use during scanning + _warnings: Dict of warnings found: + key: Driver name + value: Set of warnings _of_match: Dict holding information about compatible strings key: Name of struct udevice_id variable value: Dict of compatible info in that variable: @@ -217,6 +221,7 @@ class Scanner: self._driver_aliases = {} self._drivers_additional = drivers_additional or [] self._missing_drivers = set() + self._warnings = collections.defaultdict(set) self._of_match = {} self._compat_to_driver = {} self._uclass = {} @@ -267,7 +272,10 @@ class Scanner: aliases_c.remove(compat_c) return compat_c, aliases_c - self._missing_drivers.add(compat_list_c[0]) + name = compat_list_c[0] + self._missing_drivers.add(name) + self._warnings[name].add( + 'WARNING: the driver %s was not found in the driver list' % name) return compat_list_c[0], compat_list_c[1:] @@ -577,9 +585,17 @@ class Scanner: def show_warnings(self): """Show any warnings that have been collected""" - for name in sorted(list(self._missing_drivers)): - print('WARNING: the driver %s was not found in the driver list' - % name) + used_drivers = [drv.name for drv in self._drivers.values() if drv.used] + missing = self._missing_drivers + for name in sorted(self._warnings.keys()): + if name in missing or name in used_drivers: + warns = sorted(list(self._warnings[name])) + # For now there is only ever one warning + print('%s: %s' % (name, warns[0])) + indent = ' ' * len(name) + if name in missing: + missing.remove(name) + print() def scan_driver(self, fname): """Scan a driver file to build a list of driver names and aliases -- 2.32.0.93.g670b81a890-goog