linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	linux-pm@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Ferry Toth <fntoth@gmail.com>
Subject: [PATCH v2 2/3] driver core: Read atomic counter once in driver_probe_done()
Date: Tue, 24 Mar 2020 14:20:22 +0200	[thread overview]
Message-ID: <20200324122023.9649-2-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20200324122023.9649-1-andriy.shevchenko@linux.intel.com>

Between printing the debug message and actual check atomic counter can be
altered. For better debugging experience read atomic counter value only once.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Ferry Toth <fntoth@gmail.com>
---
v2: picked up tags
 drivers/base/dd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 43720beb5300..efd0e4c16ba5 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -669,9 +669,10 @@ static int really_probe_debug(struct device *dev, struct device_driver *drv)
  */
 int driver_probe_done(void)
 {
-	pr_debug("%s: probe_count = %d\n", __func__,
-		 atomic_read(&probe_count));
-	if (atomic_read(&probe_count))
+	int local_probe_count = atomic_read(&probe_count);
+
+	pr_debug("%s: probe_count = %d\n", __func__, local_probe_count);
+	if (local_probe_count)
 		return -EBUSY;
 	return 0;
 }
-- 
2.25.1


  reply	other threads:[~2020-03-24 12:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-24 12:20 [PATCH v2 1/3] driver core: Break infinite loop when deferred probe can't be satisfied Andy Shevchenko
2020-03-24 12:20 ` Andy Shevchenko [this message]
2020-03-24 12:55   ` [PATCH v2 2/3] driver core: Read atomic counter once in driver_probe_done() Rafael J. Wysocki
2020-03-24 12:20 ` [PATCH v2 3/3] driver core: Replace open-coded list_last_entry() Andy Shevchenko
2020-03-24 12:53   ` Rafael J. Wysocki
2020-03-27 17:56     ` Naresh Kamboju
2020-03-27 19:40       ` Robin Murphy
2020-03-30 10:13         ` Sudeep Holla
2020-03-30 10:43           ` Andy Shevchenko
2020-03-30 13:16             ` Sudeep Holla
2020-03-30 12:45           ` Robin Murphy
2020-03-30 13:11             ` Andy Shevchenko
2020-03-30 13:29               ` Robin Murphy
2020-03-30 20:02                 ` John Stultz
2020-03-30 13:25             ` Sudeep Holla
2020-03-28  7:25       ` Greg Kroah-Hartman
2020-03-24 12:52 ` [PATCH v2 1/3] driver core: Break infinite loop when deferred probe can't be satisfied Rafael J. Wysocki
2020-03-24 13:39   ` Andy Shevchenko
2020-03-24 15:36     ` Rafael J. Wysocki
2020-03-24 15:47       ` 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=20200324122023.9649-2-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=fntoth@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).