From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Tuo Li <islituo@gmail.com>
Subject: [PATCH v1] ACPI: processor: Rearrange and clean up acpi_processor_errata_piix4()
Date: Tue, 31 Mar 2026 21:09:42 +0200 [thread overview]
Message-ID: <2846888.mvXUDI8C0e@rafael.j.wysocki> (raw)
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
In acpi_processor_errata_piix4() it is not necessary to use three
struct pci_dev pointers. One is sufficient, so use it everywhere and
drop the other two.
Additionally, define the auxiliary local variables value1 and value2
in the code block in which they are used.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/acpi/acpi_processor.c | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -48,11 +48,6 @@ acpi_handle acpi_get_processor_handle(in
static int acpi_processor_errata_piix4(struct pci_dev *dev)
{
- u8 value1 = 0;
- u8 value2 = 0;
- struct pci_dev *ide_dev = NULL, *isa_dev = NULL;
-
-
if (!dev)
return -EINVAL;
@@ -108,16 +103,16 @@ static int acpi_processor_errata_piix4(s
* each IDE controller's DMA status to make sure we catch all
* DMA activity.
*/
- ide_dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
+ dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_82371AB,
PCI_ANY_ID, PCI_ANY_ID, NULL);
- if (ide_dev) {
- errata.piix4.bmisx = pci_resource_start(ide_dev, 4);
+ if (dev) {
+ errata.piix4.bmisx = pci_resource_start(dev, 4);
if (errata.piix4.bmisx)
- dev_dbg(&ide_dev->dev,
+ dev_dbg(&dev->dev,
"Bus master activity detection (BM-IDE) erratum enabled\n");
- pci_dev_put(ide_dev);
+ pci_dev_put(dev);
}
/*
@@ -129,18 +124,20 @@ static int acpi_processor_errata_piix4(s
* disable C3 support if this is enabled, as some legacy
* devices won't operate well if fast DMA is disabled.
*/
- isa_dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
+ dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_82371AB_0,
PCI_ANY_ID, PCI_ANY_ID, NULL);
- if (isa_dev) {
- pci_read_config_byte(isa_dev, 0x76, &value1);
- pci_read_config_byte(isa_dev, 0x77, &value2);
+ if (dev) {
+ u8 value1 = 0, value2 = 0;
+
+ pci_read_config_byte(dev, 0x76, &value1);
+ pci_read_config_byte(dev, 0x77, &value2);
if ((value1 & 0x80) || (value2 & 0x80)) {
errata.piix4.fdma = 1;
- dev_dbg(&isa_dev->dev,
+ dev_dbg(&dev->dev,
"Type-F DMA livelock erratum (C3 disabled)\n");
}
- pci_dev_put(isa_dev);
+ pci_dev_put(dev);
}
break;
reply other threads:[~2026-03-31 19:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=2846888.mvXUDI8C0e@rafael.j.wysocki \
--to=rafael@kernel.org \
--cc=islituo@gmail.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox