public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Felipe Balbi <balbi@kernel.org>,
	Mathias Nyman <mathias.nyman@intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"open list:ULTRA-WIDEBAND (UWB) SUBSYSTEM:" 
	<linux-usb@vger.kernel.org>
Subject: Re: [PATCH v2 1/6] software node: Provide replacement for device_add_properties()
Date: Thu, 4 Feb 2021 17:13:04 +0100	[thread overview]
Message-ID: <YBwdEKPIDbbYWAbR@kroah.com> (raw)
In-Reply-To: <CAJZ5v0j+fTG4rw6Z9XU9h=UFSObT5s2a=EY21g5YYyk9BDNtsQ@mail.gmail.com>

On Thu, Feb 04, 2021 at 05:06:53PM +0100, Rafael J. Wysocki wrote:
> On Thu, Feb 4, 2021 at 3:17 PM Heikki Krogerus
> <heikki.krogerus@linux.intel.com> wrote:
> >
> > At the moment the function device_del() is calling
> > device_remove_properties() unconditionally. That will result into the
> > reference count of the software node attached to the device being
> > decremented, and in most cases it will hit 0 at that point. So in
> > practice device_del() will unregister the software node attached to
> > the device, even if that was not the intention of the caller. Right
> > now software nodes can not be reused or shared because of that.
> >
> > So device_del() can not unregister the software nodes unconditionally
> > like that. Unfortunately some of the users of device_add_properties()
> > are now relying on this behaviour. Because of that, and also in
> > general, we do need a function that can offer similar behaviour where
> > the lifetime of the software node is bound to the lifetime of the
> > device. But it just has to be a separate function so the behaviour is
> > optional. We can not remove the device_remove_properties() call from
> > device_del() before we have that new function, and before we have
> > replaced device_add_properties() calls with it in all the places that
> > require that behaviour.
> >
> > This adds function device_create_managed_software_node() that can be
> > used for exactly that purpose. Software nodes created with it are
> > declared "managed", and separate handling for those nodes is added to
> > the software node code. The reference count of the "managed" nodes is
> > decremented when the device they are attached to is removed. This will
> > not affect the other nodes that are not declared "managed".
> >
> > The function device_create_managed_software_node() has also one
> > additional feature that device_add_properties() does not have. It
> > allows the software nodes created with it to be part of a node
> > hierarchy by taking also an optional parent node as parameter.
> >
> > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> 
> The rationale is clear now, so
> 
> Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> and I'm assuming that this will be routed via the USB tree.

Yes, I will do so, thanks.

greg k-h

  reply	other threads:[~2021-02-04 16:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04 14:17 [PATCH v2 0/6] usb: Handle device properties with software node API Heikki Krogerus
2021-02-04 14:17 ` [PATCH v2 1/6] software node: Provide replacement for device_add_properties() Heikki Krogerus
2021-02-04 16:06   ` Rafael J. Wysocki
2021-02-04 16:13     ` Greg Kroah-Hartman [this message]
2021-02-05  9:08       ` Greg Kroah-Hartman
2021-02-04 14:17 ` [PATCH v2 2/6] usb: dwc2: pci: Drop the empty quirk function Heikki Krogerus
2021-02-04 14:40   ` Greg Kroah-Hartman
2021-02-04 14:17 ` [PATCH v2 3/6] usb: dwc3: haps: Constify the software node Heikki Krogerus
2021-02-04 14:42   ` Greg Kroah-Hartman
2021-02-04 14:17 ` [PATCH v2 4/6] usb: dwc3: qcom: " Heikki Krogerus
2021-02-04 14:17 ` [PATCH v2 5/6] usb: dwc3: host: Use software node API with the properties Heikki Krogerus
2021-02-04 14:17 ` [PATCH v2 6/6] xhci: ext-caps: " Heikki Krogerus

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=YBwdEKPIDbbYWAbR@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=balbi@kernel.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=rafael@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox