From patchwork Thu Oct 8 16:57:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 7354291 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C82199F1B9 for ; Thu, 8 Oct 2015 16:57:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E8B27205E2 for ; Thu, 8 Oct 2015 16:57:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E833420437 for ; Thu, 8 Oct 2015 16:57:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964965AbbJHQ5W (ORCPT ); Thu, 8 Oct 2015 12:57:22 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:57642 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964923AbbJHQ5T (ORCPT ); Thu, 8 Oct 2015 12:57:19 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id t98GvC47003634; Thu, 8 Oct 2015 11:57:12 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t98GvBR2010869; Thu, 8 Oct 2015 11:57:11 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Thu, 8 Oct 2015 11:57:12 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t98GvBlm027734; Thu, 8 Oct 2015 11:57:11 -0500 From: Grygorii Strashko To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Alan Stern CC: Pavel Machek , Len Brown , , , Grygorii Strashko , Thierry Reding Subject: [PATCH 1/2] PM / sleep: ensure deferred probe workqueue is finished in wait_for_device_probe Date: Thu, 8 Oct 2015 11:57:06 -0500 Message-ID: <1444323427-6822-2-git-send-email-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.5.1 In-Reply-To: <1444323427-6822-1-git-send-email-grygorii.strashko@ti.com> References: <1444323427-6822-1-git-send-email-grygorii.strashko@ti.com> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now wait_for_device_probe() waits for currently executing probes to finish, but it doesn't take into account deferred probing mechanism. As result, nothing prevents deferred probe workqueue to continue probing devices right after wait_for_device_probe() is finished. Hence, lest ensure deferred probe workqueue is finished in wait_for_device_probe() before proceeding. Cc: Alan Stern Cc: Rafael J. Wysocki Cc: Thierry Reding Signed-off-by: Grygorii Strashko --- drivers/base/dd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index be0eb46..98de1a5 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -391,6 +391,10 @@ int driver_probe_done(void) */ void wait_for_device_probe(void) { + /* wait for the deferred probe workqueue to finish */ + if (driver_deferred_probe_enable) + flush_workqueue(deferred_wq); + /* wait for the known devices to complete their probing */ wait_event(probe_waitqueue, atomic_read(&probe_count) == 0); async_synchronize_full();