linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Bjorn Helgaas <bhelgaas@google.com>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>
Cc: linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org, joro@8bytes.org, jroedel@suse.de
Subject: [PATCH v3 3/4] PCI/ACPI: Move _OSC query checks to separate function
Date: Tue, 24 Aug 2021 14:20:53 +0200	[thread overview]
Message-ID: <20210824122054.29481-4-joro@8bytes.org> (raw)
In-Reply-To: <20210824122054.29481-1-joro@8bytes.org>

From: Joerg Roedel <jroedel@suse.de>

Move the checks about whether the _OSC controls are requested from the
firmware to a separate function.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
 drivers/acpi/pci_root.c | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index ed4e6b55e9bc..f12e512bcddc 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -449,6 +449,24 @@ static u32 calculate_control(void)
 	return control;
 }
 
+static bool os_control_query_checks(struct acpi_pci_root *root, u32 support)
+{
+	struct acpi_device *device = root->device;
+
+	if (pcie_ports_disabled) {
+		dev_info(&device->dev, "PCIe port services disabled; not requesting _OSC control\n");
+		return false;
+	}
+
+	if ((support & ACPI_PCIE_REQ_SUPPORT) != ACPI_PCIE_REQ_SUPPORT) {
+		decode_osc_support(root, "not requesting OS control; OS requires",
+				   ACPI_PCIE_REQ_SUPPORT);
+		return false;
+	}
+
+	return true;
+}
+
 static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm,
 				 bool is_pcie)
 {
@@ -485,16 +503,8 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm,
 		return;
 	}
 
-	if (pcie_ports_disabled) {
-		dev_info(&device->dev, "PCIe port services disabled; not requesting _OSC control\n");
+	if (!os_control_query_checks(root, support))
 		return;
-	}
-
-	if ((support & ACPI_PCIE_REQ_SUPPORT) != ACPI_PCIE_REQ_SUPPORT) {
-		decode_osc_support(root, "not requesting OS control; OS requires",
-				   ACPI_PCIE_REQ_SUPPORT);
-		return;
-	}
 
 	requested = control = calculate_control();
 
-- 
2.32.0


  parent reply	other threads:[~2021-08-24 12:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24 12:20 [PATCH v3 0/4] PCI/ACPI: Simplify PCIe _OSC feature negotiation Joerg Roedel
2021-08-24 12:20 ` [PATCH v3 1/4] PCI/ACPI: Remove OSC_PCI_SUPPORT_MASKS and OSC_PCI_CONTROL_MASKS Joerg Roedel
2021-09-01 18:53   ` Rafael J. Wysocki
2021-08-24 12:20 ` [PATCH v3 2/4] PCI/ACPI: Move supported and control calculations to separaten functions Joerg Roedel
2021-09-01 18:56   ` Rafael J. Wysocki
2021-08-24 12:20 ` Joerg Roedel [this message]
2021-09-01 18:57   ` [PATCH v3 3/4] PCI/ACPI: Move _OSC query checks to separate function Rafael J. Wysocki
2021-08-24 12:20 ` [PATCH v3 4/4] PCI/ACPI: Check for _OSC support in acpi_pci_osc_control_set() Joerg Roedel
2021-09-01 19:31   ` Rafael J. Wysocki
2021-09-01 19:33 ` [PATCH v3 0/4] PCI/ACPI: Simplify PCIe _OSC feature negotiation Rafael J. Wysocki
2021-09-13 16:14   ` Rafael J. Wysocki
2021-09-14 13:49     ` Joerg Roedel
2021-09-14 13:52       ` Bjorn Helgaas
2021-09-28 21:21 ` Bjorn Helgaas
2021-09-29  8:09   ` Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210824122054.29481-4-joro@8bytes.org \
    --to=joro@8bytes.org \
    --cc=bhelgaas@google.com \
    --cc=jroedel@suse.de \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --subject='Re: [PATCH v3 3/4] PCI/ACPI: Move _OSC query checks to separate function' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).