The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Jyri Sarha <jsarha@ti.com>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	tomi.valkeinen@ti.com, thierry.reding@gmail.com,
	gregkh@linuxfoundation.org,
	"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>
Subject: Re: [PATCH RFC] driver core: Reprobe consumer if it was unbound by dropped device_link
Date: Sun, 25 Feb 2018 10:22:23 +0100	[thread overview]
Message-ID: <20180225092223.GB923@wunner.de> (raw)
In-Reply-To: <57c1d52a5a8f5985dc1dd53260d7d68795be8ea2.1519321145.git.jsarha@ti.com>

On Thu, Feb 22, 2018 at 07:42:46PM +0200, Jyri Sarha wrote:
> Put consumer device to deferred probe list if it is unbound due to a
> dropped link to a supplier.
> 
> When a device link supplier is unbound (either manually or because one
> of its own suppliers was unbound), its consumers are unbound as
> well. Currently if the supplier binds again after this the consumer
> does not automatically probe again. With this patch it does.

Yes I think this makes sense, based on the rationale that the consumer
was automatically unbound, so by symmetry it should also be automatically
rebound.

The only thing I don't understand is you wrote in an earlier e-mail of a
difference in behavior depending on whether driver_deferred_probe_add()
is called before or after device_release_driver_internal().
That's really odd, it shouldn't make a difference.

Thanks,

Lukas

> 
> If this patch is not acceptable as such, how about adding this
> behavior behind a new device link flag?
> 
> The idea to this patch was gotten from this post by Lucas Wunner:
> https://www.spinics.net/lists/dri-devel/msg166318.html
> 
> Part of the code and the description is borrowed from him.
> 
> cc: Lukas Wunner <lukas@wunner.de>
> cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> cc: Thierry Reding <thierry.reding@gmail.com>
> Signed-off-by: Jyri Sarha <jsarha@ti.com>
> ---
>  drivers/base/base.h | 1 +
>  drivers/base/core.c | 2 ++
>  drivers/base/dd.c   | 2 +-
>  3 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/base/base.h b/drivers/base/base.h
> index d800de6..39370eb 100644
> --- a/drivers/base/base.h
> +++ b/drivers/base/base.h
> @@ -114,6 +114,7 @@ extern void device_release_driver_internal(struct device *dev,
>  
>  extern void driver_detach(struct device_driver *drv);
>  extern int driver_probe_device(struct device_driver *drv, struct device *dev);
> +extern void driver_deferred_probe_add(struct device *dev);
>  extern void driver_deferred_probe_del(struct device *dev);
>  static inline int driver_match_device(struct device_driver *drv,
>  				      struct device *dev)
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index b2261f9..0964ed5 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -570,6 +570,8 @@ void device_links_unbind_consumers(struct device *dev)
>  
>  			device_release_driver_internal(consumer, NULL,
>  						       consumer->parent);
> +			driver_deferred_probe_add(consumer);
> +
>  			put_device(consumer);
>  			goto start;
>  		}
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index de6fd09..846ae78 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -140,7 +140,7 @@ static void deferred_probe_work_func(struct work_struct *work)
>  }
>  static DECLARE_WORK(deferred_probe_work, deferred_probe_work_func);
>  
> -static void driver_deferred_probe_add(struct device *dev)
> +void driver_deferred_probe_add(struct device *dev)
>  {
>  	mutex_lock(&deferred_probe_mutex);
>  	if (list_empty(&dev->p->deferred_probe)) {

  reply	other threads:[~2018-02-25  9:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1519321145.git.jsarha@ti.com>
2018-02-22 17:42 ` [PATCH RFC] driver core: Reprobe consumer if it was unbound by dropped device_link Jyri Sarha
2018-02-25  9:22   ` Lukas Wunner [this message]
2018-02-26  7:52     ` Jyri Sarha
2018-08-14 14:17       ` Daniel Vetter
2018-08-15  6:49         ` Jyri Sarha
2018-08-15  8:49           ` Daniel Vetter

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=20180225092223.GB923@wunner.de \
    --to=lukas@wunner.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jsarha@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=thierry.reding@gmail.com \
    --cc=tomi.valkeinen@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox