Use PCI_SPEED2STR macro to replace judgement statment in bus_speed_read() function. Add "PCIe" suffix when decoding PCIe speed for proper display. Signed-off-by: Yicong Yang <yangyicong@xxxxxxxxxxxxx> --- drivers/pci/slot.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c index fb7c172..871d598 100644 --- a/drivers/pci/slot.c +++ b/drivers/pci/slot.c @@ -51,14 +51,10 @@ static ssize_t address_read_file(struct pci_slot *slot, char *buf) static ssize_t bus_speed_read(enum pci_bus_speed speed, char *buf) { - const char *speed_string; + if (speed <= PCI_SPEED_133MHz_PCIX_533) + return sprintf(buf, "%s\n", PCI_SPEED2STR(speed)); - if (speed < pci_bus_speed_strings_size) - speed_string = pci_bus_speed_strings[speed]; - else - speed_string = "Unknown"; - - return sprintf(buf, "%s\n", speed_string); + return sprintf(buf, "%s PCIe\n", PCI_SPEED2STR(speed)); } static ssize_t max_speed_read_file(struct pci_slot *slot, char *buf) -- 2.8.1