1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-22 16:42:56 -08:00

convert a series of if statements checking the cap type to switch

This commit is contained in:
dlg 2019-02-19 21:29:45 +00:00
parent 55ce135f32
commit 374253ac95

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pcidump.c,v 1.47 2018/04/08 13:55:40 kettenis Exp $ */
/* $OpenBSD: pcidump.c,v 1.48 2019/02/19 21:29:45 dlg Exp $ */
/*
* Copyright (c) 2006, 2007 David Gwynne <loki@animata.net>
@ -445,11 +445,14 @@ dump_caplist(int bus, int dev, int func, u_int8_t ptr)
if (cap >= nitems(pci_capnames))
cap = 0;
printf("%s\n", pci_capnames[cap]);
if (cap == PCI_CAP_PWRMGMT)
switch (cap) {
case PCI_CAP_PWRMGMT:
dump_pci_powerstate(bus, dev, func, ptr);
if (cap == PCI_CAP_PCIEXPRESS) {
break;
case PCI_CAP_PCIEXPRESS:
dump_pcie_linkspeed(bus, dev, func, ptr);
dump_pcie_enhanced_caplist(bus, dev, func);
break;
}
ptr = PCI_CAPLIST_NEXT(reg);
}