aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2012-11-05 15:20:34 -0500
committerBjorn Helgaas <bhelgaas@google.com>2012-11-09 22:07:31 -0500
commit4e15c46bdc4d5ea0e7991a05edbd807328d38a2c (patch)
treed1206db8fa4a47ecbddb264bd71b2c700e0a8a44 /drivers/pci
parent8f0d8163b50e01f398b14bcd4dc039ac5ab18d64 (diff)
PCI: Add pci_device_type to pdev's device struct
Need type filled in device structure so it can be used for visible attribute control in sysfs for pci_dev. Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci-sysfs.c24
-rw-r--r--drivers/pci/pci.h1
-rw-r--r--drivers/pci/probe.c1
3 files changed, 26 insertions, 0 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 02d107b15281..3d160aa608c1 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -1411,3 +1411,27 @@ static int __init pci_sysfs_init(void)
1411} 1411}
1412 1412
1413late_initcall(pci_sysfs_init); 1413late_initcall(pci_sysfs_init);
1414
1415static struct attribute *pci_dev_dev_attrs[] = {
1416 NULL,
1417};
1418
1419static umode_t pci_dev_attrs_are_visible(struct kobject *kobj,
1420 struct attribute *a, int n)
1421{
1422 return a->mode;
1423}
1424
1425static struct attribute_group pci_dev_attr_group = {
1426 .attrs = pci_dev_dev_attrs,
1427 .is_visible = pci_dev_attrs_are_visible,
1428};
1429
1430static const struct attribute_group *pci_dev_attr_groups[] = {
1431 &pci_dev_attr_group,
1432 NULL,
1433};
1434
1435struct device_type pci_dev_type = {
1436 .groups = pci_dev_attr_groups,
1437};
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index bacbcba69cf3..6f6cd145bb7e 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -157,6 +157,7 @@ static inline int pci_no_d1d2(struct pci_dev *dev)
157} 157}
158extern struct device_attribute pci_dev_attrs[]; 158extern struct device_attribute pci_dev_attrs[];
159extern struct device_attribute pcibus_dev_attrs[]; 159extern struct device_attribute pcibus_dev_attrs[];
160extern struct device_type pci_dev_type;
160#ifdef CONFIG_HOTPLUG 161#ifdef CONFIG_HOTPLUG
161extern struct bus_attribute pci_bus_attrs[]; 162extern struct bus_attribute pci_bus_attrs[];
162#else 163#else
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ec909afa90b6..0312f1c48b3c 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -975,6 +975,7 @@ int pci_setup_device(struct pci_dev *dev)
975 dev->sysdata = dev->bus->sysdata; 975 dev->sysdata = dev->bus->sysdata;
976 dev->dev.parent = dev->bus->bridge; 976 dev->dev.parent = dev->bus->bridge;
977 dev->dev.bus = &pci_bus_type; 977 dev->dev.bus = &pci_bus_type;
978 dev->dev.type = &pci_dev_type;
978 dev->hdr_type = hdr_type & 0x7f; 979 dev->hdr_type = hdr_type & 0x7f;
979 dev->multifunction = !!(hdr_type & 0x80); 980 dev->multifunction = !!(hdr_type & 0x80);
980 dev->error_state = pci_channel_io_normal; 981 dev->error_state = pci_channel_io_normal;