All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Rob Herring <robh@kernel.org>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	Lorenzo Pieralisi <lpieralisi@kernel.org>,
	Hanjun Guo <guohanjun@huawei.com>,
	Sudeep Holla <sudeep.holla@arm.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>, Russell King <linux@armlinux.org.uk>,
	Frank Rowand <frowand.list@gmail.com>,
	Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH v1 1/1] amba: bus: balance firmware node reference counting
Date: Fri, 22 Sep 2023 17:31:07 +0300	[thread overview]
Message-ID: <ZQ2lKz41zFEX2rbK@smile.fi.intel.com> (raw)
In-Reply-To: <CAL_JsqJAjxoCctHd4Eo+Hq0SBvc0G3RaEbC4P_jPsPq0LZYHzQ@mail.gmail.com>

On Fri, Sep 22, 2023 at 09:18:47AM -0500, Rob Herring wrote:
> On Tue, Sep 19, 2023 at 3:02 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Tue, Sep 19, 2023 at 11:01:37PM +0300, Andy Shevchenko wrote:
> > > On Thu, Aug 24, 2023 at 07:26:54PM +0300, Andy Shevchenko wrote:
> > > > Currently the ACPI code doesn't bump the reference count of
> > > > the firmware node, while OF counter part does. Not that it's
> > > > a problem right now, since ACPI doesn't really use the reference
> > > > counting for firmware nodes, it still makes sense to make code
> > > > robust against any changes done there. For this,
> > > >  - switch ACPI case to use device_set_node() to be unified with OF
> > > >  - move reference counting to amba_device_add()
> > > >  - switch to use firmware nodes instead of OF ones
> > > >
> > > > In the result we will have reference counting done in the same module
> > > > for all callers independently on the nature of firmware node behind.
> > >
> > > Any comment on this? I would like to have this applied so I can do something
> > > similar to the platform driver code.
> >
> > Ah, I see, I missed LKP run on this, I'll send a v2 perhaps later on this week.
> 
> What's the relationship/dependency with this and the other patches
> dealing with refcounting? Did the AMBA one land?

The OF refcounting is spread over platform code in unexpected places. So, we
have something like of_foo() bumps it, platform ->release() drops it. It sounds
to me as weird design to think of and AMBA is part of this mixture as it uses
platform_bus, BUT has it's own ->release(), besides the fact that it's used in
OF _and_ ACPI environments.

What I would expect to have is both are really agnostic to the fwnode type
and take and release reference in one place, but with OF <--> platform is
kinda more complicated that with AMBA.

-- 
With Best Regards,
Andy Shevchenko



WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Rob Herring <robh@kernel.org>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	Lorenzo Pieralisi <lpieralisi@kernel.org>,
	Hanjun Guo <guohanjun@huawei.com>,
	Sudeep Holla <sudeep.holla@arm.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>, Russell King <linux@armlinux.org.uk>,
	Frank Rowand <frowand.list@gmail.com>,
	Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH v1 1/1] amba: bus: balance firmware node reference counting
Date: Fri, 22 Sep 2023 17:31:07 +0300	[thread overview]
Message-ID: <ZQ2lKz41zFEX2rbK@smile.fi.intel.com> (raw)
In-Reply-To: <CAL_JsqJAjxoCctHd4Eo+Hq0SBvc0G3RaEbC4P_jPsPq0LZYHzQ@mail.gmail.com>

On Fri, Sep 22, 2023 at 09:18:47AM -0500, Rob Herring wrote:
> On Tue, Sep 19, 2023 at 3:02 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Tue, Sep 19, 2023 at 11:01:37PM +0300, Andy Shevchenko wrote:
> > > On Thu, Aug 24, 2023 at 07:26:54PM +0300, Andy Shevchenko wrote:
> > > > Currently the ACPI code doesn't bump the reference count of
> > > > the firmware node, while OF counter part does. Not that it's
> > > > a problem right now, since ACPI doesn't really use the reference
> > > > counting for firmware nodes, it still makes sense to make code
> > > > robust against any changes done there. For this,
> > > >  - switch ACPI case to use device_set_node() to be unified with OF
> > > >  - move reference counting to amba_device_add()
> > > >  - switch to use firmware nodes instead of OF ones
> > > >
> > > > In the result we will have reference counting done in the same module
> > > > for all callers independently on the nature of firmware node behind.
> > >
> > > Any comment on this? I would like to have this applied so I can do something
> > > similar to the platform driver code.
> >
> > Ah, I see, I missed LKP run on this, I'll send a v2 perhaps later on this week.
> 
> What's the relationship/dependency with this and the other patches
> dealing with refcounting? Did the AMBA one land?

The OF refcounting is spread over platform code in unexpected places. So, we
have something like of_foo() bumps it, platform ->release() drops it. It sounds
to me as weird design to think of and AMBA is part of this mixture as it uses
platform_bus, BUT has it's own ->release(), besides the fact that it's used in
OF _and_ ACPI environments.

What I would expect to have is both are really agnostic to the fwnode type
and take and release reference in one place, but with OF <--> platform is
kinda more complicated that with AMBA.

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-09-22 14:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-24 16:26 [PATCH v1 1/1] amba: bus: balance firmware node reference counting Andy Shevchenko
2023-08-24 16:26 ` Andy Shevchenko
2023-08-24 19:54 ` kernel test robot
2023-08-24 19:54   ` kernel test robot
2023-08-24 20:59 ` kernel test robot
2023-08-24 20:59   ` kernel test robot
2023-09-19 20:01 ` Andy Shevchenko
2023-09-19 20:01   ` Andy Shevchenko
2023-09-19 20:02   ` Andy Shevchenko
2023-09-19 20:02     ` Andy Shevchenko
2023-09-22 14:18     ` Rob Herring
2023-09-22 14:18       ` Rob Herring
2023-09-22 14:31       ` Andy Shevchenko [this message]
2023-09-22 14:31         ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZQ2lKz41zFEX2rbK@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=guohanjun@huawei.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lpieralisi@kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=sudeep.holla@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.