From patchwork Wed Mar 6 13:25:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 10841111 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 155F81803 for ; Wed, 6 Mar 2019 13:25:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F08122D96D for ; Wed, 6 Mar 2019 13:25:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4B052D975; Wed, 6 Mar 2019 13:25:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, TVD_SUBJ_WIPE_DEBT autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8C6822D96D for ; Wed, 6 Mar 2019 13:25:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dx3rRWTgiAKIaVbCRcNa+ImuTy30E8naaazIY0KVqWs=; b=ETf2aIgyegfi8T Z9KfpNJMYfZFfJhdpiHpyhKU1W5zBB8h48Kb/ASvOe45LkGcDU+rL8iuVbu6h3w75HZAaQ0+vYiEV LbLCCPspWHzfkoNMI/HyJq1Med9VD4E9PJfqDlPWXx2m/rp4+snydBeYkkkxdhnivAfXPgfCRPqWG YLxKnh+RIRyIvn3wrVm7pzcOk7SNvYFliOBVHzi2ZnO2SnFNu+TEibTEIRjFl45Yx++iReDx6feDE c69jYfu+imdWI283+ZrQ1wRmJUwMWcA3Xg9FYHbrdPEuRHQZaOFcDu5/tU+UmQ/B4dGMeIg7dcjuH e1GIHaDcgKJK4Kg5b+dA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1WYT-0005pK-4j; Wed, 06 Mar 2019 13:25:53 +0000 Received: from mail-am5eur02on0609.outbound.protection.outlook.com ([2a01:111:f400:fe07::609] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1WXz-0004wD-QR for linux-arm-kernel@lists.infradead.org; Wed, 06 Mar 2019 13:25:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Y3gLM0Ep3WXLLGMnQhSS5jXJYa4NVBZga3MU5w3OOzk=; b=Hcl33a1y5r5V7h1Y5Fd9SjKxoeSStVjS0/GKrBcVw4LLnLIdYGseQ9hhq3TkRnfzkELq1Jigq37VUI0CaPVzQtQcLpGcSGi/G84G2NjUNddG9/UDumk/gGIqm+MMeBLlTspLZ95DTr8zTiNTx5sTWYCbHw3QAX9KVhOmRgduD2U= Received: from AM0PR04MB4211.eurprd04.prod.outlook.com (52.134.92.158) by AM0PR04MB5345.eurprd04.prod.outlook.com (20.178.112.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.18; Wed, 6 Mar 2019 13:25:19 +0000 Received: from AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::50ed:d1b5:c043:3b79]) by AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::50ed:d1b5:c043:3b79%2]) with mapi id 15.20.1686.016; Wed, 6 Mar 2019 13:25:19 +0000 From: Aisheng Dong To: "linux-pm@vger.kernel.org" Subject: [PATCH 3/6] PM / Domains: Remove the unnecessary ->power_off() check in genpd_power_off Thread-Topic: [PATCH 3/6] PM / Domains: Remove the unnecessary ->power_off() check in genpd_power_off Thread-Index: AQHU1CALGa0PmZep30ehAvf1aptxPA== Date: Wed, 6 Mar 2019 13:25:18 +0000 Message-ID: <1551878302-8146-4-git-send-email-aisheng.dong@nxp.com> References: <1551878302-8146-1-git-send-email-aisheng.dong@nxp.com> In-Reply-To: <1551878302-8146-1-git-send-email-aisheng.dong@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK0P153CA0009.APCP153.PROD.OUTLOOK.COM (2603:1096:203:18::21) To AM0PR04MB4211.eurprd04.prod.outlook.com (2603:10a6:208:5b::30) authentication-results: spf=none (sender IP is ) smtp.mailfrom=aisheng.dong@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1e8ffba3-da54-4616-203e-08d6a2372d58 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM0PR04MB5345; x-ms-traffictypediagnostic: AM0PR04MB5345: x-microsoft-exchange-diagnostics: =?iso-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H3?= =?iso-8859-1?q?mbUD2LOsK7t5oM1brlD6o+p/LsUrFoAR60/fbt/1WU3bDL4cykl46EvWDwox?= =?iso-8859-1?q?t1cPT5PnIy29QYfOLkKObn4jJ1M9oYek5C2a2d++XPGTHdnZzZBaa0wNLduA?= =?iso-8859-1?q?aIs2y/D+eAcwshm0utefHu1ZOsdHbcpjKGQmcaC3XupqBWrRCXKPPK4/yAY5?= =?iso-8859-1?q?ACBnbk9bmCvrsessfMePvs5KuFFrRO+rj4+XKqrATke0ZMXgvKC28KiWeKRS?= =?iso-8859-1?q?CluJ7XGkEdPoIrJbadiAHvG6ajlGUD1oztsFOnOUE7rF5i6LapWwkcmwTs8B?= =?iso-8859-1?q?oIZsfCUHzwNsApr+sb5ximrDB0saPLHpOEKpDkrJioWzlo+E8XMb9MW3fW2S?= =?iso-8859-1?q?YKy3VblVh2btfh0ljnLT0ind7FRvisPo7kQ+bxkzXS3EAZ1+rqFrwZFEWD76?= =?iso-8859-1?q?/bY75Zzl2ITLa8uCj4AJVA56UhUElW32h6GPhcd9Uetmjn9A=3D=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 0968D37274 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(396003)(136003)(366004)(376002)(346002)(199004)(189003)(316002)(4326008)(44832011)(386003)(446003)(486006)(2906002)(2616005)(54906003)(476003)(11346002)(6506007)(68736007)(36756003)(52116002)(186003)(105586002)(2351001)(14454004)(86362001)(26005)(5660300002)(106356001)(50226002)(71200400001)(71190400001)(25786009)(102836004)(8936002)(305945005)(478600001)(6916009)(6436002)(7736002)(99286004)(8676002)(66066001)(5640700003)(76176011)(256004)(14444005)(6486002)(81156014)(97736004)(3846002)(6116002)(53936002)(2501003)(81166006)(6512007); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB5345; H:AM0PR04MB4211.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: X2Uiag33iWD+5oF7ZU+vXkCul2USrviIpWp+lDicnd8OUUwHyaQzLv7ekiOgBMIWGJyrzTKuGBj91G37m3xjVHMVhJFFmyguoTTrxy2O40LkoxuIcaM+MmP7LDb7/ZlvF3L9SSy4iJGA4+o8wOoEPnwkNAd6D8NIANARfZC0xcThJwAz+Vuad7190eJvk3u8f7oMODWOPAxmwOWD26DUiQ5aA116hTBQj1xfjGOvTdr4uuxJY+Htfg84DKdImL3bqU/R2Ig7IKsh+FHHRuBq2N261KaZfOd8WcWs7Rdoga8gvi8ytmeGjn0e+JCjmOyC4Sz1GcWkGNqT/wO4KncxB2pMLOlzXmRL0/1qsjaQr4bzlvU5rhKlEPjK1X+XmWRL/HxYsCc+hIkADvvk9/pTOxvbHN+oXmBLaEjmC8ktNG8= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e8ffba3-da54-4616-203e-08d6a2372d58 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Mar 2019 13:25:18.9997 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5345 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190306_052524_558934_C19694C9 X-CRM114-Status: GOOD ( 15.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aisheng Dong , "ulf.hansson@linaro.org" , "dongas86@gmail.com" , "khilman@kernel.org" , "rjw@rjwysocki.net" , dl-linux-imx , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP There's already a check in _genpd_power_off, so caller can directly call it without checking. Signed-off-by: Dong Aisheng --- drivers/base/power/domain.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index f012576..591f37f 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -501,6 +501,7 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on, struct pm_domain_data *pdd; struct gpd_link *link; unsigned int not_suspended = 0; + int ret; /* * Do not try to power off the domain in the following situations: @@ -546,24 +547,20 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on, if (!genpd->gov) genpd->state_idx = 0; - if (genpd->power_off) { - int ret; - - if (atomic_read(&genpd->sd_count) > 0) - return -EBUSY; + if (atomic_read(&genpd->sd_count) > 0) + return -EBUSY; - /* - * If sd_count > 0 at this point, one of the subdomains hasn't - * managed to call genpd_power_on() for the master yet after - * incrementing it. In that case genpd_power_on() will wait - * for us to drop the lock, so we can call .power_off() and let - * the genpd_power_on() restore power for us (this shouldn't - * happen very often). - */ - ret = _genpd_power_off(genpd, true); - if (ret) - return ret; - } + /* + * If sd_count > 0 at this point, one of the subdomains hasn't + * managed to call genpd_power_on() for the master yet after + * incrementing it. In that case genpd_power_on() will wait + * for us to drop the lock, so we can call .power_off() and let + * the genpd_power_on() restore power for us (this shouldn't + * happen very often). + */ + ret = _genpd_power_off(genpd, true); + if (ret) + return ret; genpd->status = GPD_STATE_POWER_OFF; genpd_update_accounting(genpd);