Hi Simon, I have a discussion with Marek and as per him this patch is wrongly assigned to him in patchwork. This patch supposed to be picked up by you.
I will rebase this patch to latest master and send it you. Regards, Biju > -----Original Message----- > From: Biju Das > Sent: 15 February 2021 08:19 > To: Simon Glass <s...@chromium.org>; Marek Vasut > <marek.vasut+rene...@gmail.com>; Tom Rini <tr...@konsulko.com> > Cc: u-boot@lists.denx.de; Adam Ford <aford...@gmail.com>; Marek Vasut > <marek.vasut+rene...@gmail.com>; Nobuhiro Iwamatsu <iwama...@nigauri.org>; > Chris Paterson <chris.paters...@renesas.com>; Prabhakar Mahadev Lad > <prabhakar.mahadev-lad...@bp.renesas.com> > Subject: RE: [PATCH v5] dm: core: Add of_match_node helper function > > Hi All, > > Gentle remainder. Are we happy with this patch[1]? > > Not sure who needs to merge this patch. Currently this patch has been > delegated to Marek and is reviewed by Simon. > > [1] https://patchwork.ozlabs.org/project/uboot/patch/20210116124042.24007- > 1-biju.das...@bp.renesas.com/ > > Regards, > Biju > > > -----Original Message----- > > From: Biju Das <biju.das...@bp.renesas.com> > > Sent: 16 January 2021 12:41 > > To: Simon Glass <s...@chromium.org> > > Cc: Biju Das <biju.das...@bp.renesas.com>; u-boot@lists.denx.de; Tom > > Rini <tr...@konsulko.com>; Adam Ford <aford...@gmail.com>; Marek Vasut > > <marek.vasut+rene...@gmail.com>; Nobuhiro Iwamatsu > > <iwama...@nigauri.org>; Chris Paterson <chris.paters...@renesas.com>; > > Prabhakar Mahadev Lad <prabhakar.mahadev-lad...@bp.renesas.com> > > Subject: [PATCH v5] dm: core: Add of_match_node helper function > > > > Add of_match_node() helper function to iterate over the device tree > > and tell if a device_node has a matching of_match structure. > > > > Signed-off-by: Biju Das <biju.das...@bp.renesas.com> > > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad...@bp.renesas.com> > > Reviewed-by: Simon Glass <s...@chromium.org> > > --- > > v4->v5: > > * Rebased to latest master > > v3->v4: No change > > * Added Simon's Rb tag. > > v2->v3: > > * Added a test case for of_match_node helper function. > > (Ref: > > https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatc > > hwor > > k.ozlabs.org%2Fproject%2Fuboot%2Fpatch%2F20201102150959.4793-2- > > biju.das.jz%40bp.renesas.com%2F&data=04%7C01%7Cbiju.das.jz%40bp.re > > nesa > > s.com%7C9a457b5b5cef4377a0a608d8ba1bf25f%7C53d82571da1947e49cb4625a166 > > a4a2 > > a%7C0%7C0%7C637463976644445584%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA > > wMDA > > iLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=0DB8m > > 2aLk > > J0YqTFtjqXBpOmYpQAZO7eh7omBDGzrNR4%3D&reserved=0) > > v1->v2: > > * No Change > > v1: > > * New Patch > > --- > > drivers/core/device.c | 21 +++++++++++++++++++++ > > include/dm/device.h | 13 +++++++++++++ > > test/dm/core.c | 31 +++++++++++++++++++++++++++++++ > > 3 files changed, 65 insertions(+) > > > > diff --git a/drivers/core/device.c b/drivers/core/device.c index > > aeab3836ed..4ff708fd38 100644 > > --- a/drivers/core/device.c > > +++ b/drivers/core/device.c > > @@ -1022,6 +1022,27 @@ bool of_machine_is_compatible(const char *compat) > > return !fdt_node_check_compatible(fdt, 0, compat); } > > > > +static > > +const struct udevice_id *__of_match_node(const struct udevice_id > > *matches, > > + const ofnode node) > > +{ > > + if (!matches) > > + return NULL; > > + > > + for (; matches->compatible; matches++) { > > + if (ofnode_device_is_compatible(node, matches->compatible)) > > + return matches; > > + } > > + > > + return NULL; > > +} > > + > > +const struct udevice_id *of_match_node(const struct udevice_id > *matches, > > + const ofnode node) > > +{ > > + return __of_match_node(matches, node); } > > + > > int dev_disable_by_path(const char *path) { > > struct uclass *uc; > > diff --git a/include/dm/device.h b/include/dm/device.h index > > f5b4cd6876..950fc78184 100644 > > --- a/include/dm/device.h > > +++ b/include/dm/device.h > > @@ -802,6 +802,19 @@ bool device_is_compatible(const struct udevice > > *dev, const char *compat); > > */ > > bool of_machine_is_compatible(const char *compat); > > > > +/** > > + * of_match_node() - Tell if a device_node has a matching of_match > > +structure > > + * > > + * > > + * Low level utility function used by device matching. > > + * > > + * @matches: array of of device match structures to search in > > + * @node: the of device structure to match against > > + * @return matching structure on success, NULL if the match is not > > +found */ const struct udevice_id *of_match_node(const struct > > +udevice_id *matches, > > + const ofnode node); > > + > > /** > > * dev_disable_by_path() - Disable a device given its device tree path > > * > > diff --git a/test/dm/core.c b/test/dm/core.c index > > 1f5ca570dc..aae4d8427d > > 100644 > > --- a/test/dm/core.c > > +++ b/test/dm/core.c > > @@ -11,6 +11,7 @@ > > #include <fdtdec.h> > > #include <log.h> > > #include <malloc.h> > > +#include <dm/device.h> > > #include <dm/device-internal.h> > > #include <dm/root.h> > > #include <dm/util.h> > > @@ -1067,6 +1068,36 @@ static int dm_test_inactive_child(struct > > unit_test_state *uts) } DM_TEST(dm_test_inactive_child, > > UT_TESTF_SCAN_PDATA); > > > > +static int dm_test_of_match_node(struct unit_test_state *uts) { > > + const ulong test_data_expected = 0x1234; > > + ofnode root_node = ofnode_path("/"); > > + const struct udevice_id *match; > > + unsigned long match_data; > > + > > + const struct udevice_id soc_device_ids[] = { > > + { .compatible = "sandbox", .data = test_data_expected, }, > > + { /* sentinel */ } > > + }; > > + > > + const struct udevice_id soc_device_nomatch_ids[] = { > > + { .compatible = "sandbox123", .data = test_data_expected, }, > > + { /* sentinel */ } > > + }; > > + > > + match = of_match_node(soc_device_ids, root_node); > > + ut_assert(match); > > + > > + match_data = match->data; > > + ut_asserteq(match_data, test_data_expected); > > + > > + match = of_match_node(soc_device_nomatch_ids, root_node); > > + ut_asserteq_ptr(match, NULL); > > + > > + return 0; > > +} > > +DM_TEST(dm_test_of_match_node, UT_TESTF_SCAN_PDATA | > > +UT_TESTF_SCAN_FDT); > > + > > /* Make sure all bound devices have a sequence number */ static int > > dm_test_all_have_seq(struct unit_test_state *uts) { > > -- > > 2.17.1