aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2013-10-31 16:12:40 -0400
committerBjorn Helgaas <bhelgaas@google.com>2013-10-31 16:12:40 -0400
commit33de1b8bf6e11a3bc69faf2f7ffb3692c723bdf5 (patch)
tree5e92465442ad3166ba1c9bd423c20d67b018d1e0 /drivers/pci
parentcc17a67c0762a6030b43e98d775a12a99e5ff247 (diff)
parent0394cb192db4397753046775a8caa736397737b5 (diff)
Merge branch 'pci/misc' into next
* pci/misc: PCI: Report pci_pme_active() kmalloc failure mn10300/PCI: Remove useless pcibios_last_bus frv/PCI: Remove pcibios_last_bus PCI: Fail MSI/MSI-X initialization if device is not in PCI_D0 x86/PCI: Coalesce multiple overlapping host bridge windows MAINTAINERS: Add arch/x86/pci to PCI file patterns PCI/PM: Remove pci_pm_complete() PCI: Add pci_dev_show_local_cpu() to simplify code mn10300/PCI: Remove unused pci_mem_start cris/PCI: Remove unused pci_mem_start PCI: Make pci_dev_pm_ops static Conflicts: drivers/pci/pci-sysfs.c
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/msi.c6
-rw-r--r--drivers/pci/pci-driver.c11
-rw-r--r--drivers/pci/pci-sysfs.c33
-rw-r--r--drivers/pci/pci.c7
4 files changed, 24 insertions, 33 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index d5f90d6383bc..604265c40853 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -831,7 +831,7 @@ int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec)
831 int status, maxvec; 831 int status, maxvec;
832 u16 msgctl; 832 u16 msgctl;
833 833
834 if (!dev->msi_cap) 834 if (!dev->msi_cap || dev->current_state != PCI_D0)
835 return -EINVAL; 835 return -EINVAL;
836 836
837 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &msgctl); 837 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &msgctl);
@@ -862,7 +862,7 @@ int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec)
862 int ret, nvec; 862 int ret, nvec;
863 u16 msgctl; 863 u16 msgctl;
864 864
865 if (!dev->msi_cap) 865 if (!dev->msi_cap || dev->current_state != PCI_D0)
866 return -EINVAL; 866 return -EINVAL;
867 867
868 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &msgctl); 868 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &msgctl);
@@ -955,7 +955,7 @@ int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec)
955 int status, nr_entries; 955 int status, nr_entries;
956 int i, j; 956 int i, j;
957 957
958 if (!entries || !dev->msix_cap) 958 if (!entries || !dev->msix_cap || dev->current_state != PCI_D0)
959 return -EINVAL; 959 return -EINVAL;
960 960
961 status = pci_msi_check_device(dev, nvec, PCI_CAP_ID_MSIX); 961 status = pci_msi_check_device(dev, nvec, PCI_CAP_ID_MSIX);
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 9f85960a62ed..840fdc5ba0d8 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -602,18 +602,10 @@ static int pci_pm_prepare(struct device *dev)
602 return error; 602 return error;
603} 603}
604 604
605static void pci_pm_complete(struct device *dev)
606{
607 struct device_driver *drv = dev->driver;
608
609 if (drv && drv->pm && drv->pm->complete)
610 drv->pm->complete(dev);
611}
612 605
613#else /* !CONFIG_PM_SLEEP */ 606#else /* !CONFIG_PM_SLEEP */
614 607
615#define pci_pm_prepare NULL 608#define pci_pm_prepare NULL
616#define pci_pm_complete NULL
617 609
618#endif /* !CONFIG_PM_SLEEP */ 610#endif /* !CONFIG_PM_SLEEP */
619 611
@@ -1124,9 +1116,8 @@ static int pci_pm_runtime_idle(struct device *dev)
1124 1116
1125#ifdef CONFIG_PM 1117#ifdef CONFIG_PM
1126 1118
1127const struct dev_pm_ops pci_dev_pm_ops = { 1119static const struct dev_pm_ops pci_dev_pm_ops = {
1128 .prepare = pci_pm_prepare, 1120 .prepare = pci_pm_prepare,
1129 .complete = pci_pm_complete,
1130 .suspend = pci_pm_suspend, 1121 .suspend = pci_pm_suspend,
1131 .resume = pci_pm_resume, 1122 .resume = pci_pm_resume,
1132 .freeze = pci_pm_freeze, 1123 .freeze = pci_pm_freeze,
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 82cc45867eaa..2aaa83c85a4e 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -76,9 +76,11 @@ static ssize_t broken_parity_status_store(struct device *dev,
76} 76}
77static DEVICE_ATTR_RW(broken_parity_status); 77static DEVICE_ATTR_RW(broken_parity_status);
78 78
79static ssize_t local_cpus_show(struct device *dev, 79static ssize_t pci_dev_show_local_cpu(struct device *dev,
80 struct device_attribute *attr, char *buf) 80 int type,
81{ 81 struct device_attribute *attr,
82 char *buf)
83{
82 const struct cpumask *mask; 84 const struct cpumask *mask;
83 int len; 85 int len;
84 86
@@ -88,29 +90,26 @@ static ssize_t local_cpus_show(struct device *dev,
88#else 90#else
89 mask = cpumask_of_pcibus(to_pci_dev(dev)->bus); 91 mask = cpumask_of_pcibus(to_pci_dev(dev)->bus);
90#endif 92#endif
91 len = cpumask_scnprintf(buf, PAGE_SIZE-2, mask); 93 len = type ?
94 cpumask_scnprintf(buf, PAGE_SIZE-2, mask) :
95 cpulist_scnprintf(buf, PAGE_SIZE-2, mask);
96
92 buf[len++] = '\n'; 97 buf[len++] = '\n';
93 buf[len] = '\0'; 98 buf[len] = '\0';
94 return len; 99 return len;
95} 100}
101
102static ssize_t local_cpus_show(struct device *dev,
103 struct device_attribute *attr, char *buf)
104{
105 return pci_dev_show_local_cpu(dev, 1, attr, buf);
106}
96static DEVICE_ATTR_RO(local_cpus); 107static DEVICE_ATTR_RO(local_cpus);
97 108
98static ssize_t local_cpulist_show(struct device *dev, 109static ssize_t local_cpulist_show(struct device *dev,
99 struct device_attribute *attr, char *buf) 110 struct device_attribute *attr, char *buf)
100{ 111{
101 const struct cpumask *mask; 112 return pci_dev_show_local_cpu(dev, 0, attr, buf);
102 int len;
103
104#ifdef CONFIG_NUMA
105 mask = (dev_to_node(dev) == -1) ? cpu_online_mask :
106 cpumask_of_node(dev_to_node(dev));
107#else
108 mask = cpumask_of_pcibus(to_pci_dev(dev)->bus);
109#endif
110 len = cpulist_scnprintf(buf, PAGE_SIZE-2, mask);
111 buf[len++] = '\n';
112 buf[len] = '\0';
113 return len;
114} 113}
115static DEVICE_ATTR_RO(local_cpulist); 114static DEVICE_ATTR_RO(local_cpulist);
116 115
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index c0805f26f339..457f801fc49d 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1638,8 +1638,10 @@ void pci_pme_active(struct pci_dev *dev, bool enable)
1638 if (enable) { 1638 if (enable) {
1639 pme_dev = kmalloc(sizeof(struct pci_pme_device), 1639 pme_dev = kmalloc(sizeof(struct pci_pme_device),
1640 GFP_KERNEL); 1640 GFP_KERNEL);
1641 if (!pme_dev) 1641 if (!pme_dev) {
1642 goto out; 1642 dev_warn(&dev->dev, "can't enable PME#\n");
1643 return;
1644 }
1643 pme_dev->dev = dev; 1645 pme_dev->dev = dev;
1644 mutex_lock(&pci_pme_list_mutex); 1646 mutex_lock(&pci_pme_list_mutex);
1645 list_add(&pme_dev->list, &pci_pme_list); 1647 list_add(&pme_dev->list, &pci_pme_list);
@@ -1660,7 +1662,6 @@ void pci_pme_active(struct pci_dev *dev, bool enable)
1660 } 1662 }
1661 } 1663 }
1662 1664
1663out:
1664 dev_dbg(&dev->dev, "PME# %s\n", enable ? "enabled" : "disabled"); 1665 dev_dbg(&dev->dev, "PME# %s\n", enable ? "enabled" : "disabled");
1665} 1666}
1666 1667