Skip to content

Commit 00154ee

Browse files
committed
ACPI: processor: Rearrange and clean up acpi_processor_errata_piix4()
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> Link: https://patch.msgid.link/2846888.mvXUDI8C0e@rafael.j.wysocki
1 parent 8c1c315 commit 00154ee

1 file changed

Lines changed: 13 additions & 16 deletions

File tree

drivers/acpi/acpi_processor.c

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ acpi_handle acpi_get_processor_handle(int cpu)
4848

4949
static int acpi_processor_errata_piix4(struct pci_dev *dev)
5050
{
51-
u8 value1 = 0;
52-
u8 value2 = 0;
53-
struct pci_dev *ide_dev = NULL, *isa_dev = NULL;
54-
55-
5651
if (!dev)
5752
return -EINVAL;
5853

@@ -108,16 +103,16 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev)
108103
* each IDE controller's DMA status to make sure we catch all
109104
* DMA activity.
110105
*/
111-
ide_dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
106+
dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
112107
PCI_DEVICE_ID_INTEL_82371AB,
113108
PCI_ANY_ID, PCI_ANY_ID, NULL);
114-
if (ide_dev) {
115-
errata.piix4.bmisx = pci_resource_start(ide_dev, 4);
109+
if (dev) {
110+
errata.piix4.bmisx = pci_resource_start(dev, 4);
116111
if (errata.piix4.bmisx)
117-
dev_dbg(&ide_dev->dev,
112+
dev_dbg(&dev->dev,
118113
"Bus master activity detection (BM-IDE) erratum enabled\n");
119114

120-
pci_dev_put(ide_dev);
115+
pci_dev_put(dev);
121116
}
122117

123118
/*
@@ -129,18 +124,20 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev)
129124
* disable C3 support if this is enabled, as some legacy
130125
* devices won't operate well if fast DMA is disabled.
131126
*/
132-
isa_dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
127+
dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
133128
PCI_DEVICE_ID_INTEL_82371AB_0,
134129
PCI_ANY_ID, PCI_ANY_ID, NULL);
135-
if (isa_dev) {
136-
pci_read_config_byte(isa_dev, 0x76, &value1);
137-
pci_read_config_byte(isa_dev, 0x77, &value2);
130+
if (dev) {
131+
u8 value1 = 0, value2 = 0;
132+
133+
pci_read_config_byte(dev, 0x76, &value1);
134+
pci_read_config_byte(dev, 0x77, &value2);
138135
if ((value1 & 0x80) || (value2 & 0x80)) {
139136
errata.piix4.fdma = 1;
140-
dev_dbg(&isa_dev->dev,
137+
dev_dbg(&dev->dev,
141138
"Type-F DMA livelock erratum (C3 disabled)\n");
142139
}
143-
pci_dev_put(isa_dev);
140+
pci_dev_put(dev);
144141
}
145142

146143
break;

0 commit comments

Comments
 (0)