Re: [PATCH v6 3/3] of/property: Add of_fwnode_name()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 11, 2018 at 2:15 PM Heikki Krogerus
<heikki.krogerus@xxxxxxxxxxxxxxx> wrote:
>
> This implements get_name fwnode op for DT.
>
> Signed-off-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>

Rob, any objections here?

> ---
>  drivers/of/property.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/drivers/of/property.c b/drivers/of/property.c
> index 08430031bd28..5c10fdded473 100644
> --- a/drivers/of/property.c
> +++ b/drivers/of/property.c
> @@ -823,6 +823,18 @@ static void of_fwnode_put(struct fwnode_handle *fwnode)
>         of_node_put(to_of_node(fwnode));
>  }
>
> +static int of_fwnode_get_name(const struct fwnode_handle *fwnode, char *buf,
> +                             size_t len)
> +{
> +       const struct device_node *node = to_of_node(fwnode);
> +
> +       if (len < snprintf(NULL, 0, "%pOFn", node) + 1)
> +               return -EOVERFLOW;
> +
> +       sprintf(buf, "%pOFn", node);
> +       return 0;
> +}
> +
>  static bool of_fwnode_device_is_available(const struct fwnode_handle *fwnode)
>  {
>         return of_device_is_available(to_of_node(fwnode));
> @@ -987,6 +999,7 @@ of_fwnode_device_get_match_data(const struct fwnode_handle *fwnode,
>  const struct fwnode_operations of_fwnode_ops = {
>         .get = of_fwnode_get,
>         .put = of_fwnode_put,
> +       .get_name = of_fwnode_get_name,
>         .device_is_available = of_fwnode_device_is_available,
>         .device_get_match_data = of_fwnode_device_get_match_data,
>         .property_present = of_fwnode_property_present,
> --
> 2.19.2
>



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux