Commit Graph

45 Commits

Author SHA1 Message Date
Pantelis Antoniou ce4fecf1fe vsprintf: Add %p extension "%pOF" for device tree
90% of the usage of device node's full_name is printing it out in a
kernel message. However, storing the full path for every node is
wasteful and redundant. With a custom format specifier, we can generate
the full path at run-time and eventually remove the full path from every
node.

For instance typical use is:
	pr_info("Frobbing node %s\n", node->full_name);

Which can be written now as:
	pr_info("Frobbing node %pOF\n", node);

'%pO' is the base specifier to represent kobjects with '%pOF'
representing struct device_node. Currently, struct device_node is the
only supported type of kobject.

More fine-grained control of formatting includes printing the name,
flags, path-spec name and others, explained in the documentation entry.

Originally written by Pantelis, but pretty much rewrote the core
function using existing string/number functions. The 2 passes were
unnecessary and have been removed. Also, updated the checkpatch.pl
check. The unittest code was written by Grant Likely.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Joe Perches <joe@perches.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2017-06-27 12:36:40 -05:00
Dan Carpenter 8756cd1ded of/unittest: Missing unlocks on error
Static checkers complain that we should unlock before returning.  Which
is true.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Frank Rowand <frank.rowand@sony.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2017-05-04 11:07:38 -05:00
Arnd Bergmann ee320b33b4 of: fix uninitialized variable warning for overlay test
gcc warns that an empty device tree would cause undefined behavior:

drivers/of/unittest.c: In function 'of_unittest':
drivers/of/unittest.c:2199:25: warning: 'last_sibling' may be used uninitialized in this function [-Wmaybe-uninitialized]

This adds an initialization of the variable to zero, which we handle
correctly.

Fixes: 81d0848fc8 ("of: Add unit tests for applying overlays")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rob Herring <robh@kernel.org>
2017-05-03 07:10:33 -05:00
Frank Rowand 81d0848fc8 of: Add unit tests for applying overlays
Existing overlay unit tests examine individual pieces of the overlay
code.  The new tests target the entire process of applying an overlay.

Signed-off-by: Frank Rowand <frank.rowand@sony.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2017-04-27 17:26:06 -05:00
Alexander Sverdlin ca7b89647b of/unittest: Swap arguments of of_unittest_apply_overlay()
Function signature

  of_unittest_apply_overlay(int unittest_nr, int overlay_nr, ...

and call sites, like in of_unittest_apply_overlay_check():

  ret = of_unittest_apply_overlay(overlay_nr, unittest_nr, ...

do not match. Fix this in one place (function signature).
The only affected test case is 15, which supplies non-existing
overlay number 16, but two bugs matched here. Fix the test case.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: devicetree@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
2017-01-23 14:58:03 -06:00
Geliang Tang 30965eeab5 of: drop duplicate headers
Drop duplicate headers string.h and of_platform.h.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2017-01-04 14:01:28 -06:00
Kefeng Wang 146dedbcab of: unittest: use of_platform_default_populate() to populate default bus
Use helper of_platform_default_populate() in linux/of_platform
when possible, instead of calling of_platform_populate() with
the default match table.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2016-06-23 15:00:59 -05:00
Linus Torvalds e7f44b65b5 Devicetree for 4.7:
- Rewrite of the unflattening code to avoid recursion and lessen the
   stack usage.
 
 - Rewrite of the phandle args parsing code to get rid of the fixed args
   size. This is needed for IOMMU code.
 
 - Sync to latest dtc which adds more dts style checking. These warnings
   are enabled with "W=1" compiles.
 
 - Tegra documentation updates related to the above warnings.
 
 - A bunch of spelling and other doc fixes.
 
 - Various vendor prefix additions.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJXP3OZAAoJEPr7XbWNvGHDEUAQAJLbR9Js7RENPGX/u0NSJNaJ
 yQhyNVsz/BkAWFfWT6YEfyNnDY0UcRs2N9RHb+z65TsX1jvJJxLRDLRfz+rExfiZ
 cA1RJaF77kPOdA0eZapJIzPvAf97Zik+nzKLsqUPUSYaIzghV5rN6aR2AjXN5AYv
 TMQP41NwNQkxfO5I+NOssEB8IBH+DlAzg0LYXw8wNsAJc8o+DgEQjU8cxCqR0NgE
 SbpbJNF8tRXEJckZRC+Q7Gyn2J7VglmM/5VTFbBBwgIly2lcLADPVuX/Z6hZE3OH
 K7mhNWBu61vI5lU6u7q64ePeb63j+Ut/RR0tTPgjsLg0Qg0ue+6iZ66S9ZHEicbU
 wT4A/hjSImvZoQGGMrtUF5HGcaoMHGLGFgFc/Ouox8OQflntQBzuEx/gOQpPXcIT
 vdwITNW8/OGV3rgtmRO9mbdSZiAHPsydoTkIl+Ucod3nTrlEEOwgQARYO+2CfSRj
 sknndj26Kf+0n0tSv2d4JAEdEozp2ZPyfiAfpPXW74jOmOxeswUb3Kxx8YMwhCEl
 +s96rm1vtpNmJzXtuPV3eB0TydWMQ/3NXN6XOS7qEN/5y1AbQqKEoIyJOziBQMxe
 c9Eh/YSjsm4uw3Q0wHOI3s4hTwWfuBmwpIsANJVKrRbftPF58bMUBYU/44ReTtA8
 iMsrqJpnSCcAyS8doWRY
 =s+gW
 -----END PGP SIGNATURE-----

Merge tag 'devicetree-for-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux

Pull devicetree updates from Rob Herring:

 - Rewrite of the unflattening code to avoid recursion and lessen the
   stack usage.

 - Rewrite of the phandle args parsing code to get rid of the fixed args
   size.  This is needed for IOMMU code.

 - Sync to latest dtc which adds more dts style checking.  These
   warnings are enabled with "W=1" compiles.

 - Tegra documentation updates related to the above warnings.

 - A bunch of spelling and other doc fixes.

 - Various vendor prefix additions.

* tag 'devicetree-for-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (52 commits)
  devicetree: Add Creative Technology vendor id
  gpio: dt-bindings: add ibm,ppc4xx-gpio binding
  of/unittest: Remove unnecessary module.h header inclusion
  drivers/of: Fix build warning in populate_node()
  drivers/of: Fix depth when unflattening devicetree
  of: dynamic: changeset prop-update revert fix
  drivers/of: Export of_detach_node()
  drivers/of: Return allocated memory from of_fdt_unflatten_tree()
  drivers/of: Specify parent node in of_fdt_unflatten_tree()
  drivers/of: Rename unflatten_dt_node()
  drivers/of: Avoid recursively calling unflatten_dt_node()
  drivers/of: Split unflatten_dt_node()
  of: include errno.h in of_graph.h
  of: document refcount incrementation of of_get_cpu_node()
  Documentation: dt: soc: fix spelling mistakes
  Documentation: dt: power: fix spelling mistake
  Documentation: dt: pinctrl: fix spelling mistake
  Documentation: dt: opp: fix spelling mistake
  Documentation: dt: net: fix spelling mistakes
  Documentation: dt: mtd: fix spelling mistake
  ...
2016-05-20 14:51:34 -07:00
Javier Martinez Canillas 27f4ec1443 of/unittest: Remove unnecessary module.h header inclusion
The OF_UNITTEST Kconfig symbol is bool so this unittest can only be
built-in and not build as a module. Also, nothing defined in this
header file used so is not necessary to include it.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2016-05-19 09:16:36 -05:00
Gavin Shan c4263233f3 drivers/of: Specify parent node in of_fdt_unflatten_tree()
This adds one more argument to of_fdt_unflatten_tree() to specify
the parent node of the FDT blob that is going to be unflattened.
In the result, the function can be used to unflatten FDT blob that
represents device sub-tree in PowerNV PCI hotplug driver.

Cc: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2016-05-16 07:22:35 -05:00
Peter Rosin b6e3b7171b of/unittest: convert to use an explicit i2c mux core
Allocate an explicit i2c mux core to handle parent and child adapters
etc. Update the select op to be in terms of the i2c mux core instead
of the child adapter.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-04-22 15:00:18 +02:00
Sergey Senozhatsky 815d74b35e of/unittest: fix infinite loop in of_unittest_destroy_tracked_overlays()
of_overlay_destroy() can return `-ENODEV' error code once it
failed to find the requested overlay in `ov_idr'. However,
of_unittest_destroy_tracked_overlays() does not handle this
error code correctly and continues to call of_overlay_destroy()
on the 'missing' overlay over and over again. This results in
a printk flood

[..]
[   33.497583] of_overlay_destroy: Could not find overlay #6
[   33.497583] of_overlay_destroy: Could not find overlay #6
[   33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
[   33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
[   33.497586] of_overlay_destroy: Could not find overlay #6
[   33.497586] of_overlay_destroy: Could not find overlay #6
[   33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
[   33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6
[..]

which is not really good due to printk design, and can lead to soft
lockups, hard lockups, etc. (depending on the context console_unlock()
is being called from). The problem has bee observed in real life
and reported by Ying Huang.

This patch does not address the root cause of missing overlay in
`ov_idr', it fixes the endless loop only.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Reported-by: kernel test robot <ying.huang@linux.intel.com>
Link: lkml.kernel.org/r/87fuwk1c0o.fsf@yhuang-dev.intel.com
Signed-off-by: Rob Herring <robh@kernel.org>
2016-03-03 16:51:31 -06:00
Gavin Shan 183223770a drivers/of: Export OF changeset functions
The PowerNV PCI hotplug driver is going to use the OF changeset
to manage the changed device sub-tree. This exports those OF
changeset functions for that.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2016-01-13 16:10:37 -06:00
Grant Likely d2329fb576 of/unittest: Show broken behaviour in the platform bus
Add a single resource to the test bus device to exercise the platform
bus code a little more. This isn't strictly a devicetree test, but it is
a corner case that the devicetree runs into. Until we've got platform
device unittests, it can live here. It doesn't need to be an explicit
text because the kernel will oops when it is wrong.

Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
[wsa: added the comment provided by Grant, rebased, and tested]
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2016-01-05 09:20:40 -06:00
Julia Lawall 855ff2878e of/unittest: add missing of_node_put
for_each_child_of_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
expression root,e;
local idexpression child;
@@

 for_each_child_of_node(root, child) {
   ... when != of_node_put(child)
       when != e = child
(
   return child;
|
+  of_node_put(child);
?  return ...;
)
   ...
 }
// </smpl>

Combine the puts into code at the end of the function, for conciseness.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Rob Herring <robh@kernel.org>
2015-10-22 09:26:28 -05:00
Krzysztof Kozlowski 599ad5ac9a of: Drop owner assignment from platform and i2c driver
platform_driver and i2c_driver do not need to set an owner because core
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2015-07-27 08:24:39 -05:00
Linus Torvalds d56a669ca5 Devicetree updates for 4.1:
- DT endianness specification bindings
 - Big endian 8250 serial support
 - DT overlay unittest updates
 - Various DT doc updates
 - Compile fixes for OF_IRQ=n
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJVOG5kAAoJEMhvYp4jgsXihDgH/3pmPSjuRG1bhGssmnchHjWh
 SU2eS2MZnlD60UqRt7jd3smCX2qL83tfwpFhOvCT9Mz775E7ggmYq9fS8pCYAbaD
 x98mUrE2GzdUzlrL6RS8Z0ExjyGwbMoW3+cZtyPkmC6CsW0fwqEPmEyk7m+Hk8C3
 w3pWG06o+G8UjiFmwbr8Pki2ykxvucr22NCzH4SS6bAD4QOrQO3v48QkUg7XFlVc
 NHNzQbswL85uOJ7uuAbxg+s8TXkwcxUeMJEKldLrjuyppO3N1MjnOgCptnhVNOOb
 zK+IsS378jMiNjAg2ui/BLH60N5yadkgk4+L4iPPy+y/yR61NCVXxRe11IQJxb0=
 =rtv6
 -----END PGP SIGNATURE-----

Merge tag 'devicetree-for-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux

Pull second batch of devicetree updates from Rob Herring:
 "As Grant mentioned in the first devicetree pull request, here is the
  2nd batch of DT changes for 4.1.  The main remaining item here is the
  endianness bindings and related 8250 driver support.

   - DT endianness specification bindings

   - big-endian 8250 serial support

   - DT overlay unittest updates

   - various DT doc updates

   - compile fixes for OF_IRQ=n"

* tag 'devicetree-for-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
  frv: add io{read,write}{16,32}be functions
  mn10300: add io{read,write}{16,32}be functions
  Documentation: DT bindings: add doc for Altera's SoCFPGA platform
  of: base: improve of_get_next_child() kernel-doc
  Doc: dt: arch_timer: discourage clock-frequency use
  of: unittest: overlay: Keep track of created overlays
  of/fdt: fix allocation size for device node path
  serial: of_serial: Support big-endian register accesses
  serial: 8250: Add support for big-endian MMIO accesses
  of: Document {little,big,native}-endian bindings
  of/fdt: Add endianness helper function for early init code
  of: Add helper function to check MMIO register endianness
  of/fdt: Remove "reg" data prints from early_init_dt_scan_memory
  of: add vendor prefix for Artesyn
  of: Add dummy of_irq_to_resource_table() for IRQ_OF=n
  of: OF_IRQ should depend on IRQ_DOMAIN
2015-04-24 08:46:18 -07:00
Pantelis Antoniou 492a22aceb of: unittest: overlay: Keep track of created overlays
During the course of the overlay selftests some of them remain
applied. While this does not pose a real problem, make sure you track
them and destroy them at the end of the test.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2015-04-14 19:35:46 -05:00
Grant Likely a2166ca5f3 Merge remote-tracking branch 'robh/for-next' into devicetree/next
Conflicts:
	drivers/of/unittest.c
2015-03-29 08:59:58 +01:00
Grant Likely 37791b6fbe of/unittest: Fix of_platform_depopulate test case
The previous commit, "of/unittest: early return from test skips tests"
exposed broken tests for the of_platform_unpopulate() function. The
problem was the populate and depopulate calls were not symmetrical like
they were intended to be, and unpopulate depends on the parent device to
have it's of_node pointer pointing to the parent device node. Fix these
bugs so that the test case works correctly.

In the process, the test_bus used as a container for the test devices
has been changed from a statically allocated struct device (which is
bad) to a properly allocated device with a .release() method (which is
good). This stops the test code from being a bad example of abusing the
device model.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
Cc: Frank Rowand <frank.rowand@sonymobile.com>
Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Cc: Pawel Moll <pawel.moll@arm.com>
2015-03-29 08:56:20 +01:00
Frank Rowand 716e1d493a of/unittest: early return from test skips tests
Fix bugs pointed out by checkpatch: Mis-coding of two if statements
caused early return from function.

Number of tests completed increased from 102 to 107.
Number of tests failed increased from 0 to 2.

Signed-off-by: Frank Rowand <frank.rowand@sonymobile.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
2015-03-29 08:56:19 +01:00
Frank Rowand c8547119ce of/unittest: breadcrumbs to reduce pain of future maintainers
Fix warnings pointed out by checkpatch.

Checkpatch warns: externs should be avoided in .c files

Reducing pain for future maintainers - adding a comment so that anyone trying
to find where the extern data is created will be able to find it.
(grep will not find that location)

Signed-off-by: Frank Rowand <frank.rowand@sonymobile.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
2015-03-29 08:56:19 +01:00
Frank Rowand 3db316d00b of/unittest: reduce checkpatch noise - line after declarations
Fix warnings pointed out by checkpatch.

No bug fixes, but reduce the number of checkpatch warnings so that future
problems will stand out better.

Signed-off-by: Frank Rowand <frank.rowand@sonymobile.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
2015-03-29 08:56:18 +01:00
Frank Rowand a6bb121e16 of/unittest: typo in error string
Fix bug pointed out by checkpatch.

Splitting string incorrectly removed a space between two words.

Signed-off-by: Frank Rowand <frank.rowand@sonymobile.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
2015-03-29 08:56:18 +01:00
Frank Rowand afaed7a993 of/unittest: add const where needed
Fix warnings pointed out by checkpatch.

No bugs fixed, but the test code should be a good example of how to use
the devicetree API.

Signed-off-by: Frank Rowand <frank.rowand@sonymobile.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
2015-03-29 08:56:17 +01:00
Wang Long 9697a5595e of/unittest: replace 'selftest' with 'unittest'
This patch just replace the string 'selftest' with 'unittest'
in OF unittest and data and binding file.

I have tested it successfully on ARM.

Signed-off-by: Wang Long <long.wanglong@huawei.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2015-03-25 00:53:29 -05:00
Brian Norris 5ca1b0dd01 of: unittest: Add option string test case with longer path
There were regressions seen with commit 106937e8cc ("of: fix handling
of '/' in options for of_find_node_by_path()"), where we couldn't handle
extra '/' before the ':'. Let's test for this now.

Confirmed that this test fails without the previous patch and passes
when patched. All other tests pass.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
2015-03-19 08:39:44 -05:00
Peter Hurley 8cbba1ab1a of: unittest: Add options string testcase variants
Add testcase variants with '/' in the options string to test for
scan beyond end path name terminated by ':'.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2015-03-10 10:44:21 -05:00
Wang Long 649022e08e of/unittest: Fix the wrong expected value in of_selftest_property_string
This patch fix the wrong expected value of of_property_match_string
in of_selftest_property_string.

Signed-off-by: Wang Long <long.wanglong@huawei.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2015-03-10 10:34:34 -05:00
Wang Long dc6a9453eb of/unittest: remove the duplicate of_changeset_init
Remove the duplicate of_changeset_init. In of_selftest_changeset
testcase, the "struct of_changeset chgset" is initialized twice,
but only once is enough. so, drop the first initializtion code.

Signed-off-by: Wang Long <long.wanglong@huawei.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2015-03-10 10:34:34 -05:00
Arnd Bergmann 4252de39d6 of: unittest: fix I2C dependency
The unittest fails to link if I2C or I2C_MUX is a loadable module:

  drivers/built-in.o: In function `selftest_i2c_mux_remove':
  unittest.c:(.text+0xb0ce4): undefined reference to `i2c_del_mux_adapter'

This changes the newly added IS_ENABLED() checks to use IS_BUILTIN()
instead, which evaluates to false if the other driver is a module.

Reported-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: d5e75500ca ("of: unitest: Add I2C overlay unit tests.")
Signed-off-by: Rob Herring <robh@kernel.org>
2015-03-10 10:34:33 -05:00
Rob Herring 3c3c8e3618 Merge remote-tracking branch 'grant/devicetree/next' into for-next 2015-02-11 21:28:45 -06:00
Pantelis Antoniou d5e75500ca of: unitest: Add I2C overlay unit tests.
Introduce I2C device tree overlay tests.
Tests insertion and removal of i2c adapters, i2c devices, and muxes.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2015-02-04 10:43:14 -06:00
Rob Herring 962a70d05e Linux 3.19-rc6
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJUxbzlAAoJEHm+PkMAQRiGtqYIAJ8YlKX9cXKYmXx8/FncINH+
 2erj94KyHG080R1uwSq1+7zXWCZUUlxiJnDnsup5rG0dImcicqgOE48oHax1aN6b
 yHfPONkTjNJ1HYepuGC3YWCG9wIjPZQ5S8KHrwRjyVoE+ddhe9gWgvArA3jl/fW/
 2fYNWekoRoMcRiNb4/w2weyOOBywdSVpmj0WYiwdztysG2ymw5hUXRHJhvSf1AFm
 RQJfUHkhCOYpQGY7XFba/1uGhTJfOgDmYAfspAOLzmrXE/DJcCutsVdBZO+12fAL
 nhGpM/PkRYxMvwzDKIUoG35qsymYOMqo54oXhr0S2JjyXTGdGmB6qHxIfqnV5Tk=
 =O/Lr
 -----END PGP SIGNATURE-----

Merge tag 'v3.19-rc6' into HEAD

Linux 3.19-rc6
2015-02-04 10:43:01 -06:00
Pantelis Antoniou 6b1271de37 of/unittest: Overlays with sub-devices tests
Introduce selftests for overlays using sub-devices present
in children nodes.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
2015-01-23 13:10:07 +00:00
Grant Likely fca8ba4ee2 of/unittest: Remove obsolete code
Commit 3ce04b4a9, "Removes OF_UNITTEST dependency on OF_DYNAMIC config
symbol" removes a bunch of code, but missed a few minor bits. Clean it
up by removing the node removal cache and flag.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
Cc: Gaurav Minocha <gaurav.minocha.os@gmail.com>
Cc: Rob Herring <robh@kernel.org>
2015-01-22 17:07:36 +00:00
Gaurav Minocha 3ce04b4a9f Removes OF_UNITTEST dependency on OF_DYNAMIC config symbol
This patch intends to remove the unittests dependency on
the functions defined in dynamic.c. So, rather than calling
of_attach_node defined in dynamic.c, minimal functionality
required to attach a new node is re-defined in unittest.c.
Also, now after executing the tests the test data is not
removed from the device tree so there is no need to call
of_detach_node.

Tested with and without OF_DYNAMIC enabled on ppc, arm and
x86

Signed-off-by: Gaurav Minocha <gaurav.minocha.os@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2015-01-13 13:58:02 -06:00
Markus Elfring c46ca3c831 of: Delete unnecessary check before calling "of_node_put()"
The of_node_put() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
2014-12-03 23:12:41 +00:00
Leif Lindholm 75c28c09af of: add optional options parameter to of_find_node_by_path()
Update of_find_node_by_path():
1) Rename function to of_find_node_opts_by_path(), adding an optional
   pointer argument. Provide a static inline wrapper version of
   of_find_node_by_path() which calls the new function with NULL as
   the optional argument.
2) Ignore any part of the path beyond and including the ':' separator.
3) Set the new provided pointer argument to the beginning of the string
   following the ':' separator.
4: Add tests.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
2014-12-03 23:12:36 +00:00
Grant Likely 63ebecc03d of: Remove unneeded and incorrect MODULE_DEVICE_TABLE
The unittest code has a MODULE_DEVICE_TABLE that isn't needed by any of
the unittests, and isn't even correct. Remove it.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
2014-11-27 23:57:22 +00:00
Pantelis Antoniou 177d271cf3 of/overlay: Add overlay unittests
Add unittests for OF overlays.

It tests overlay device addition/removal and whether
the apply revert sequence is correct.

Changes since V1:
* Added local fixups entries.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
2014-11-24 22:25:13 +00:00
Grant Likely e51795815e of: Refactor __of_node_alloc() into __of_node_dup()
Add a node argument to __of_node_alloc() and rename it to
__of_node_dup() so that it can also be used to duplicate a node with
its properties. This is important for the overlay code so that it can
create new nodes without using separate changeset items for every single
property.

At the same time rework the overlay code to use the new function and
drop the extra changeset items.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
2014-11-24 22:24:41 +00:00
Grant Likely ef8bbd73a7 of: Use vargs in __of_node_alloc
The overlay code needs to construct a new full_name from the parent name
and the node name, but the current method has to allocate and then free
an temporary string which is wasteful. Fix this problem by using vargs
to pass in a format and arguments into __of_node_alloc().

At the same time remove the allocflags argument to __of_node_alloc().
The only users all use GFP_KERNEL, so there is no need to provide it as
an option. If there is ever a need later it can be added back.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
2014-11-24 22:23:35 +00:00
Grant Likely 66e6a5a1fc Linux 3.18-rc6
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJUcmzrAAoJEHm+PkMAQRiGUskH/il9ul71lyyvrA/bRbi0GfUa
 2Ej1Q4Fa/SRzLMiWF8Wy/AlYBbl4/uD3a3XEueK4f9dNguTLZF/rwXTlKKzUeiGg
 zFObbJg3zfa926PQcEV5mc+h71ZkWmbH5CjF6GfYIlj6kjVa5MXF3lSZz27DoAx3
 DjoLKpj1fXQJu1HD7xvUn0r720RgYfic9iKdS69eEYex+Js92WySukogvMG5WAVD
 xuwlJcJgm0YpgNr1t1ij4ekE5XR9jjiE4EXbOZYWcOOd+YXAwZpBrKOgxP0gma3w
 OGwEvmAbzf/3IsGq3dPFYWQ2nfiLA/Qh7y20E19FLKpPBu5ZuTEgFU8VTxh+k+g=
 =rRmA
 -----END PGP SIGNATURE-----

Merge tag 'v3.18-rc6' into devicetree/next

v3.18-rc6 contains an important DT bug fix, c1a2086e2d, "of/selftest:
Fix off-by-one error in removal path" which affects testing of the
overlay patch series. Merge it into the devicetree/next staging branch
so that the overlay patches are applied on top of a known working tree.

Linux 3.18-rc6

Conflicts:
	drivers/of/address.c
2014-11-24 14:50:07 +00:00
Grant Likely 19fd74879a of/unittest: Rename selftest.c to unittest.c
This is unit testing code. It should use that name because it makes more
sense than 'selftest'. Rename the files to match and rename the config
variable.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
2014-11-04 16:43:07 +00:00