Skip to content

Commit e7513ec

Browse files
ij-inteltsbogend
authored andcommitted
MIPS: TXx9: Do PCI error checks on own line
Instead of if conditions with line splits, use the usual error handling pattern with a separate variable to improve readability. The second check can use reverse logic which reduces indentation level. No functional changes intended. Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
1 parent d913ff5 commit e7513ec

File tree

1 file changed

+23
-20
lines changed
  • arch/mips/txx9/generic

1 file changed

+23
-20
lines changed

arch/mips/txx9/generic/pci.c

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ int __init txx9_pci66_check(struct pci_controller *hose, int top_bus,
5151
unsigned short vid;
5252
int cap66 = -1;
5353
u16 stat;
54+
int ret;
5455

5556
/* It seems SLC90E66 needs some time after PCI reset... */
5657
mdelay(80);
@@ -60,9 +61,9 @@ int __init txx9_pci66_check(struct pci_controller *hose, int top_bus,
6061
for (pci_devfn = 0; pci_devfn < 0xff; pci_devfn++) {
6162
if (PCI_FUNC(pci_devfn))
6263
continue;
63-
if (early_read_config_word(hose, top_bus, current_bus,
64-
pci_devfn, PCI_VENDOR_ID, &vid) !=
65-
PCIBIOS_SUCCESSFUL)
64+
ret = early_read_config_word(hose, top_bus, current_bus,
65+
pci_devfn, PCI_VENDOR_ID, &vid);
66+
if (ret != PCIBIOS_SUCCESSFUL)
6667
continue;
6768
if (vid == 0xffff)
6869
continue;
@@ -343,26 +344,28 @@ static void tc35815_fixup(struct pci_dev *dev)
343344

344345
static void final_fixup(struct pci_dev *dev)
345346
{
347+
unsigned long timeout;
346348
unsigned char bist;
349+
int ret;
347350

348351
/* Do build-in self test */
349-
if (pci_read_config_byte(dev, PCI_BIST, &bist) == PCIBIOS_SUCCESSFUL &&
350-
(bist & PCI_BIST_CAPABLE)) {
351-
unsigned long timeout;
352-
pci_set_power_state(dev, PCI_D0);
353-
pr_info("PCI: %s BIST...", pci_name(dev));
354-
pci_write_config_byte(dev, PCI_BIST, PCI_BIST_START);
355-
timeout = jiffies + HZ * 2; /* timeout after 2 sec */
356-
do {
357-
pci_read_config_byte(dev, PCI_BIST, &bist);
358-
if (time_after(jiffies, timeout))
359-
break;
360-
} while (bist & PCI_BIST_START);
361-
if (bist & (PCI_BIST_CODE_MASK | PCI_BIST_START))
362-
pr_cont("failed. (0x%x)\n", bist);
363-
else
364-
pr_cont("OK.\n");
365-
}
352+
ret = pci_read_config_byte(dev, PCI_BIST, &bist);
353+
if ((ret != PCIBIOS_SUCCESSFUL) || !(bist & PCI_BIST_CAPABLE))
354+
return;
355+
356+
pci_set_power_state(dev, PCI_D0);
357+
pr_info("PCI: %s BIST...", pci_name(dev));
358+
pci_write_config_byte(dev, PCI_BIST, PCI_BIST_START);
359+
timeout = jiffies + HZ * 2; /* timeout after 2 sec */
360+
do {
361+
pci_read_config_byte(dev, PCI_BIST, &bist);
362+
if (time_after(jiffies, timeout))
363+
break;
364+
} while (bist & PCI_BIST_START);
365+
if (bist & (PCI_BIST_CODE_MASK | PCI_BIST_START))
366+
pr_cont("failed. (0x%x)\n", bist);
367+
else
368+
pr_cont("OK.\n");
366369
}
367370

368371
#ifdef CONFIG_TOSHIBA_FPCIB0

0 commit comments

Comments
 (0)