Merge branch 'for-3.19' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
[cascardo/linux.git] / drivers / pci / pci-sysfs.c
index 2c6643f..a62acc4 100644 (file)
@@ -221,12 +221,37 @@ static ssize_t enable_show(struct device *dev, struct device_attribute *attr,
 static DEVICE_ATTR_RW(enable);
 
 #ifdef CONFIG_NUMA
+static ssize_t numa_node_store(struct device *dev,
+                              struct device_attribute *attr, const char *buf,
+                              size_t count)
+{
+       struct pci_dev *pdev = to_pci_dev(dev);
+       int node, ret;
+
+       if (!capable(CAP_SYS_ADMIN))
+               return -EPERM;
+
+       ret = kstrtoint(buf, 0, &node);
+       if (ret)
+               return ret;
+
+       if (!node_online(node))
+               return -EINVAL;
+
+       add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
+       dev_alert(&pdev->dev, FW_BUG "Overriding NUMA node to %d.  Contact your vendor for updates.",
+                 node);
+
+       dev->numa_node = node;
+       return count;
+}
+
 static ssize_t numa_node_show(struct device *dev, struct device_attribute *attr,
                              char *buf)
 {
        return sprintf(buf, "%d\n", dev->numa_node);
 }
-static DEVICE_ATTR_RO(numa_node);
+static DEVICE_ATTR_RW(numa_node);
 #endif
 
 static ssize_t dma_mask_bits_show(struct device *dev,
@@ -385,7 +410,7 @@ static ssize_t dev_bus_rescan_store(struct device *dev,
 }
 static DEVICE_ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_bus_rescan_store);
 
-#if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
+#if defined(CONFIG_PM) && defined(CONFIG_ACPI)
 static ssize_t d3cold_allowed_store(struct device *dev,
                                    struct device_attribute *attr,
                                    const char *buf, size_t count)
@@ -566,7 +591,7 @@ static struct attribute *pci_dev_attrs[] = {
        &dev_attr_enable.attr,
        &dev_attr_broken_parity_status.attr,
        &dev_attr_msi_bus.attr,
-#if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
+#if defined(CONFIG_PM) && defined(CONFIG_ACPI)
        &dev_attr_d3cold_allowed.attr,
 #endif
 #ifdef CONFIG_OF