From: Michael Auchter <michael.auchter@ni.com>
To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: saravanak@google.com, robh+dt@kernel.org, frowand.list@gmail.com,
gregkh@linuxfoundation.org, rafael@kernel.org,
Michael Auchter <michael.auchter@ni.com>
Subject: [RFC PATCH 1/3] of: unittest: add test of overlay with devlinks
Date: Wed, 14 Oct 2020 14:36:13 -0500 [thread overview]
Message-ID: <20201014193615.1045792-2-michael.auchter@ni.com> (raw)
In-Reply-To: <20201014193615.1045792-1-michael.auchter@ni.com>
This adds a unittest to test applying/reverting an overlay that contains
a link between two devices.
Signed-off-by: Michael Auchter <michael.auchter@ni.com>
---
drivers/of/unittest-data/Makefile | 1 +
drivers/of/unittest-data/overlay_16.dts | 26 +++++++++++++++++++++++++
drivers/of/unittest.c | 16 +++++++++++++++
3 files changed, 43 insertions(+)
create mode 100644 drivers/of/unittest-data/overlay_16.dts
diff --git a/drivers/of/unittest-data/Makefile b/drivers/of/unittest-data/Makefile
index 009f4045c8e4..91a1ebbc451b 100644
--- a/drivers/of/unittest-data/Makefile
+++ b/drivers/of/unittest-data/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_OF_OVERLAY) += overlay.dtb.o \
overlay_12.dtb.o \
overlay_13.dtb.o \
overlay_15.dtb.o \
+ overlay_16.dtb.o \
overlay_bad_add_dup_node.dtb.o \
overlay_bad_add_dup_prop.dtb.o \
overlay_bad_phandle.dtb.o \
diff --git a/drivers/of/unittest-data/overlay_16.dts b/drivers/of/unittest-data/overlay_16.dts
new file mode 100644
index 000000000000..eda206e2ebca
--- /dev/null
+++ b/drivers/of/unittest-data/overlay_16.dts
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+/plugin/;
+
+/* overlay_16 - device links */
+
+&unittest_test_bus {
+
+ /* suppress DTC warning */
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ unittest16: test-unittest16 {
+ #clock-cells = <0>;
+ compatible = "unittest";
+ status = "okay";
+ reg = <16>;
+ };
+
+ test-unittest161 {
+ compatible = "unittest";
+ status = "okay";
+ reg = <161>;
+ clocks = <&unittest16>;
+ };
+};
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 5579584758b7..d94dafb3746f 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -2369,6 +2369,18 @@ static void __init of_unittest_overlay_11(void)
unittest(ret == 0, "overlay test %d failed; overlay apply\n", 11);
}
+/* test insertion of an overlay that references another node */
+static void __init of_unittest_overlay_16(void)
+{
+ int ret;
+
+ /* device should disable */
+ ret = of_unittest_apply_revert_overlay_check(16, 16, 0, 1,
+ PDEV_OVERLAY);
+
+ unittest(ret == 0, "overlay test %d failed; overlay apply\n", 16);
+}
+
#if IS_BUILTIN(CONFIG_I2C) && IS_ENABLED(CONFIG_OF_OVERLAY)
struct unittest_i2c_bus_data {
@@ -2757,6 +2769,8 @@ static void __init of_unittest_overlay(void)
of_unittest_overlay_i2c_cleanup();
#endif
+ of_unittest_overlay_16();
+
of_unittest_overlay_gpio();
of_unittest_destroy_tracked_overlays();
@@ -2812,6 +2826,7 @@ OVERLAY_INFO_EXTERN(overlay_11);
OVERLAY_INFO_EXTERN(overlay_12);
OVERLAY_INFO_EXTERN(overlay_13);
OVERLAY_INFO_EXTERN(overlay_15);
+OVERLAY_INFO_EXTERN(overlay_16);
OVERLAY_INFO_EXTERN(overlay_gpio_01);
OVERLAY_INFO_EXTERN(overlay_gpio_02a);
OVERLAY_INFO_EXTERN(overlay_gpio_02b);
@@ -2842,6 +2857,7 @@ static struct overlay_info overlays[] = {
OVERLAY_INFO(overlay_12, 0),
OVERLAY_INFO(overlay_13, 0),
OVERLAY_INFO(overlay_15, 0),
+ OVERLAY_INFO(overlay_16, 0),
OVERLAY_INFO(overlay_gpio_01, 0),
OVERLAY_INFO(overlay_gpio_02a, 0),
OVERLAY_INFO(overlay_gpio_02b, 0),
--
2.25.4
next prev parent reply other threads:[~2020-10-14 19:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-14 19:36 [RFC PATCH 0/3] Fix errors on DT overlay removal with devlinks Michael Auchter
2020-10-14 19:36 ` Michael Auchter [this message]
2020-10-14 19:36 ` [RFC PATCH 2/3] driver core: add device_links_barrier Michael Auchter
2020-10-14 19:36 ` [RFC PATCH 3/3] of: dynamic: add device links barrier before detach Michael Auchter
2020-10-15 21:34 ` [RFC PATCH 0/3] Fix errors on DT overlay removal with devlinks Frank Rowand
2020-10-21 21:02 ` Frank Rowand
2020-10-26 19:10 ` Saravana Kannan
2020-10-28 16:25 ` Michael Auchter
2020-10-28 18:03 ` Saravana Kannan
2020-10-29 20:54 ` Frank Rowand
2020-10-29 21:13 ` Michael Auchter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201014193615.1045792-2-michael.auchter@ni.com \
--to=michael.auchter@ni.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=robh+dt@kernel.org \
--cc=saravanak@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox