Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp869718pxb; Wed, 29 Sep 2021 11:22:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfJ8j63wTiMrPymKdGF03dJkQQ+rsBzf1h1B33Qcu55LZO2yrlrLyseN/FoNErYOpsDPmv X-Received: by 2002:a05:6402:3128:: with SMTP id dd8mr1548752edb.383.1632939723628; Wed, 29 Sep 2021 11:22:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632939723; cv=none; d=google.com; s=arc-20160816; b=vocy3dGINKJMJr/LX/9gNRChNzu/15r6PACW2f7vex3mlNKAPgmNVsygEAdDdZ3OJY aDmYhSx4Hs9tycbTtxEjyNTQ9cmtE069Q7gUabDUlH1DZbq8y5btkslLG4ndbrDV1Ryj vCVtuLgPQr7BU5JWARFUhVOb/tgEuhhT9lZBk5fWIAwHi7rwlLJqwd47/MjDh1nRZafj 2J24l2mR49CQmmfKSRvT2suXoKdFl8+Wzx71NpnfenqvSV5PDbEYkcdTNe2lzt+zyOwS EffY9gDAd/epg0G8Y/Q9TU8T0iaJL/M21LWqUFzFXRK6Gu5zTTEfoLWtdpMCQTjsAst9 HlEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Av6NjNZVjxgr9oNQS6NmrX6QT9O37Dvqwum8h0gSbhc=; b=u9eZx/YG0w8Lnlocq05B6egEKxmRF/rlqaIF2nZe2chXS9Fb0UtNRRS82PwUQc6WOW HsFbFsZRQrmMBvNGCowqWeTIWP37hbjOjGffxcPXtSDOX9WLc6qehcD1fOOCgfhAurHl 6cK6MfsmI9giBvmhGyqVX+TXfeqSrAhHSlh/KUSQR5+h/dd0ayJOykbE8THy44sOYtbR gCP5+79ODnTnnaPIy4GFWXjcBoKXydc/utL/34ckmsOwzQr7w3bLYrd0i8oe+pv+VjoS VN50AvR4X1IGO4G/p9nt3Oz+C3V3sKtLhkqbvqfboAHynPrWPglWDkNjDoRgZGHgVk0u 7X7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 8si807983ejx.341.2021.09.29.11.21.35; Wed, 29 Sep 2021 11:22:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345833AbhI2SRt (ORCPT + 99 others); Wed, 29 Sep 2021 14:17:49 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:51876 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345264AbhI2SRs (ORCPT ); Wed, 29 Sep 2021 14:17:48 -0400 Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 3.0.0) id 200acef27095dc77; Wed, 29 Sep 2021 20:16:05 +0200 Received: from kreacher.localnet (unknown [213.134.161.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id E757F66A71A; Wed, 29 Sep 2021 20:16:04 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI , Ferry Toth Cc: Linux PCI , LKML , Bjorn Helgaas , Andy Shevchenko , Mika Westerberg Subject: [PATCH v3 3/3] PCI: PM: Do not call platform_pci_power_manageable() unnecessarily Date: Wed, 29 Sep 2021 20:15:06 +0200 Message-ID: <1910546.usQuhbGJ8B@kreacher> In-Reply-To: <7312660.EvYhyI6sBW@kreacher> References: <1800633.tdWV9SEqCh@kreacher> <7312660.EvYhyI6sBW@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.161.209 X-CLIENT-HOSTNAME: 213.134.161.209 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvtddrudekvddguddvudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepteeggfelteegudehueegieekveduleeuledvueefjeefffegfeejudfgteefhefhnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphepvddufedrudefgedrudeiuddrvddtleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduiedurddvtdelpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepfhhnthhothhhsehgmhgrihhlrdgtohhmpdhrtghpthhtoheplhhinhhugidqphgtihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdp rhgtphhtthhopehhvghlghgrrghssehkvghrnhgvlhdrohhrghdprhgtphhtthhopegrnhgurhhihidrshhhvghvtghhvghnkhhosehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtohepmhhikhgrrdifvghsthgvrhgsvghrgheslhhinhhugidrihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=7 Fuz1=7 Fuz2=7 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki Drop two invocations of platform_pci_power_manageable() that are not necessary, because the functions called when it returns 'true' do the requisite "power manageable" checks themselves. Signed-off-by: Rafael J. Wysocki --- v2 (https://patchwork.kernel.org/project/linux-acpi/patch/2014133.KlZ2vcFHjT@kreacher/) -> v3: * Call platform_pci_set_power_state() in pci_platform_power_transition() as appropriate. --- drivers/pci/pci.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) Index: linux-pm/drivers/pci/pci.c =================================================================== --- linux-pm.orig/drivers/pci/pci.c +++ linux-pm/drivers/pci/pci.c @@ -1191,9 +1191,7 @@ void pci_update_current_state(struct pci */ void pci_refresh_power_state(struct pci_dev *dev) { - if (platform_pci_power_manageable(dev)) - platform_pci_refresh_power_state(dev); - + platform_pci_refresh_power_state(dev); pci_update_current_state(dev, dev->current_state); } @@ -1206,14 +1204,10 @@ int pci_platform_power_transition(struct { int error; - if (platform_pci_power_manageable(dev)) { - error = platform_pci_set_power_state(dev, state); - if (!error) - pci_update_current_state(dev, state); - } else - error = -ENODEV; - - if (error && !dev->pm_cap) /* Fall back to PCI_D0 */ + error = platform_pci_set_power_state(dev, state); + if (!error) + pci_update_current_state(dev, state); + else if (!dev->pm_cap) /* Fall back to PCI_D0 */ dev->current_state = PCI_D0; return error;