lkml.org 
[lkml]   [2019]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH] platform: set of_node in platform_device_register_full()
    On Mon, Feb 18, 2019 at 12:10 PM Måns Rullgård <mans@mansr.com> wrote:
    >
    > "Rafael J. Wysocki" <rafael@kernel.org> writes:
    >
    > > On Sat, Feb 16, 2019 at 5:50 PM Mans Rullgard <mans@mansr.com> wrote:
    > >>
    > >> If the provided fwnode is an OF node, set dev.of_node as well.
    > >>
    > >> Signed-off-by: Mans Rullgard <mans@mansr.com>
    > >> ---
    > >> drivers/base/platform.c | 1 +
    > >> 1 file changed, 1 insertion(+)
    > >>
    > >> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
    > >> index dff82a3c2caa..853a1d0e5845 100644
    > >> --- a/drivers/base/platform.c
    > >> +++ b/drivers/base/platform.c
    > >> @@ -512,6 +512,7 @@ struct platform_device *platform_device_register_full(
    > >>
    > >> pdev->dev.parent = pdevinfo->parent;
    > >> pdev->dev.fwnode = pdevinfo->fwnode;
    > >> + pdev->dev.of_node = of_node_get(to_of_node(pdev->dev.fwnode));
    > >
    > > of_node_get() generally does a kobject_get() on the node's kobject, so
    > > when is that reference dropped? Or if it doesn't need to be dropped
    > > at all, why is this the case?
    >
    > platform_device_release() calls of_device_node_put().

    Yes, it does, but this is the reference that's already acquired for
    devices added while parsing DT, isn't it?

    Your change adds an extra reference AFAICS.

    Also, why is this patch needed?

    \
     
     \ /
      Last update: 2019-02-20 10:51    [W:2.316 / U:0.564 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site