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: <CAGETcx-ShEUaFzL_1oExk8KeVn+cnXLnYSz7vKxphHbnGERrhQ@mail.gmail.com>
Date:   Thu, 5 Nov 2020 15:20:16 -0800
From:   Saravana Kannan <saravanak@...gle.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     "Rafael J. Wysocki" <rjw@...ysocki.net>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Len Brown <lenb@...nel.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>,
        Android Kernel Team <kernel-team@...roid.com>,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-efi <linux-efi@...r.kernel.org>,
        "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
        <devicetree@...r.kernel.org>
Subject: Re: [PATCH v1 07/18] driver core: Add fwnode_init()

On Thu, Nov 5, 2020 at 1:35 AM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
>
> On Wed, Nov 04, 2020 at 03:23:44PM -0800, Saravana Kannan wrote:
> > There are multiple locations in the kernel where a struct fwnode_handle
> > is initialized. Add fwnode_init() so that we have one way of
> > initializing a fwnode_handle.
> >
> > Signed-off-by: Saravana Kannan <saravanak@...gle.com>
> > ---
> >  drivers/acpi/property.c         | 2 +-
> >  drivers/acpi/scan.c             | 2 +-
> >  drivers/base/swnode.c           | 2 +-
> >  drivers/firmware/efi/efi-init.c | 8 ++++----
> >  include/linux/fwnode.h          | 5 +++++
> >  include/linux/of.h              | 2 +-
> >  kernel/irq/irqdomain.c          | 2 +-
> >  7 files changed, 14 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
> > index d04de10a63e4..24e87b630573 100644
> > --- a/drivers/acpi/property.c
> > +++ b/drivers/acpi/property.c
> > @@ -76,7 +76,7 @@ static bool acpi_nondev_subnode_extract(const union acpi_object *desc,
> >               return false;
> >
> >       dn->name = link->package.elements[0].string.pointer;
> > -     dn->fwnode.ops = &acpi_data_fwnode_ops;
> > +     fwnode_init(&dn->fwnode, &acpi_data_fwnode_ops);
> >       dn->parent = parent;
> >       INIT_LIST_HEAD(&dn->data.properties);
> >       INIT_LIST_HEAD(&dn->data.subnodes);
> > diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> > index a896e5e87c93..0ac19f9274b8 100644
> > --- a/drivers/acpi/scan.c
> > +++ b/drivers/acpi/scan.c
> > @@ -1589,7 +1589,7 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
> >       device->device_type = type;
> >       device->handle = handle;
> >       device->parent = acpi_bus_get_parent(handle);
> > -     device->fwnode.ops = &acpi_device_fwnode_ops;
> > +     fwnode_init(&device->fwnode, &acpi_device_fwnode_ops);
> >       acpi_set_device_status(device, sta);
> >       acpi_device_get_busid(device);
> >       acpi_set_pnp_ids(handle, &device->pnp, type);
> > diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
> > index 010828fc785b..4a4b2008fbc2 100644
> > --- a/drivers/base/swnode.c
> > +++ b/drivers/base/swnode.c
> > @@ -653,7 +653,7 @@ swnode_register(const struct software_node *node, struct swnode *parent,
> >       swnode->parent = parent;
> >       swnode->allocated = allocated;
> >       swnode->kobj.kset = swnode_kset;
> > -     swnode->fwnode.ops = &software_node_ops;
> > +     fwnode_init(&swnode->fwnode, &software_node_ops);
> >
> >       ida_init(&swnode->child_ids);
> >       INIT_LIST_HEAD(&swnode->entry);
> > diff --git a/drivers/firmware/efi/efi-init.c b/drivers/firmware/efi/efi-init.c
> > index f55a92ff12c0..b148f1459fb3 100644
> > --- a/drivers/firmware/efi/efi-init.c
> > +++ b/drivers/firmware/efi/efi-init.c
> > @@ -359,9 +359,7 @@ static const struct fwnode_operations efifb_fwnode_ops = {
> >       .add_links = efifb_add_links,
> >  };
> >
> > -static struct fwnode_handle efifb_fwnode = {
> > -     .ops = &efifb_fwnode_ops,
> > -};
> > +static struct fwnode_handle efifb_fwnode;
> >
> >  static int __init register_gop_device(void)
> >  {
> > @@ -375,8 +373,10 @@ static int __init register_gop_device(void)
> >       if (!pd)
> >               return -ENOMEM;
> >
> > -     if (IS_ENABLED(CONFIG_PCI))
> > +     if (IS_ENABLED(CONFIG_PCI)) {
> > +             fwnode_init(&efifb_fwnode, &efifb_fwnode_ops);
> >               pd->dev.fwnode = &efifb_fwnode;
> > +     }
> >
> >       err = platform_device_add_data(pd, &screen_info, sizeof(screen_info));
> >       if (err)
> > diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
> > index e0abafbb17f8..593fb8e58f21 100644
> > --- a/include/linux/fwnode.h
> > +++ b/include/linux/fwnode.h
> > @@ -169,6 +169,11 @@ struct fwnode_operations {
> >                       (fwnode)->ops->op(fwnode, ## __VA_ARGS__);      \
> >       } while (false)
> >  #define get_dev_from_fwnode(fwnode)  get_device((fwnode)->dev)
> > +static inline void fwnode_init(struct fwnode_handle *fwnode,
> > +                            const struct fwnode_operations *ops)
> > +{
> > +     fwnode->ops = ops;
> > +}
> >
>
> A blank line before a new inline function is always nice to have :)
>

Ack

-Saravana

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ