lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190328113156.o5wfxcww5mphmd6i@kekkonen.localdomain>
Date:   Thu, 28 Mar 2019 13:31:56 +0200
From:   Sakari Ailus <sakari.ailus@...ux.intel.com>
To:     "Rafael J. Wysocki" <rafael@...nel.org>
Cc:     Petr Mladek <pmladek@...e.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        Rob Herring <robh@...nel.org>
Subject: Re: [PATCH v2 2/6] device property: Add fwnode_get_name for
 returning the name of a node

Hi Rafael,

On Thu, Mar 28, 2019 at 10:45:57AM +0100, Rafael J. Wysocki wrote:
> On Tue, Mar 26, 2019 at 1:41 PM Sakari Ailus
> <sakari.ailus@...ux.intel.com> wrote:
> >
> > The fwnode framework did not have means to obtain the name of a node. Add
> > that now, in form of the fwnode_get_name() function and a corresponding
> > get_name fwnode op. OF and ACPI support is included.
> >
> > Signed-off-by: Sakari Ailus <sakari.ailus@...ux.intel.com>
> > ---
> >  drivers/acpi/property.c  | 24 ++++++++++++++++++++++++
> >  drivers/base/property.c  | 11 +++++++++++
> >  drivers/of/property.c    |  6 ++++++
> >  include/linux/fwnode.h   |  2 ++
> >  include/linux/property.h |  1 +
> >  5 files changed, 44 insertions(+)
> >
> > diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
> > index 77abe0ec4043..8c9a4c02cde2 100644
> > --- a/drivers/acpi/property.c
> > +++ b/drivers/acpi/property.c
> > @@ -1291,6 +1291,29 @@ acpi_fwnode_get_reference_args(const struct fwnode_handle *fwnode,
> >                                                   args_count, args);
> >  }
> >
> > +static const char *acpi_fwnode_get_name(const struct fwnode_handle *fwnode)
> > +{
> > +       const struct acpi_device *adev;
> > +       struct fwnode_handle *parent;
> > +
> > +       parent = fwnode_get_parent(fwnode);
> > +       /* Is this the root node? */
> > +       if (!parent)
> > +               return "\\";
> > +
> > +       fwnode_handle_put(parent);
> > +
> > +       if (is_acpi_data_node(fwnode)) {
> > +               const struct acpi_data_node *dn = to_acpi_data_node(fwnode);
> > +
> > +               return dn->name;
> > +       }
> > +
> > +       adev = to_acpi_device_node(fwnode);
> > +
> > +       return adev ? acpi_device_bid(adev) : NULL;
> 
> I would do
> 
> if (WARN_ON(!adev))
>          return NULL;
> 
> return acpi_device_bid(adev);

Done.

-- 
Sakari Ailus
sakari.ailus@...ux.intel.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ