Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+13 -16
+13 -16
drivers/acpi/acpi_processor.c
··· 48 48 49 49 static int acpi_processor_errata_piix4(struct pci_dev *dev) 50 50 { 51 - u8 value1 = 0; 52 - u8 value2 = 0; 53 - struct pci_dev *ide_dev = NULL, *isa_dev = NULL; 54 - 55 - 56 51 if (!dev) 57 52 return -EINVAL; 58 53 ··· 103 108 * each IDE controller's DMA status to make sure we catch all 104 109 * DMA activity. 105 110 */ 106 - ide_dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, 111 + dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, 107 112 PCI_DEVICE_ID_INTEL_82371AB, 108 113 PCI_ANY_ID, PCI_ANY_ID, NULL); 109 - if (ide_dev) { 110 - errata.piix4.bmisx = pci_resource_start(ide_dev, 4); 114 + if (dev) { 115 + errata.piix4.bmisx = pci_resource_start(dev, 4); 111 116 if (errata.piix4.bmisx) 112 - dev_dbg(&ide_dev->dev, 117 + dev_dbg(&dev->dev, 113 118 "Bus master activity detection (BM-IDE) erratum enabled\n"); 114 119 115 - pci_dev_put(ide_dev); 120 + pci_dev_put(dev); 116 121 } 117 122 118 123 /* ··· 124 129 * disable C3 support if this is enabled, as some legacy 125 130 * devices won't operate well if fast DMA is disabled. 126 131 */ 127 - isa_dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, 132 + dev = pci_get_subsys(PCI_VENDOR_ID_INTEL, 128 133 PCI_DEVICE_ID_INTEL_82371AB_0, 129 134 PCI_ANY_ID, PCI_ANY_ID, NULL); 130 - if (isa_dev) { 131 - pci_read_config_byte(isa_dev, 0x76, &value1); 132 - pci_read_config_byte(isa_dev, 0x77, &value2); 135 + if (dev) { 136 + u8 value1 = 0, value2 = 0; 137 + 138 + pci_read_config_byte(dev, 0x76, &value1); 139 + pci_read_config_byte(dev, 0x77, &value2); 133 140 if ((value1 & 0x80) || (value2 & 0x80)) { 134 141 errata.piix4.fdma = 1; 135 - dev_dbg(&isa_dev->dev, 142 + dev_dbg(&dev->dev, 136 143 "Type-F DMA livelock erratum (C3 disabled)\n"); 137 144 } 138 - pci_dev_put(isa_dev); 145 + pci_dev_put(dev); 139 146 } 140 147 141 148 break;