aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci-sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/pci-sysfs.c')
-rw-r--r--drivers/pci/pci-sysfs.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 5b4a9d9cd200..403da60cd983 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -325,6 +325,8 @@ dev_rescan_store(struct device *dev, struct device_attribute *attr,
325 } 325 }
326 return count; 326 return count;
327} 327}
328struct device_attribute dev_rescan_attr = __ATTR(rescan, (S_IWUSR|S_IWGRP),
329 NULL, dev_rescan_store);
328 330
329static void remove_callback(struct device *dev) 331static void remove_callback(struct device *dev)
330{ 332{
@@ -354,6 +356,8 @@ remove_store(struct device *dev, struct device_attribute *dummy,
354 count = ret; 356 count = ret;
355 return count; 357 return count;
356} 358}
359struct device_attribute dev_remove_attr = __ATTR(remove, (S_IWUSR|S_IWGRP),
360 NULL, remove_store);
357 361
358static ssize_t 362static ssize_t
359dev_bus_rescan_store(struct device *dev, struct device_attribute *attr, 363dev_bus_rescan_store(struct device *dev, struct device_attribute *attr,
@@ -504,8 +508,6 @@ struct device_attribute pci_dev_attrs[] = {
504 __ATTR(broken_parity_status,(S_IRUGO|S_IWUSR), 508 __ATTR(broken_parity_status,(S_IRUGO|S_IWUSR),
505 broken_parity_status_show,broken_parity_status_store), 509 broken_parity_status_show,broken_parity_status_store),
506 __ATTR(msi_bus, 0644, msi_bus_show, msi_bus_store), 510 __ATTR(msi_bus, 0644, msi_bus_show, msi_bus_store),
507 __ATTR(remove, (S_IWUSR|S_IWGRP), NULL, remove_store),
508 __ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_rescan_store),
509#if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI) 511#if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
510 __ATTR(d3cold_allowed, 0644, d3cold_allowed_show, d3cold_allowed_store), 512 __ATTR(d3cold_allowed, 0644, d3cold_allowed_show, d3cold_allowed_store),
511#endif 513#endif
@@ -1463,6 +1465,29 @@ static umode_t pci_dev_attrs_are_visible(struct kobject *kobj,
1463 return a->mode; 1465 return a->mode;
1464} 1466}
1465 1467
1468static struct attribute *pci_dev_hp_attrs[] = {
1469 &dev_remove_attr.attr,
1470 &dev_rescan_attr.attr,
1471 NULL,
1472};
1473
1474static umode_t pci_dev_hp_attrs_are_visible(struct kobject *kobj,
1475 struct attribute *a, int n)
1476{
1477 struct device *dev = container_of(kobj, struct device, kobj);
1478 struct pci_dev *pdev = to_pci_dev(dev);
1479
1480 if (pdev->is_virtfn)
1481 return 0;
1482
1483 return a->mode;
1484}
1485
1486static struct attribute_group pci_dev_hp_attr_group = {
1487 .attrs = pci_dev_hp_attrs,
1488 .is_visible = pci_dev_hp_attrs_are_visible,
1489};
1490
1466#ifdef CONFIG_PCI_IOV 1491#ifdef CONFIG_PCI_IOV
1467static struct attribute *sriov_dev_attrs[] = { 1492static struct attribute *sriov_dev_attrs[] = {
1468 &sriov_totalvfs_attr.attr, 1493 &sriov_totalvfs_attr.attr,
@@ -1494,6 +1519,7 @@ static struct attribute_group pci_dev_attr_group = {
1494 1519
1495static const struct attribute_group *pci_dev_attr_groups[] = { 1520static const struct attribute_group *pci_dev_attr_groups[] = {
1496 &pci_dev_attr_group, 1521 &pci_dev_attr_group,
1522 &pci_dev_hp_attr_group,
1497#ifdef CONFIG_PCI_IOV 1523#ifdef CONFIG_PCI_IOV
1498 &sriov_dev_attr_group, 1524 &sriov_dev_attr_group,
1499#endif 1525#endif