mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] driver core: Fix device link deferred probe
Date: Thu, 02 Nov 2017 22:42:09 +0100	[thread overview]
Message-ID: <2209010.t3R8318ROA@aspire.rjw.lan> (raw)
In-Reply-To: <1509614573-29850-1-git-send-email-adrian.hunter@intel.com>

On Thursday, November 2, 2017 10:22:53 AM CET Adrian Hunter wrote:
> A device probe deferred because of a device link is never probed again
> because it is not added to the deferred_probe_pending_list. Add it, taking
> care of the race with driver_deferred_probe_trigger().
> 
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
>  drivers/base/dd.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index ad44b40fe284..e4a5bef93344 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -350,6 +350,15 @@ int device_bind_driver(struct device *dev)
>  static atomic_t probe_count = ATOMIC_INIT(0);
>  static DECLARE_WAIT_QUEUE_HEAD(probe_waitqueue);
>  
> +static void driver_deferred_probe_add_trigger(struct device *dev,
> +					      int local_trigger_count)
> +{
> +	driver_deferred_probe_add(dev);
> +	/* Did a trigger occur while probing? Need to re-trigger if yes */
> +	if (local_trigger_count != atomic_read(&deferred_trigger_count))
> +		driver_deferred_probe_trigger();
> +}
> +
>  static int really_probe(struct device *dev, struct device_driver *drv)
>  {
>  	int ret = -EPROBE_DEFER;
> @@ -369,6 +378,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)
>  	}
>  
>  	ret = device_links_check_suppliers(dev);
> +	if (ret == -EPROBE_DEFER)
> +		driver_deferred_probe_add_trigger(dev, local_trigger_count);
>  	if (ret)
>  		return ret;
>  
> @@ -469,10 +480,7 @@ static int really_probe(struct device *dev, struct device_driver *drv)
>  	case -EPROBE_DEFER:
>  		/* Driver requested deferred probing */
>  		dev_dbg(dev, "Driver %s requests probe deferral\n", drv->name);
> -		driver_deferred_probe_add(dev);
> -		/* Did a trigger occur while probing? Need to re-trigger if yes */
> -		if (local_trigger_count != atomic_read(&deferred_trigger_count))
> -			driver_deferred_probe_trigger();
> +		driver_deferred_probe_add_trigger(dev, local_trigger_count);
>  		break;
>  	case -ENODEV:
>  	case -ENXIO:
> 

Looks OK to me, thanks.

Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

      parent reply	other threads:[~2017-11-02 21:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-02  9:22 Adrian Hunter
2017-11-02  9:33 ` Greg Kroah-Hartman
2017-11-02  9:32   ` Adrian Hunter
2017-11-02 21:42 ` Rafael J. Wysocki [this message]

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=2209010.t3R8318ROA@aspire.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=adrian.hunter@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®