Re: [PATCH v4 06/16] of: unittest: changeset helpers
On Wed, Feb 21, 2018 at 5:39 PM, Laurent Pinchartwrote: > Hi Rob, > > On Thursday, 22 February 2018 01:10:25 EET Rob Herring wrote: >> On Tue, Feb 20, 2018 at 5:10 PM, Laurent Pinchart wrote: >> > From: Pantelis Antoniou >> > >> > Add a unitest specific for the new changeset helpers. >> > >> > Signed-off-by: Pantelis Antoniou >> > Signed-off-by: Laurent Pinchart >> > >> > --- >> > >> > drivers/of/unittest.c | 54 ++ >> > 1 file changed, 54 insertions(+) >> > >> > diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c >> > index 7a9abaae874d..1b21d2c549a8 100644 >> > --- a/drivers/of/unittest.c >> > +++ b/drivers/of/unittest.c >> > @@ -609,6 +609,59 @@ static void __init of_unittest_changeset(void) >> > >> > #endif >> > } >> > >> > +static void __init of_unittest_changeset_helper(void) >> > +{ >> > +#ifdef CONFIG_OF_DYNAMIC >> >> I think this can be: >> >> if (!IS_ENABLED(CONFIG_OF_DYNAMIC)) >> return; > > Not quite, as there are functions used below (such as of_changeset_init()) > that are not defined if CONFIG_OF_DYNAMIC isn't enabled. We could create stubs > in that case but I believe that's out of scope for this patch series. Okay. I thought we had the necessary stubs, but didn't check too closely. > >> Otherwise, >> >> Reviewed-by: Rob Herring > > -- > Regards, > > Laurent Pinchart > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 06/16] of: unittest: changeset helpers
Hi Rob, On Thursday, 22 February 2018 01:10:25 EET Rob Herring wrote: > On Tue, Feb 20, 2018 at 5:10 PM, Laurent Pinchart wrote: > > From: Pantelis Antoniou> > > > Add a unitest specific for the new changeset helpers. > > > > Signed-off-by: Pantelis Antoniou > > Signed-off-by: Laurent Pinchart > > > > --- > > > > drivers/of/unittest.c | 54 ++ > > 1 file changed, 54 insertions(+) > > > > diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c > > index 7a9abaae874d..1b21d2c549a8 100644 > > --- a/drivers/of/unittest.c > > +++ b/drivers/of/unittest.c > > @@ -609,6 +609,59 @@ static void __init of_unittest_changeset(void) > > > > #endif > > } > > > > +static void __init of_unittest_changeset_helper(void) > > +{ > > +#ifdef CONFIG_OF_DYNAMIC > > I think this can be: > > if (!IS_ENABLED(CONFIG_OF_DYNAMIC)) > return; Not quite, as there are functions used below (such as of_changeset_init()) that are not defined if CONFIG_OF_DYNAMIC isn't enabled. We could create stubs in that case but I believe that's out of scope for this patch series. > Otherwise, > > Reviewed-by: Rob Herring -- Regards, Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 06/16] of: unittest: changeset helpers
On Tue, Feb 20, 2018 at 5:10 PM, Laurent Pinchartwrote: > From: Pantelis Antoniou > > Add a unitest specific for the new changeset helpers. > > Signed-off-by: Pantelis Antoniou > Signed-off-by: Laurent Pinchart > --- > drivers/of/unittest.c | 54 > +++ > 1 file changed, 54 insertions(+) > > diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c > index 7a9abaae874d..1b21d2c549a8 100644 > --- a/drivers/of/unittest.c > +++ b/drivers/of/unittest.c > @@ -609,6 +609,59 @@ static void __init of_unittest_changeset(void) > #endif > } > > +static void __init of_unittest_changeset_helper(void) > +{ > +#ifdef CONFIG_OF_DYNAMIC I think this can be: if (!IS_ENABLED(CONFIG_OF_DYNAMIC)) return; Otherwise, Reviewed-by: Rob Herring ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v4 06/16] of: unittest: changeset helpers
From: Pantelis AntoniouAdd a unitest specific for the new changeset helpers. Signed-off-by: Pantelis Antoniou Signed-off-by: Laurent Pinchart --- drivers/of/unittest.c | 54 +++ 1 file changed, 54 insertions(+) diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 7a9abaae874d..1b21d2c549a8 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -609,6 +609,59 @@ static void __init of_unittest_changeset(void) #endif } +static void __init of_unittest_changeset_helper(void) +{ +#ifdef CONFIG_OF_DYNAMIC + struct device_node *n1, *n2, *n21, *parent, *np; + struct of_changeset chgset; + + of_changeset_init(); + + parent = of_find_node_by_path("/testcase-data/changeset"); + + unittest(parent, "testcase setup failure\n"); + n1 = of_changeset_create_device_node(, + parent, "/testcase-data/changeset/n1"); + unittest(n1, "testcase setup failure\n"); + n2 = of_changeset_create_device_node(, + parent, "/testcase-data/changeset/n2"); + unittest(n2, "testcase setup failure\n"); + n21 = of_changeset_create_device_node(, n2, "%s/%s", + "/testcase-data/changeset/n2", "n21"); + unittest(n21, "testcase setup failure\n"); + + unittest(!of_changeset_add_property_string(, parent, + "prop-add", "foo"), "fail add prop\n"); + + unittest(!of_changeset_attach_node(, n1), "fail n1 attach\n"); + unittest(!of_changeset_attach_node(, n2), "fail n2 attach\n"); + unittest(!of_changeset_attach_node(, n21), "fail n21 attach\n"); + + unittest(!of_changeset_apply(), "apply failed\n"); + + /* Make sure node names are constructed correctly */ + np = of_find_node_by_path("/testcase-data/changeset/n1"); + unittest(np, "'%s' not added\n", n1->full_name); + of_node_put(np); + + /* Make sure node names are constructed correctly */ + np = of_find_node_by_path("/testcase-data/changeset/n2"); + unittest(np, "'%s' not added\n", n2->full_name); + of_node_put(np); + + np = of_find_node_by_path("/testcase-data/changeset/n2/n21"); + unittest(np, "'%s' not added\n", n21->full_name); + of_node_put(np); + + unittest(!of_changeset_revert(), "revert failed\n"); + + of_changeset_destroy(); + + of_node_put(parent); +#endif +} + + static void __init of_unittest_parse_interrupts(void) { struct device_node *np; @@ -2363,6 +2416,7 @@ static int __init of_unittest(void) of_unittest_property_string(); of_unittest_property_copy(); of_unittest_changeset(); + of_unittest_changeset_helper(); of_unittest_parse_interrupts(); of_unittest_parse_interrupts_extended(); of_unittest_match_node(); -- Regards, Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel