|
@@ -167,15 +167,9 @@ static DEVICE_ATTR_RO(max_link_speed);
|
|
static ssize_t max_link_width_show(struct device *dev,
|
|
static ssize_t max_link_width_show(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
{
|
|
- struct pci_dev *pci_dev = to_pci_dev(dev);
|
|
|
|
- u32 linkcap;
|
|
|
|
- int err;
|
|
|
|
-
|
|
|
|
- err = pcie_capability_read_dword(pci_dev, PCI_EXP_LNKCAP, &linkcap);
|
|
|
|
- if (err)
|
|
|
|
- return -EINVAL;
|
|
|
|
|
|
+ struct pci_dev *pdev = to_pci_dev(dev);
|
|
|
|
|
|
- return sprintf(buf, "%u\n", (linkcap & PCI_EXP_LNKCAP_MLW) >> 4);
|
|
|
|
|
|
+ return sprintf(buf, "%u\n", pcie_get_width_cap(pdev));
|
|
}
|
|
}
|
|
static DEVICE_ATTR_RO(max_link_width);
|
|
static DEVICE_ATTR_RO(max_link_width);
|
|
|
|
|