Skip to content

Commit 8f1663e

Browse files
agansarigalak
authored andcommitted
scripts: simple-bus warning suppression
Single-bus warning in python parsing of device tree is suppressed if this is also suppresed in the device tree compiler. Signed-off-by: Andrei Gansari <[email protected]>
1 parent f5e5de0 commit 8f1663e

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

scripts/dts/edtlib.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@
8282
TYPE_PHANDLE, TYPE_PHANDLES_AND_NUMS
8383
from grutils import Graph
8484

85+
86+
dtc_flags = ""
87+
8588
#
8689
# Public classes
8790
#
@@ -776,6 +779,8 @@ class Node:
776779
The flash controller for the node. Only meaningful for nodes representing
777780
flash partitions.
778781
"""
782+
global dtc_flags
783+
779784
@property
780785
def name(self):
781786
"See the class docstring"
@@ -797,9 +802,12 @@ def unit_addr(self):
797802

798803
addr = _translate(addr, self._node)
799804

800-
if self.regs and self.regs[0].addr != addr:
801-
self.edt._warn("unit-address and first reg (0x{:x}) don't match "
802-
"for {}".format(self.regs[0].addr, self.name))
805+
# This code is redundant, it checks the same thing as simple_bus_reg in
806+
# dtc, we disable it in python if it's suppressed in dtc.
807+
if "-Wno-simple_bus_reg" not in dtc_flags:
808+
if self.regs and self.regs[0].addr != addr:
809+
self.edt._warn("unit-address and first reg (0x{:x}) don't match "
810+
"for {}".format(self.regs[0].addr, self.name))
803811

804812
return addr
805813

scripts/dts/gen_defines.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def main():
4545
conf_file = open(args.conf_out, "w", encoding="utf-8")
4646
header_file = open(args.header_out, "w", encoding="utf-8")
4747
flash_area_num = 0
48+
edtlib.dtc_flags = args.dtc_flags
4849

4950
write_top_comment(edt)
5051

@@ -89,6 +90,7 @@ def parse_args():
8990

9091
parser = argparse.ArgumentParser()
9192
parser.add_argument("--dts", required=True, help="DTS file")
93+
parser.add_argument("--dtc-flags", help="extra device tree parameters")
9294
parser.add_argument("--bindings-dirs", nargs='+', required=True,
9395
help="directory with bindings in YAML format, "
9496
"we allow multiple")

0 commit comments

Comments
 (0)