Commit graph

887 commits

Author SHA1 Message Date
Lumir Balhar
a4b1a307ff pylibfdt:tests: Extend the way how to find a Python module
Python 3 C extensions have suffix containing platform, Python version
and another details in the name so the condition has to be extended.

Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Message-Id: <20190218164856.23861-5-frenzy@frenzy.cz>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-02-19 16:07:58 +11:00
Lumir Balhar
625dd8aaf2 pylibfdt: Change how passing tests are recognized
When some warning appears in test result, "ok" is still
at the end of the line but without three dots.

Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Message-Id: <20190218164856.23861-4-frenzy@frenzy.cz>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-02-19 13:51:48 +11:00
Petr Viktorin
364631626b pylibfdt: Test fdt.setprop take bytes on Python 3, add error handling
Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Message-Id: <20190218164856.23861-3-frenzy@frenzy.cz>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-02-19 13:51:48 +11:00
Lumir Balhar
cb0f454f73 pylibfdt: check_err accepts only integer as a first argument.
A list passed as an argument to check_err() means that
there is no error code to check and therefore it should
be returned back.

Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Message-Id: <20190218164856.23861-2-frenzy@frenzy.cz>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-02-19 13:49:27 +11:00
Lumir Balhar
4b68c6b360 pylibfdt: Proper handling of bytes/unicode strings and octal literals
Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Message-Id: <20190218164856.23861-1-frenzy@frenzy.cz>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-02-19 13:43:27 +11:00
Andreas Schwab
78e113e81c Use PRIxPTR for printing uintptr_t values
Fixes: 49903aed77 ("use ptrdiff_t modifier for printing pointer differences")
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
2019-01-02 12:35:12 +01:00
Geert Uytterhoeven
ea7a8f6dad libfdt: Fix FDT_ERR_NOTFOUND typos in documentation
The actual error is FDT_ERR_NOTFOUND, not FDT_ERR_NOT_FOUND.

Fixes: d29126c90a ("libfdt: Add iterator over properties")
Fixes: 902d0f0953 ("libfdt: Add a subnodes iterator macro")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-12-23 13:34:57 +11:00
Geert Uytterhoeven
5aafd7ca43 libfdt: Fix fdt_getprop_by_offset() parameter name in documentation
The second parameter of fdt_getprop_by_offset() is called "offset", not
"ffset".

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-12-22 00:02:58 +11:00
Kumar Gala
7cbc550f90 checks: Add unit address check if node is enabled
There are various SoCs that have 2 different peripheral blocks at the
same register offset.  However, we might have one block marked as
status = "disabled" and the other status = "ok".  In such cases we
shouldn't warn about duplicate unit-address.

Here's a cut down example that we would warning about before:

/dts-v1/;

/ {
	#address-cells = <0x01>;
	#size-cells = <0x01>;

	soc {
		#address-cells = <0x01>;
		#size-cells = <0x01>;
		compatible = "simple-bus";
		ranges;

		i2c0: i2c@40003000 {
			compatible = "nordic,nrf-i2c";
			reg = <0x40003000 0x1000>;
			status = "ok";
		};

		spi0: spi@40003000 {
			compatible = "nordic,nrf-spi";
			reg = <0x40003000 0x1000>;
			status = "disabled";
		};
	};
};

We introduce 'unique_unit_address_if_enabled' check that is disabled by
default.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-12-15 18:47:55 +11:00
Rob Herring
f267e674d1 checks: Fix crash with multiple source annotations
Commit 3616b9a811 ("checks: Use source position information for check
failures") causes crashes when there's a check message with multiple
source annotations. Drop the errant addition to the str pointer left
over from the previous version.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-28 09:35:13 +11:00
Rob Herring
3616b9a811 checks: Use source position information for check failures
Now that we retain source position information of nodes and properties,
make that the preferred file name (and position) to print out in check
failures. This will greatly simplify finding and fixing check errors
because most errors are in included source .dtsi files and they get
duplicated every time the source file is included.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-25 18:24:00 +11:00
Rob Herring
2bdbd07a12 checks: Make each message output atomic
Printing to stderr as we build up the check message results in
interleaving of messages when multiple instances of dtc are running.
Change the message output to use an intermediate buffer for constructing
the message and then output the message to stderr with a single fputs.

While perhaps there is no guarantee that fputs will be atomic, this gets
rid of any interleaved output that previously occurred on Linux.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-25 18:23:31 +11:00
Rob Herring
a1eff70c02 util: Add xa{v}sprintf_append functions
Add variadic and va_list functions, xa{v}sprintf, which appends a
formatted string to an existing string and re-allocate the string buffer
if necessary. xasprintf becomes just a special case of xasprintf_append
with a NULL starting string.

Rather than looping to get a big enough buffer, simply the implementation
by assuming we have a C99 compliant vsnprintf implementation to return the
necessary size. A side effect is glibc 2.0 support is dropped which seems
unnecessary.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-25 18:21:48 +11:00
Simon Glass
82a52ce457 libfdt: Add a test for fdt_getprop_by_offset()
This function does not have its own test at present. Add one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-24 23:20:16 +11:00
David Gibson
607b8586b3 PEP8 / Flake8 cleanups for setup.py
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-23 22:11:33 +11:00
David Gibson
f9c0a425b6 Remove broken objdir / srcdir support
The dtc makefiles have support for building into a separate directory from
the sources... except that it's broken and probably always has been.

Remove the pretense.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-23 21:58:42 +11:00
David Gibson
5182b5e6f2 pylibfdt: Use common PREFIX variable
For no particularly good reason, the install target for the Python library
uses a different PREFIX variable to give the installation destination
to the rest of dtc & libfdt.  Make it use the same one.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-23 21:51:35 +11:00
David Gibson
d45bf1f5f2 Refine make tests_clean target
Remove some redundancy, and also clean up *.test.dt.yaml files generated
during the tests.  Also add the latter to gitignore.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-23 21:39:57 +11:00
David Gibson
99284c4db9 Refine pylibfdt_clean target
Move it to the subdir Makefile, generalize some of the patterns, remove
the 'build' directory made by setup.py and __pycache__ directory made by
Python3.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-23 21:24:44 +11:00
David Gibson
a4629cfaed Refine libfdt_clean target
Move it to the libfdt Makefile piece, use neater make syntax, and remove
redundant command (already included in STD_CLEANFILES).

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-23 21:11:47 +11:00
David Gibson
08380fc43a tests: Use modern octal literals for Python
Python3 removes support for C-style octal literals, using 0oXXXX instead.
Python2 also supports this form, so move to the new style.

Reported-by: Lumir Balhar <lbalhar@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-23 17:47:41 +11:00
Lumir Balhar
8113c00b99 pylibfdt: Allow switch to Python 3 via environment variable PYTHON
Python 2 is still the default but it can be changed by
setting environment variable PYTHON before build/test.

Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-23 17:37:56 +11:00
David Gibson
11738cf01f libfdt: Don't use memcpy to handle unaligned reads on ARM
6dcb8ba4 "libfdt: Add helpers for accessing unaligned words" introduced
the fdt32_ld() and fdt64_ld() helpers for loading values from the FDT blob
which might not be naturally aligned.  This matters for ARM, where
attempting a plain unaligned load will often cause an exception.

However, it seems the memcpy() we used here was surprisingly expensive,
making libfdt nearly 6x slower on at least some ARM platforms.

This patch takes an alternative approach, using a bunch of 1-byte loads
and shifts to implement the helpers.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-22 23:37:07 +11:00
Rob Herring
86a288a736 checks: Restructure check_msg to decrease indentation
The entire check_msg function is under the if condition except for
va_start/va_end. Move these and invert the if condition saving a level
of indentation.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-22 17:14:19 +11:00
Julia Lawall
5667e7ef9a annotations: add the annotation functionality
Provide the new command-line option:

--annotate (abbreviated -T)

--annotate provides one or more filenames and line numbers indicating
the origin of a given line.  The filename is expressed relative the the
filename provided on the command line.  Nothing is printed for overlays,
etc.

-T can be repeated giving more verbose annotations.  These consist of
one or more tuples of: filename, starting line, starting column, ending
line ending column.  The full path is given for the file name.
Overlays, etc are annotated with <no-file>:<no-line>.

The verbose annotations may be too verbose for normal use.

There are numerous changes in srcpos.c to provide the relative filenames
(variables initial_path, initial_pathlen and initial_cpp, new functions
set_initial_path and shorten_to_initial_path, and changes in
srcfile_push and srcpos_set_line).  The change in srcpos_set_line takes
care of the case where cpp is used as a preprocessor.  In that case the
initial file name is not the one provided on the command line but the
one found at the beginnning of the cpp output.

shorten_to_initial_path only returns a string if it has some shortening
to do.  Otherwise it returns NULL and relies on the caller to use the
initial string.  This simplifies memory management, by making clear to
the caller whether a new string is allocated.

The new functions srcpos_string_comment, srcpos_string_first, and
srcpos_string_last print the annotations.  srcpos_string_comment is
recursive to print a list of source file positions.

Various changes are sprinkled throughout treesource.c to print the
annotations.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-19 11:18:12 +11:00
Julia Lawall
8e20ccf52f annotations: add positions
Extend the parser to record positions, in build_node,
build_node_delete, and build_property.

srcpos structures are added to the property and node types, and to the
parameter lists of the above functions that construct these types.
Nodes and properties that are created by the compiler rather than from
parsing source code have NULL as the srcpos value.

merge_nodes, defined in livetree.c, uses srcpos_extend to combine
multiple positions, resulting in a list of positions.  srcpos_extend
is defined in srcpos.c.  New elements are added at the end.  This
requires the srcpos type, define in srcpos.h, to be a list structure
with a next field.  This next field is initialized to NULL in
srcpos.h, in the macro YYLLOC_DEFAULT invoked implicitly by the
generated parser code.

Another change to srcpos.c is to make srcpos_copy always do a full
copy, including a copy of the file substructure.  This is required
because when dtc is used on the output of cpp, the successive detected
file names overwrite the file name in the file structure.  The next
field does not need to be deep copied, because it is always NULL when
srcpos_copy is called; an assert checks for this. File names are only
updated in uncopied position structures.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-19 11:06:20 +11:00
David Gibson
ca930e20bb tests: Don't lose errors from make checkm
For unclear reasons we had some code to copy a transcript of "make checkm"
runs to a vglog.XXX file.  It's not really clear why this was there, and
it had the nasty side effect of discarding errors from run_tests.sh,
meaning that an error on the valgrind run wouldn't show up clearly in
Travis CI builds.  Remove that logic so that we see errors more clearly.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-14 16:37:39 +11:00
David Gibson
43366bb4ee tests: Property count valgrind errors in wrapped tests
The logic in wrap_test() was effectively squashing valgrind errors into
the "FAIL" bucket rather than their own bucket as intended.  Correct it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-14 16:13:30 +11:00
David Gibson
5062516fb8 srcpos: Remove srcpos_empty
Nothing was actually using it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-14 16:12:43 +11:00
David Gibson
a3143fafbf Revert "annotations: add positions"
This reverts commit baa1d2cf78.

Turns out this introduced memory badness.  valgrind picks it up on
x86, but it straight out SEGVs on x86.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-14 15:24:49 +11:00
Kumar Gala
403cc79f06 checks: Update SPI bus check for 'spi-slave'
If the SPI bus controller is being used for 'spi-slave' mode some of the
checks we have need to change:

In 'spi-slave' mode #address-cells should be 0, as any children don't
have a reg property.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-14 14:25:43 +11:00
Julia Lawall
baa1d2cf78 annotations: add positions
Extend the parser to record positions, in build_node, build_node_delete,
and build_property.

srcpos structures are added to the property and node types, and to the
parameter lists of the above functions that construct these types.
Nodes and properties that are created by the compiler rather than from
parsing source code have NULL as the srcpos value.

merge_nodes, defined in livetree.c, uses srcpos_extend to combine
multiple positions, resulting in a list of positions.  srcpos_extend is
defined in srcpos.c.  New elements are added at the end.  The srcpos
type, define in srcpos.h, is now a list structure with a next field.

Another change to srcpos.c is to make srcpos_copy always do a full copy,
including a copy of the file substructure.  This is required because
when dtc is used on the output of cpp, the successive detected file
names overwrite the file name in the file structure.  The next field
does not need to be deep copied, because it is only updated in newly
copied positions and the positions to which it points have also been
copied.  File names are only updated in uncopied position structures.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-13 15:29:27 +11:00
David Gibson
ff2ad38f6a Merge remote-tracking branch 'origin/pr/18' 2018-11-07 15:59:36 +11:00
John Clarke
aa7254d9cb libfdt: return correct value if #size-cells property is not present
According to the device tree specification, the default value for
#size-cells is 1, but fdt_size_cells() was returning 2 if this property
was not present.

This patch also makes fdt_address_cells() and fdt_size_cells() conform
to the behaviour documented in libfdt.h. The defaults are only returned
if fdt_getprop() returns -FDT_ERR_NOTFOUND, otherwise the actual error
is returned.

Signed-off-by: John Clarke <johnc@kirriwa.net>
2018-11-07 14:13:12 +11:00
Dan Horák
49903aed77 use ptrdiff_t modifier for printing pointer differences
Use ptrdiff_t modifier (%tx) for printing a difference between 2 pointers. Currently
%zx (size_t) is used, but it fails on platforms where size_t and ptrdiff_t are
defined differently (like s390).

Comes from
f3da2d1b00
originally.

Signed-off-by: Dan Horák <dan@danny.cz>
2018-10-23 15:26:52 +02:00
Rob Herring
da2b691ccf treesource: Fix dts output for phandles in middle of a sequence of ints
If we have a phandle in the middle of a sequence of numbers and
it is not bracketed (e.g. <0x1234 &phandle 0x5678>), the dts output will
be corrupted due to missing a space between the phandle value and the
following number.

Fixes: 8c59a97ce0 ("Fix missing labels when emitting dts format")
Cc: Grant Likely <grant.likely@arm.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-10-12 14:34:33 +11:00
Lubomir Rintel
8f8b77a0d6 tests: Wrap check_align() calls with base_run_test()
Otherwise the FAIL results won't be accounted for in the summary.
Easily testable by artifically causing them to fail:

-        if [ $(($size % $align)) -eq 0 ] ;then
+        if [ $(($size % $align)) -eq 666 ] ;then

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-10-04 10:25:56 +10:00
Rob Herring
522d81d572 Fix dts output with a REF_PATH marker
Commit 8c59a97ce0 ("Fix missing labels when emitting dts format")
fixed label output, but broke output when there is a REF_PATH marker.

The problem is a REF_PATH marker causes a zero length string to be
emitted. The write_propval_string() function requires a length of at
least 1 (including the terminating '\0'), but that was not being
checked.

For the integer output, a length of 0 is valid as it is possible to have
labels inside the starting '<':

int-prop = < start: 0x1234>;

REF_PHANDLE is another marker that we don't explicitly handle, but it
doesn't cause a problem as it is fundamentally just an int.

Fixes: 8c59a97ce0 ("Fix missing labels when emitting dts format")
Reported-by: Kumar Gala <kumar.gala@linaro.org>
Cc: Grant Likely <grant.likely@arm.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-09-27 10:58:35 +10:00
Fredrik Markstrom
e45198c983 Added test cases for target references
This commit adds test cases for commits "Correct overlay syntactic
sugar for generating target-path fragments" and "Merge nodes with
local target label references".

It verifies that target path references are not resolved locally and
that target label references that can be resolved locally are.

Signed-off-by: Fredrik Markstrom <fredrik.markstrom@gmail.com>
[dwg: Fixed some whitespace problems]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-09-26 10:41:49 +10:00
Fredrik Markstrom
0fcffda15e Merge nodes with local target label references
This change makes sure that nodes with target label references doesn't
create additional fragments if the label can been resolved
locally. Target path references are not resolved locally and will
generate a fragment.

Previously the dts below would generate two fragments:

/dts-v1/;
/plugin/;
&x { a: a@0 {};};
&a { b {}; };

This commit essentially reverts part of the commit "Correct overlay
syntactic sugar for generating target-path fragments". The main reason
we want to do this is that it breaks consumers of dtbo:s that can't
resolve references between fragments in the same dtbo (like the linux
4.1 kernel). In addition creating a fragment for each label reference
substantially increases the size of the resulting dtbo for some use
cases.

Signed-off-by: Fredrik Markstrom <fredrik.markstrom@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-09-25 12:40:43 +10:00
David Gibson
1e4a0928f3 pylibfdt: Don't have setup.py depend on where it's invoked from
Currently setup.py depends on being invoked from the right directory
(specifically it needs to be run from the root of the project).  That's a
bit confusing.

This updates setup.py to no longer depend on the invoking directory by
instead having it change directory to the location of the script itself,
then using internal paths relative to that.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-25 10:31:54 +10:00
David Gibson
ca399b1495 pylibfdt: Eliminate run_setup make function
This function no longer does anything useful, so get rid of it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-25 10:31:45 +10:00
David Gibson
98972f1b3e pylibfdt: Improved version extraction
Currently setup.py expects the library version in a VERSION environment
variable, or it exctracts the version from the Makefile.  The latter is
for the case where the script is run standalone, rather than from make.
But parsing the Makefile is ugly and fragile, and won't always get the
same version we put into the C code.

This changes to instead extracting the version from the trivial .h file we
already generate to put the version into C code.  It's still slightly ugly,
but it's simpler and since we can control the precise format of that .h,
not as fragile.

This lets us remove the remains of the makefile parsing code from setup.py.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-25 10:31:00 +10:00
David Gibson
7ba2be6cda pylibfdt: Don't silence setup.py when V=1
At the moment we unconditionally pass --quiet to setup.py.  Change that to
get more debugging output from it when V=1 is passed to make.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-25 10:30:52 +10:00
David Gibson
7691f9d393 pylibfdt: Make SETUP make variable
This points to the Python setup script, since we reference it in a couple
of places.  While we're there correct two small problems:

1) setup.py is part of the checked in sources and so lives in
   $(PYLIBFDT_srcdir) not $(PYLIBFDT_objdir) [this only worked because
   those are the same by default]

2) The module itself should depend on the setup script so it is rebuilt
   if the script is changed

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-25 10:30:28 +10:00
David Gibson
855b9963de pylibfdt: Simpler CFLAGS handling
At the moment we have some fiddly code to either pass in make's CPPFLAGS to
setup.py, or have setup.py extract them from the Makefile.  But really the
only thing we need from here is the include paths.  We already know what
include paths we need (libfdt/) so we can just set that directly in
setup.py.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-25 10:30:20 +10:00
David Gibson
47cafbeeb9 pylibfdt: Link extension module with libfdt rather than rebuilding
Currently we build the Python extension module from all the libfdt source
files as well as the swig wrapper file.  This is a bit silly, since we've
already compiled libfdt itself.

This changes the build to instead build the extension module from just the
swig wrapper, linking it against the libfdt.a we've already build.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-25 10:30:10 +10:00
David Gibson
dd695d6afb pylibfdt: Correctly set build output directory
Our Makefile currently passes PYLIBFDT_objdir into setup.py in an attempt
to set the correct place to put the Python extension module output.  But
that gets passed in the 'package_dir' map in distutils.

But that's basically not what package_dir controls.  What actually makes us
find the module in the right place is the --inplace passed to setup.py
(causing the module to go into the current directory), and the following
'mv' in the Makefile to move it into the right final location.

We can simplify setup.py by dropping the useless objdir stuff, and get the
module put in the right place straight way by instead using the --build-lib
setup.py option.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-25 10:29:35 +10:00
David Gibson
59327523d0 pylibfdt: We don't need include files from the base directory
pylibfdt/setup.py currently adds include flags to the extension module
build to allow include files in the base dtc directory.  But pylibfdt
doesn't rely on any headers there, only on headers in libfdt/ - it also
shouldn't rely on dtc headers at any future time.

So, remove that from the include list, allowing some simplifications to
setup.py.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-25 10:29:23 +10:00
Rob Herring
e84742aa7b checks: fix simple-bus compatible matching
Since commit 7975f64222 ("Fix widespread incorrect use of strneq(),
replace with new strprefixeq()") simple-bus checks have been silently
skipped. The problem was 'end - str' is one more than the string length
and the strnlen in strprefixeq fails. This can't be fixed simply by
subtracting one as it is possible to have multiple '\0' at the end of
the property. Fix this by making the 'compatible' property string list
check a dependency, and then we can assume the property is null
terminated and we can just use streq() for comparisons.

Add some tests so the problem doesn't happen again.

Fixes: 7975f64222 ("Fix widespread incorrect use of strneq(), replace with new strprefixeq()")
Reported-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-09-21 11:31:16 +10:00