Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp843412pxb; Sat, 18 Sep 2021 21:06:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwL+bILSsZFd9WdQE+IoKARKwThybP4O8WGqzlGtydqygnBYBsjpP/48LVBAFbGLmKc8CjV X-Received: by 2002:a92:c26c:: with SMTP id h12mr9433183ild.241.1632024418087; Sat, 18 Sep 2021 21:06:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632024418; cv=none; d=google.com; s=arc-20160816; b=hzBUd/tVrGMrNrW/u2lWXQgQ3LRvyoHnBW7p9hUPdGql1cV6AOvRUm0cT5XWpneqYZ P2KNd8600Z8WDKCr9dhHgVai6kEfwZbzsC0T6VNJLQJlQ5CD7yxCgktkjHE6j26U6xTQ odCKy55SsCYNt52xVIyuQHO13nlIIBDcltYDlmtBc56y0nXsRTNemYKMbLmpudaqcSaS ynxkVZgcBrvy3tPO/xNZBT2ipra1ptky8TRfUW9dTNdwc233H1wwBTr1bwpUmHIl4tQz BRMHAks8XA94pFqY+r4Oqv4gyD9KN4r1uOOeXyphkZ5ALDASqzJn6EmbxucRMNErBtso h6mA== 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=5qwVU1qQ+XBqmbspwddvgnss3NOLIfocTgG7cOOyVQY=; b=RW8QGVfhM7ngQIIxfRBm7MO1WrWgjAduvgD9tETAZIcXnOJIRYhuvauI7it4klU0re 781KfbuDkEY3mX+4xif6zki7fzWVVm2RURBx/LxlG7zVL4Rdo521+ZCUVbkczncvPsFM vOz9qnnA4q6K79ijJYcsNhlnOWMFRS2wutnZh0gySoVzc9QPPlgcIj2Navja9lr1Jek2 AbP5RA1rTktqt0o8AiAUlZ4fs8f1rTXNOrfO5laRXCIkJPfd2mmb1LpfUnWFLfMOfruA UifuY8PSmhrOtPeLLV9Uz3SV+RSLO9VD0yTLy2+4zdaM6icQRIbLzZi9jXoJULc/iahp LazA== 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 v12si9746852ilh.31.2021.09.18.21.06.22; Sat, 18 Sep 2021 21:06:58 -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 S237338AbhIRN3v (ORCPT + 99 others); Sat, 18 Sep 2021 09:29:51 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:55028 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237235AbhIRN3u (ORCPT ); Sat, 18 Sep 2021 09:29:50 -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 5f1cbb66e24808ce; Sat, 18 Sep 2021 15:28:25 +0200 Received: from kreacher.localnet (89-77-51-84.dynamic.chello.pl [89.77.51.84]) (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 2442D66A51F; Sat, 18 Sep 2021 15:28:24 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI , Linux PCI Cc: LKML , Bjorn Helgaas , Andy Shevchenko , Mika Westerberg , x86 Maintainers Subject: [PATCH v1 5/5] PCI: PM: ACPI: Drop unnecessary acpi_pci_power_manageable() calls Date: Sat, 18 Sep 2021 15:27:37 +0200 Message-ID: <1769617.atdPhlSkOF@kreacher> In-Reply-To: <8003272.NyiUUSuA9g@kreacher> References: <8003272.NyiUUSuA9g@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 89.77.51.84 X-CLIENT-HOSTNAME: 89-77-51-84.dynamic.chello.pl X-VADE-SPAMSTATE: spam:low X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvtddrudehkedgiedvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenogfuphgrmhfkphculdeftddtmdenucfjughrpefhvffufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvjeelgffhiedukedtleekkedvudfggefhgfegjefgueekjeelvefggfdvledutdenucfkphepkeelrdejjedrhedurdekgeenucfuphgrmhfkphepkeelrdejjedrhedurdekgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeekledrjeejrdehuddrkeegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqphgtihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehhvghlghgrrghssehkvghr nhgvlhdrohhrghdprhgtphhtthhopegrnhgurhhihidrshhhvghvtghhvghnkhhosehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtohepmhhikhgrrdifvghsthgvrhgsvghrgheslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopeigkeeisehkvghrnhgvlhdrohhrgh 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 Simplify acpi_pci_power_manageable() and drop two invocations of it 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 --- drivers/pci/pci-acpi.c | 4 +--- drivers/pci/pci.c | 16 +++++----------- 2 files changed, 6 insertions(+), 14 deletions(-) Index: linux-pm/drivers/pci/pci.c =================================================================== --- linux-pm.orig/drivers/pci/pci.c +++ linux-pm/drivers/pci/pci.c @@ -1128,9 +1128,7 @@ void pci_update_current_state(struct pci */ void pci_refresh_power_state(struct pci_dev *dev) { - if (acpi_pci_power_manageable(dev)) - acpi_pci_refresh_power_state(dev); - + acpi_pci_refresh_power_state(dev); pci_update_current_state(dev, dev->current_state); } @@ -1143,14 +1141,10 @@ int pci_platform_power_transition(struct { int error; - if (acpi_pci_power_manageable(dev)) { - error = acpi_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 = acpi_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; Index: linux-pm/drivers/pci/pci-acpi.c =================================================================== --- linux-pm.orig/drivers/pci/pci-acpi.c +++ linux-pm/drivers/pci/pci-acpi.c @@ -969,9 +969,7 @@ bool acpi_pci_power_manageable(struct pc { struct acpi_device *adev = ACPI_COMPANION(&dev->dev); - if (!adev) - return false; - return acpi_device_power_manageable(adev); + return adev && acpi_device_power_manageable(adev); } bool acpi_pci_bridge_d3(struct pci_dev *dev)