summaryrefslogtreecommitdiff
path: root/drivers/of/unittest.c
AgeCommit message (Collapse)Author
2015-04-24Merge tag 'devicetree-for-4.1' of ↵Linus Torvalds
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-14of: unittest: overlay: Keep track of created overlaysPantelis Antoniou
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-03-29Merge remote-tracking branch 'robh/for-next' into devicetree/nextGrant Likely
Conflicts: drivers/of/unittest.c
2015-03-29of/unittest: Fix of_platform_depopulate test caseGrant Likely
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-29of/unittest: early return from test skips testsFrank Rowand
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-29of/unittest: breadcrumbs to reduce pain of future maintainersFrank Rowand
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-29of/unittest: reduce checkpatch noise - line after declarationsFrank Rowand
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-29of/unittest: typo in error stringFrank Rowand
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-29of/unittest: add const where neededFrank Rowand
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-25of/unittest: replace 'selftest' with 'unittest'Wang Long
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-19of: unittest: Add option string test case with longer pathBrian Norris
There were regressions seen with commit 106937e8ccdc ("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-10of: unittest: Add options string testcase variantsPeter Hurley
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-10of/unittest: Fix the wrong expected value in of_selftest_property_stringWang Long
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-10of/unittest: remove the duplicate of_changeset_initWang Long
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-10of: unittest: fix I2C dependencyArnd Bergmann
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: d5e75500ca401 ("of: unitest: Add I2C overlay unit tests.") Signed-off-by: Rob Herring <robh@kernel.org>
2015-02-11Merge remote-tracking branch 'grant/devicetree/next' into for-nextRob Herring
2015-02-04of: unitest: Add I2C overlay unit tests.Pantelis Antoniou
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-04Merge tag 'v3.19-rc6' into HEADRob Herring
Linux 3.19-rc6
2015-01-23of/unittest: Overlays with sub-devices testsPantelis Antoniou
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-22of/unittest: Remove obsolete codeGrant Likely
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-13Removes OF_UNITTEST dependency on OF_DYNAMIC config symbolGaurav Minocha
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>
2014-12-03of: Delete unnecessary check before calling "of_node_put()"Markus Elfring
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-03of: add optional options parameter to of_find_node_by_path()Leif Lindholm
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-11-27of: Remove unneeded and incorrect MODULE_DEVICE_TABLEGrant Likely
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-24of/overlay: Add overlay unittestsPantelis Antoniou
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-24of: Refactor __of_node_alloc() into __of_node_dup()Grant Likely
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-24of: Use vargs in __of_node_allocGrant Likely
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-24Merge tag 'v3.18-rc6' into devicetree/nextGrant Likely
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-04of/unittest: Rename selftest.c to unittest.cGrant Likely
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>