From patchwork Thu Feb 25 00:22:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Basehore X-Patchwork-Id: 8415351 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 89D2B9F2F0 for ; Thu, 25 Feb 2016 00:22:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A624D202EC for ; Thu, 25 Feb 2016 00:22:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B21272026C for ; Thu, 25 Feb 2016 00:22:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758261AbcBYAWc (ORCPT ); Wed, 24 Feb 2016 19:22:32 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:34524 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757530AbcBYAWc (ORCPT ); Wed, 24 Feb 2016 19:22:32 -0500 Received: by mail-pa0-f44.google.com with SMTP id fy10so21525134pac.1 for ; Wed, 24 Feb 2016 16:22:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=jVETLVYSPXofnn0ohkjhLC/UTtFUfIByQO8Rktp8xO4=; b=BmGedKZ3RcxfreLzIUaJgW1zAndsf1Eb1HRhRcyuPkYVJzqmHY1vhLDPKh0DxDUODW lgzFI11aRlxHSIbIRsR7JaXOPlrpVPV7I8Zxs92T13XOIJmxYDGRTHEHFhn1nFMk9kgJ F6ADeRlmDlPOT1ygVwRcAkC+YcC/+ZaFBRV/I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=jVETLVYSPXofnn0ohkjhLC/UTtFUfIByQO8Rktp8xO4=; b=K/DY+rASaM1BYhAW/2P/xfhb+6AAAWxM8CigARUw35THfIOQaIj/pNWB2dUXUUbxBP rrE6F8CPB/H5UwGWv9NcnVcgpuQGgIxWqDzT3W94hrUOkEYD7RbMyxyHoLrlgn+cwOMD GngU0vWGUu+toZcKwnQ82jYcsmKUY/37I8w1amNl6U8tfby/lMo+xo6oCXCTJJ+sKJ8z xj+0MakpbYdURQ9wBoe0BkA/XBqTWBxTiPguzgZCr3DgssYCZFPTilNBlOXONqjm4vjt YMm1cUOmC+Jn5G/LVGDYuOxUfHsAlk20KxpbWyWD4je+xKl6LZ8mMKTlk8MyR/cjGaUs 5zDQ== X-Gm-Message-State: AG10YOT7OrSGqJW8Vu9OVGFUe/VL/gf0B7xZ9msFBE7E2kGR//fVBwVKQyk3up699EMpmQ== X-Received: by 10.66.193.161 with SMTP id hp1mr59147202pac.9.1456359751488; Wed, 24 Feb 2016 16:22:31 -0800 (PST) Received: from ketosis.mtv.corp.google.com ([172.22.65.104]) by smtp.gmail.com with ESMTPSA id m87sm7519956pfj.38.2016.02.24.16.22.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Feb 2016 16:22:31 -0800 (PST) From: Derek Basehore To: linux-pm@vger.kernel.org Cc: "Rafael J . Wysocki" , Len Brown , Pavel Machek , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, "Martin K . Petersen" , linux-scsi@vger.kernel.org, Derek Basehore Subject: [PATCH v2 1/3] PM / sleep: Check legacy pm callbacks for direct complete Date: Wed, 24 Feb 2016 16:22:26 -0800 Message-Id: <1456359748-22838-1-git-send-email-dbasehore@chromium.org> X-Mailer: git-send-email 2.7.0.rc3.207.g0ac5344 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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 This adds checks for legacy pm callbacks when setting no_pm_callbacks. This fixes an issue where these suspend/resume callbacks were incorrectly ignored during suspend/resume with direct complete. Fixes: aa8e54b55947 "PM / sleep: Go direct_complete if driver has..." Signed-off-by: Derek Basehore --- drivers/base/power/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 6e7c3cc..e0017d9 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -1764,8 +1764,10 @@ void device_pm_check_callbacks(struct device *dev) { spin_lock_irq(&dev->power.lock); dev->power.no_pm_callbacks = - (!dev->bus || pm_ops_is_empty(dev->bus->pm)) && - (!dev->class || pm_ops_is_empty(dev->class->pm)) && + (!dev->bus || (!dev->bus->resume && !dev->bus->suspend && + pm_ops_is_empty(dev->bus->pm))) && + (!dev->class || (!dev->class->resume && !dev->class->suspend && + pm_ops_is_empty(dev->class->pm))) && (!dev->type || pm_ops_is_empty(dev->type->pm)) && (!dev->pm_domain || pm_ops_is_empty(&dev->pm_domain->ops)) && (!dev->driver || pm_ops_is_empty(dev->driver->pm));