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: 10841113 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 8FD881803 for ; Wed, 6 Mar 2019 13:26:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BCE32D96D for ; Wed, 6 Mar 2019 13:26:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FE622D976; Wed, 6 Mar 2019 13:26:03 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, TVD_SUBJ_WIPE_DEBT autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15C342D96D for ; Wed, 6 Mar 2019 13:26:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728800AbfCFN0C (ORCPT ); Wed, 6 Mar 2019 08:26:02 -0500 Received: from mail-eopbgr00089.outbound.protection.outlook.com ([40.107.0.89]:42629 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726882AbfCFN0C (ORCPT ); Wed, 6 Mar 2019 08:26:02 -0500 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" CC: "linux-arm-kernel@lists.infradead.org" , "dongas86@gmail.com" , dl-linux-imx , "rjw@rjwysocki.net" , "ulf.hansson@linaro.org" , "khilman@kernel.org" , Aisheng Dong 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-8859-1?q?1=3BAM0PR04MB5345=3B23=3AuQ?= =?iso-8859-1?q?6Ud3DGHsLWt/PZ0G7lsUhQ0IEhV1yStOCbpCFWfXGyiu8HajFhmHkR8Hq6Ma?= =?iso-8859-1?q?lhRJfm37wQkNnhf9JYJ2haRHIzojgda/se4OUmv02ZrUwSHqqA0gjhdLx4Kg?= =?iso-8859-1?q?hPL+GWGnvO2vXOJJGbGjmjZS1wzbnwDl8OJLCucJ4vOIby6w8zcjFPaC9MJR?= =?iso-8859-1?q?1eLUHJI8z5pNZLqtPUaDkKKBAE5cXKyuDkanqaARajVXsFN/k91u/I4om4xj?= =?iso-8859-1?q?kqVii1ilSA+UdnrfJY1GmbXONkIpZRBDNf4bo0ynzHDm43Hd5tbDuBnnXnzV?= =?iso-8859-1?q?n6F1KC6baqFDWw4DiCGc2FaJkithn4AEIkd1y16Ck/AmLc/1Vdos8xXUgZpH?= =?iso-8859-1?q?PCeCxiHGNZ0q6DWlZwf6CukFSR8UJ29yn+lqxL8RlPZIjdYkcDHNGflSPyqd?= =?iso-8859-1?q?JvkMBb2YCOoy+QSqU5BOcKaq4F/7U6Xvdo+KHODKdSk1Q0ScKh1RKt9SswLi?= =?iso-8859-1?q?DICDnbx7sIDq240S3ASrPeclzbom4m2Z+Kdg3Qjd0skrWcz1SjiU6fjOZTtT?= =?iso-8859-1?q?4zOTgHdIalSOXwDlJNYnknrmFSJ3BDYfbqtU4/ciHOnmAinQOQ+w+U5ARpWD?= =?iso-8859-1?q?UAXUt4ccLQHrzF29e0hTJTiklT2Pniz1Jru8wUrymOXaXSk2ACvpw0GdxPst?= =?iso-8859-1?q?DryKgzuDggiYRywCZgCAXu56snAyKUy4f3kflSjigUO/zeRZ1l2vfPNlJtsK?= =?iso-8859-1?q?2XB3x7K6xxaiM7uogzXS/D63M4PTQ9HFsmPemPDDCXqL8XSBWbyav2u2Z1zR?= =?iso-8859-1?q?KZ6GfPhM6NBPRC0T5tGwTq8Ge9Hcj9Xw0j64uOIaCT/glx+YqHH3mbUD2LOs?= =?iso-8859-1?q?K7t5oM1brlD6o+p/LsUrFoAR60/fbt/1WU3bDL4cykl46EvWDwoxt1cPT5Pn?= =?iso-8859-1?q?Iy29QYfOLkKObn4jJ1M9oYek5C2a2d++XPGTHdnZzZBaa0wNLduAaIs2y/D+?= =?iso-8859-1?q?eAcwshm0utefHu1ZOsdHbcpjKGQmcaC3XupqBWrRCXKPPK4/yAY5ACBnbk9b?= =?iso-8859-1?q?mCvrsessfMePvs5KuFFrRO+rj4+XKqrATke0ZMXgvKC28KiWeKRSCluJ7XGk?= =?iso-8859-1?q?EdPoIrJbadiAHvG6ajlGUD1oztsFOnOUE7rF5i6LapWwkcmwTs8BoIZsfCUH?= =?iso-8859-1?q?zwNsApr+sb5ximrDB0saPLHpOEKpDkrJioWzlo+E8XMb9MW3fW2SYKy3VblV?= =?iso-8859-1?q?h2btfh0ljnLT0ind7FRvisPo7kQ+bxkzXS3EAZ1+rqFrwZFEWD76/bY75Zzl?= =?iso-8859-1?q?2ITLa8uCj4AJVA56UhUElW32h6GPhcd9Uetmjn9A=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 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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);