From: Julien Grall <julien.grall@arm.com> To: Oleksandr Tyshchenko <olekstysh@gmail.com>, xen-devel@lists.xenproject.org Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>, sstabellini@kernel.org Subject: Re: [PATCH V1 1/2] xen/device-tree: Add dt_count_phandle_with_args helper Date: Wed, 29 May 2019 18:34:09 +0100 [thread overview] Message-ID: <19c47d6b-344b-ac4a-b4d1-c0498500f863@arm.com> (raw) In-Reply-To: <1558460254-7127-2-git-send-email-olekstysh@gmail.com> Hi Oleksandr, On 21/05/2019 18:37, Oleksandr Tyshchenko wrote: > From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> > > Port Linux helper of_count_phandle_with_args for counting > number of phandles in a property. > > Please note, this helper is ported from Linux v4.6. > > Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> Acked-by: Julien Grall <julien.grall@arm.com> Cheers, > > --- > Changes RFC -> V1: > - Add Linux version which is used as the base. > --- > xen/common/device_tree.c | 7 +++++++ > xen/include/xen/device_tree.h | 19 +++++++++++++++++++ > 2 files changed, 26 insertions(+) > > diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c > index 8fc401d..65862b5 100644 > --- a/xen/common/device_tree.c > +++ b/xen/common/device_tree.c > @@ -1663,6 +1663,13 @@ int dt_parse_phandle_with_args(const struct dt_device_node *np, > index, out_args); > } > > +int dt_count_phandle_with_args(const struct dt_device_node *np, > + const char *list_name, > + const char *cells_name) > +{ > + return __dt_parse_phandle_with_args(np, list_name, cells_name, 0, -1, NULL); > +} > + > /** > * unflatten_dt_node - Alloc and populate a device_node from the flat tree > * @fdt: The parent device tree blob > diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h > index 7408a6c..8315629 100644 > --- a/xen/include/xen/device_tree.h > +++ b/xen/include/xen/device_tree.h > @@ -738,6 +738,25 @@ int dt_parse_phandle_with_args(const struct dt_device_node *np, > const char *cells_name, int index, > struct dt_phandle_args *out_args); > > +/** > + * dt_count_phandle_with_args() - Find the number of phandles references in a property > + * @np: pointer to a device tree node containing a list > + * @list_name: property name that contains a list > + * @cells_name: property name that specifies phandles' arguments count > + * > + * Returns the number of phandle + argument tuples within a property. It > + * is a typical pattern to encode a list of phandle and variable > + * arguments into a single property. The number of arguments is encoded > + * by a property in the phandle-target node. For example, a gpios > + * property would contain a list of GPIO specifies consisting of a > + * phandle and 1 or more arguments. The number of arguments are > + * determined by the #gpio-cells property in the node pointed to by the > + * phandle. > + */ > +int dt_count_phandle_with_args(const struct dt_device_node *np, > + const char *list_name, > + const char *cells_name); > + > #ifdef CONFIG_DEVICE_TREE_DEBUG > #define dt_dprintk(fmt, args...) \ > printk(XENLOG_DEBUG fmt, ## args) > -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
WARNING: multiple messages have this Message-ID (diff)
From: Julien Grall <julien.grall@arm.com> To: Oleksandr Tyshchenko <olekstysh@gmail.com>, xen-devel@lists.xenproject.org Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>, sstabellini@kernel.org Subject: Re: [Xen-devel] [PATCH V1 1/2] xen/device-tree: Add dt_count_phandle_with_args helper Date: Wed, 29 May 2019 18:34:09 +0100 [thread overview] Message-ID: <19c47d6b-344b-ac4a-b4d1-c0498500f863@arm.com> (raw) Message-ID: <20190529173409.8vh6WQ5mWXu1xZsW9uFU4Mg3wD-hL4OOG_8K8SRT6Gc@z> (raw) In-Reply-To: <1558460254-7127-2-git-send-email-olekstysh@gmail.com> Hi Oleksandr, On 21/05/2019 18:37, Oleksandr Tyshchenko wrote: > From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> > > Port Linux helper of_count_phandle_with_args for counting > number of phandles in a property. > > Please note, this helper is ported from Linux v4.6. > > Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> Acked-by: Julien Grall <julien.grall@arm.com> Cheers, > > --- > Changes RFC -> V1: > - Add Linux version which is used as the base. > --- > xen/common/device_tree.c | 7 +++++++ > xen/include/xen/device_tree.h | 19 +++++++++++++++++++ > 2 files changed, 26 insertions(+) > > diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c > index 8fc401d..65862b5 100644 > --- a/xen/common/device_tree.c > +++ b/xen/common/device_tree.c > @@ -1663,6 +1663,13 @@ int dt_parse_phandle_with_args(const struct dt_device_node *np, > index, out_args); > } > > +int dt_count_phandle_with_args(const struct dt_device_node *np, > + const char *list_name, > + const char *cells_name) > +{ > + return __dt_parse_phandle_with_args(np, list_name, cells_name, 0, -1, NULL); > +} > + > /** > * unflatten_dt_node - Alloc and populate a device_node from the flat tree > * @fdt: The parent device tree blob > diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h > index 7408a6c..8315629 100644 > --- a/xen/include/xen/device_tree.h > +++ b/xen/include/xen/device_tree.h > @@ -738,6 +738,25 @@ int dt_parse_phandle_with_args(const struct dt_device_node *np, > const char *cells_name, int index, > struct dt_phandle_args *out_args); > > +/** > + * dt_count_phandle_with_args() - Find the number of phandles references in a property > + * @np: pointer to a device tree node containing a list > + * @list_name: property name that contains a list > + * @cells_name: property name that specifies phandles' arguments count > + * > + * Returns the number of phandle + argument tuples within a property. It > + * is a typical pattern to encode a list of phandle and variable > + * arguments into a single property. The number of arguments is encoded > + * by a property in the phandle-target node. For example, a gpios > + * property would contain a list of GPIO specifies consisting of a > + * phandle and 1 or more arguments. The number of arguments are > + * determined by the #gpio-cells property in the node pointed to by the > + * phandle. > + */ > +int dt_count_phandle_with_args(const struct dt_device_node *np, > + const char *list_name, > + const char *cells_name); > + > #ifdef CONFIG_DEVICE_TREE_DEBUG > #define dt_dprintk(fmt, args...) \ > printk(XENLOG_DEBUG fmt, ## args) > -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-05-29 17:34 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-21 17:37 [PATCH V1 0/2] Add ability to handle nodes with interrupts-extended property Oleksandr Tyshchenko 2019-05-21 17:37 ` [Xen-devel] " Oleksandr Tyshchenko 2019-05-21 17:37 ` [PATCH V1 1/2] xen/device-tree: Add dt_count_phandle_with_args helper Oleksandr Tyshchenko 2019-05-21 17:37 ` [Xen-devel] " Oleksandr Tyshchenko 2019-05-29 17:34 ` Julien Grall [this message] 2019-05-29 17:34 ` Julien Grall 2019-05-21 17:37 ` [PATCH V1 2/2] xen/device-tree: Add ability to handle nodes with interrupts-extended prop Oleksandr Tyshchenko 2019-05-21 17:37 ` [Xen-devel] " Oleksandr Tyshchenko 2019-05-29 17:44 ` Julien Grall 2019-05-29 17:44 ` [Xen-devel] " Julien Grall 2019-05-29 17:58 ` Oleksandr 2019-05-29 17:58 ` [Xen-devel] " Oleksandr 2019-05-29 18:18 ` Julien Grall 2019-05-29 18:18 ` [Xen-devel] " Julien Grall 2019-06-10 19:45 ` Julien Grall 2019-06-11 16:15 ` Oleksandr
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=19c47d6b-344b-ac4a-b4d1-c0498500f863@arm.com \ --to=julien.grall@arm.com \ --cc=oleksandr_tyshchenko@epam.com \ --cc=olekstysh@gmail.com \ --cc=sstabellini@kernel.org \ --cc=xen-devel@lists.xenproject.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.