aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2014-04-17 13:46:15 -0400
committerBjorn Helgaas <bhelgaas@google.com>2014-04-30 16:48:41 -0400
commitdfc73e7acd9925b434a355eeeed86d44cb435f9c (patch)
tree02b907874b2f1bbce4c485f4bc40ffd161715da2 /drivers/pci
parent1e358f94c00570f88a590cabe718daf835440cc9 (diff)
PCI: Move Open Firmware devspec attribute to PCI common code
Move the devspec OF attribute to PCI common code's set of device attributes since it's not architecture dependent. As a side effect microblaze and powerpc no longer need to use pcibios_add_platform_entries(). [bhelgaas: fold in #include for compile error] Link: https://lkml.kernel.org/r/alpine.LFD.2.11.1404141101500.1529@denkbrett Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci-sysfs.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 4e0acefb7565..3db1c7ff5dd3 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -29,6 +29,7 @@
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/vgaarb.h> 30#include <linux/vgaarb.h>
31#include <linux/pm_runtime.h> 31#include <linux/pm_runtime.h>
32#include <linux/of.h>
32#include "pci.h" 33#include "pci.h"
33 34
34static int sysfs_initialized; /* = 0 */ 35static int sysfs_initialized; /* = 0 */
@@ -416,6 +417,20 @@ static ssize_t d3cold_allowed_show(struct device *dev,
416static DEVICE_ATTR_RW(d3cold_allowed); 417static DEVICE_ATTR_RW(d3cold_allowed);
417#endif 418#endif
418 419
420#ifdef CONFIG_OF
421static ssize_t devspec_show(struct device *dev,
422 struct device_attribute *attr, char *buf)
423{
424 struct pci_dev *pdev = to_pci_dev(dev);
425 struct device_node *np = pci_device_to_OF_node(pdev);
426
427 if (np == NULL || np->full_name == NULL)
428 return 0;
429 return sprintf(buf, "%s", np->full_name);
430}
431static DEVICE_ATTR_RO(devspec);
432#endif
433
419#ifdef CONFIG_PCI_IOV 434#ifdef CONFIG_PCI_IOV
420static ssize_t sriov_totalvfs_show(struct device *dev, 435static ssize_t sriov_totalvfs_show(struct device *dev,
421 struct device_attribute *attr, 436 struct device_attribute *attr,
@@ -521,6 +536,9 @@ static struct attribute *pci_dev_attrs[] = {
521#if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI) 536#if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
522 &dev_attr_d3cold_allowed.attr, 537 &dev_attr_d3cold_allowed.attr,
523#endif 538#endif
539#ifdef CONFIG_OF
540 &dev_attr_devspec.attr,
541#endif
524 NULL, 542 NULL,
525}; 543};
526 544