Received: by 10.213.65.68 with SMTP id h4csp1618366imn; Mon, 19 Mar 2018 08:53:56 -0700 (PDT) X-Google-Smtp-Source: AG47ELsnU0Ez6IhezltP+InN4H143D1NhAz7tvHNoKSPybjw5+Lp3k4e6XVUxHfhJ/+arlQUn4yG X-Received: by 10.99.64.197 with SMTP id n188mr9471143pga.21.1521474836910; Mon, 19 Mar 2018 08:53:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521474836; cv=none; d=google.com; s=arc-20160816; b=JVfHTOCQA7dRM6mYmjK7wFV/mlDxf5+fdv5rlPNSSvt1Ry3EIqGOAcg+7zxDAuQ9O8 7ZhbhnKySH7GL70FaqKhc0YDDVDcToQVGlQZOmA+w513kfgG+wG1bKeRaXyX9c99VybS BTH9Ex+aEclv1oYGfhDvBaACrw4jF3x8DrblotaSS0b4B7ygTd/2cLX0qNgGUZi25FSy BLI3wvk3fAF1ZeoxBpD5zyyEbvxk8epTUMvrLfvVtb830B7UJH7Dsxz4OutCqWqf/276 z0ruN50R80iX9HCMJaI6+Voe3hG45STkmFlhcdmxmVYVbtR5g2X8pOZ55F3er8H0f/tB oUkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=3OX0qAj5jfFMHYdFMlJ4KNhnPYVf6Gdp1J74x/CklyU=; b=ma/PfZFrZGmYKqMByY/pZu57bElW81mgr1i88DLcGH1k9b+nd3gQhtUsLMXDMLaWP3 9w11Z9kioLxczr22mdUGQmdSiD2B9G4qRHFfvqUXl0bV0g0h9ggIrHPVaUkfqidDLnHi rbkvP6cTL48LovK1P/zHvzpeRILgY0kY96hGd/Qvf5CBCpo6Uu88QvNTRkvAPvqTaLFw Nw0m6xv6AdnWdyzWEk1H0EoSpw7vK+qtkMs+luOJnWKUWmvWHDl08NUS8+8KNCL0JRRw tYBKLyxZ+y4z1eV8iGhnGQu+Y3Is5KRgNQEU/HxhsMZlME/028wUW/eU6wuFdMI3xOIy ue3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=ZWlSS/RG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65si173778pfq.250.2018.03.19.08.53.41; Mon, 19 Mar 2018 08:53:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=ZWlSS/RG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934104AbeCSPu3 (ORCPT + 99 others); Mon, 19 Mar 2018 11:50:29 -0400 Received: from mail-by2nam01on0114.outbound.protection.outlook.com ([104.47.34.114]:57771 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933993AbeCSPt4 (ORCPT ); Mon, 19 Mar 2018 11:49:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=3OX0qAj5jfFMHYdFMlJ4KNhnPYVf6Gdp1J74x/CklyU=; b=ZWlSS/RGGaHWi1iBeqmzF9zF52YwtbhHC3D+GkvFkMw1LZ9h95EbIN8Rp5LghHMzuDNRiWrCisX2/unJ3KUNgstTZj1zHI3bfrxo+zVuSuxRqupJ825UIxGdFUDhOt/e+0v4n2pMPiE3piIBk8V/TUD9ijKSH1V3e2jXgvVTufg= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1109.namprd21.prod.outlook.com (52.132.130.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 15:49:44 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 15:49:44 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Ulf Hansson , "Rafael J . Wysocki" , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 105/124] PM / domains: Don't skip driver's ->suspend|resume_noirq() callbacks Thread-Topic: [PATCH AUTOSEL for 4.15 105/124] PM / domains: Don't skip driver's ->suspend|resume_noirq() callbacks Thread-Index: AQHTv5nKeduELtCd/0CXDaa1vCMwyQ== Date: Mon, 19 Mar 2018 15:48:57 +0000 Message-ID: <20180319154645.11350-105-alexander.levin@microsoft.com> References: <20180319154645.11350-1-alexander.levin@microsoft.com> In-Reply-To: <20180319154645.11350-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1109;7:l8VyMlP9d+1s2MhqQOs6lf2vOE4IIoEKcfKm2ZHQvHi/j8GbznVOuwL3SnM/IF5SBMf+KgQq9/+DjY6nIKR7I6BtpDaWqdC4w4ZfxWaU55OS22a4auR+LWePR8ln560LU3f6xjKomt98Kd78aBM2WrwMpbUO9hwRfg3wFUcxUhEu3OfTSuTcBNZU0zGK9XMmfwGq1gi7ZecEh/lxFGd0wnWgcQu3El38jOvAX5JLtU4ptpuHHls3t47r+QpggKIr;20:PaSiPuTy010N/4Vc9eX1pva3u/7zJc+hezuOD87jaTezM5SrHWrSLfICK9LTmjhZXioVbNIK3vIg3U7RbRuSzHMye7B+7ZbfiQAJqfOKGaVIKS5TYAPDNwE+Gxu/RpvcPGmU/CdXcOdgnRs03kotoicEz0hPvObnF6pCo0ReBjE= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: fe3bfe45-3746-417e-f7d4-08d58db10941 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1109; x-ms-traffictypediagnostic: DM5PR2101MB1109: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB1109;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1109; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(396003)(39860400002)(39380400002)(376002)(346002)(199004)(189003)(81166006)(10290500003)(107886003)(81156014)(106356001)(6506007)(8676002)(3846002)(36756003)(8936002)(97736004)(6116002)(1076002)(102836004)(68736007)(6666003)(3280700002)(2950100002)(3660700001)(478600001)(72206003)(59450400001)(2906002)(15650500001)(14454004)(76176011)(66066001)(6512007)(5250100002)(10090500001)(2501003)(53936002)(6486002)(6436002)(26005)(316002)(22452003)(305945005)(7736002)(4326008)(25786009)(86362001)(86612001)(5660300001)(2900100001)(99286004)(54906003)(186003)(105586002)(110136005)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1109;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: S2+Yj1EJYh/FB6SyaGJ00/9sD+5JsuipbqTbk+RSm1Mwy3bqBrGwCnqgymx22PkLob+ZW+xAS5VOO58LS/5pHrsH/SG3EXc53SomTOSTrtwk3K1hE2JlwAHp0d+8BNOxRmxWfMkNKN498BHAAbvlHrV2kun7C9SNtUai/hurRr/Gpr7z63V7LI9luvO1m7MUs3UGoKk5t9tljjiyUgPBNOmiZnCvyq36rO0mKajYMcFxYf8T+5OhaCHvE6HKFGSp30M0bL+h6pVbqVy7Cfkux5bu1JpdOMQkcixzaDFGNwpsdsZdLppPh4qKgWG3/IKQ23Y0ff/BdqMGAMqhoQZRMw== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe3bfe45-3746-417e-f7d4-08d58db10941 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 15:48:57.3118 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1109 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ulf Hansson [ Upstream commit a935424bb658f9ca37eb5e94119b857998341356 ] Commit 10da65423fdb (PM / Domains: Call driver's noirq callbacks) started to respect driver's noirq callbacks, but while doing that it also introduced a few potential problems. More precisely, in genpd_finish_suspend() and genpd_resume_noirq() the noirq callbacks at the driver level should be invoked, no matter of whether dev->power.wakeup_path is set or not. Additionally, the commit in question also made genpd_resume_noirq() to ignore the return value from pm_runtime_force_resume(). Let's fix both these issues! Fixes: 10da65423fdb (PM / Domains: Call driver's noirq callbacks) Signed-off-by: Ulf Hansson Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/base/power/domain.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 0c80bea05bcb..b4501873354e 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1032,15 +1032,12 @@ static int genpd_prepare(struct device *dev) static int genpd_finish_suspend(struct device *dev, bool poweroff) { struct generic_pm_domain *genpd; - int ret; + int ret =3D 0; =20 genpd =3D dev_to_genpd(dev); if (IS_ERR(genpd)) return -EINVAL; =20 - if (dev->power.wakeup_path && genpd_is_active_wakeup(genpd)) - return 0; - if (poweroff) ret =3D pm_generic_poweroff_noirq(dev); else @@ -1048,10 +1045,18 @@ static int genpd_finish_suspend(struct device *dev,= bool poweroff) if (ret) return ret; =20 + if (dev->power.wakeup_path && genpd_is_active_wakeup(genpd)) + return 0; + if (genpd->dev_ops.stop && genpd->dev_ops.start) { ret =3D pm_runtime_force_suspend(dev); - if (ret) + if (ret) { + if (poweroff) + pm_generic_restore_noirq(dev); + else + pm_generic_resume_noirq(dev); return ret; + } } =20 genpd_lock(genpd); @@ -1085,7 +1090,7 @@ static int genpd_suspend_noirq(struct device *dev) static int genpd_resume_noirq(struct device *dev) { struct generic_pm_domain *genpd; - int ret =3D 0; + int ret; =20 dev_dbg(dev, "%s()\n", __func__); =20 @@ -1094,21 +1099,20 @@ static int genpd_resume_noirq(struct device *dev) return -EINVAL; =20 if (dev->power.wakeup_path && genpd_is_active_wakeup(genpd)) - return 0; + return pm_generic_resume_noirq(dev); =20 genpd_lock(genpd); genpd_sync_power_on(genpd, true, 0); genpd->suspended_count--; genpd_unlock(genpd); =20 - if (genpd->dev_ops.stop && genpd->dev_ops.start) + if (genpd->dev_ops.stop && genpd->dev_ops.start) { ret =3D pm_runtime_force_resume(dev); + if (ret) + return ret; + } =20 - ret =3D pm_generic_resume_noirq(dev); - if (ret) - return ret; - - return ret; + return pm_generic_resume_noirq(dev); } =20 /** --=20 2.14.1