[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0hVRd2pYfGwpa4FLwhtrS2pj9Ng2a2gf61BO5F-94PPXQ@mail.gmail.com>
Date: Mon, 16 Nov 2020 17:27:08 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Saravana Kannan <saravanak@...gle.com>
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Ard Biesheuvel <ardb@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
Marc Zyngier <maz@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Tomi Valkeinen <tomi.valkeinen@...com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Grygorii Strashko <grygorii.strashko@...com>,
"Cc: Android Kernel" <kernel-team@...roid.com>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-efi <linux-efi@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>
Subject: Re: [PATCH v1 13/18] driver core: Add fwnode_get_next_parent_dev()
helper function
On Thu, Nov 5, 2020 at 12:24 AM Saravana Kannan <saravanak@...gle.com> wrote:
>
> Given a fwnode, this function finds the closest ancestor fwnode that has
> a corresponding struct device. The function returns this struct device.
> This function will be used in a subsequent patch in this series.
>
> Signed-off-by: Saravana Kannan <saravanak@...gle.com>
I would combine this one with patch [10/18].
> ---
> drivers/base/core.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index ee28d8c7ee85..4ae5f2885ac5 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -1562,6 +1562,31 @@ static void fw_devlink_parse_fwtree(struct fwnode_handle *fwnode)
> fw_devlink_parse_fwtree(child);
> }
>
> +/**
> + * fwnode_get_next_parent_dev - Find device of closest ancestor fwnode
> + * @fwnode: firmware node
> + *
> + * Given a firmware node (@fwnode), this function finds its closest ancestor
> + * firmware node that has a corresponding struct device and returns that struct
> + * device.
> + *
> + * The caller of this function is expected to call put_device() on the returned
> + * device when they are done.
> + */
> +static struct device *fwnode_get_next_parent_dev(struct fwnode_handle *fwnode)
> +{
> + struct device *dev = NULL;
> +
> + fwnode_handle_get(fwnode);
> + do {
> + fwnode = fwnode_get_next_parent(fwnode);
> + if (fwnode)
> + dev = get_dev_from_fwnode(fwnode);
> + } while (fwnode && !dev);
> + fwnode_handle_put(fwnode);
> + return dev;
> +}
> +
> static void fw_devlink_link_device(struct device *dev)
> {
> int fw_ret;
> --
> 2.29.1.341.ge80a0c044ae-goog
>
Powered by blists - more mailing lists