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.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 86c63fe45d11..6869009c7393 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -28,6 +28,7 @@
28#include <linux/pci-aspm.h> 28#include <linux/pci-aspm.h>
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 "pci.h" 32#include "pci.h"
32 33
33static int sysfs_initialized; /* = 0 */ 34static int sysfs_initialized; /* = 0 */
@@ -378,6 +379,31 @@ dev_bus_rescan_store(struct device *dev, struct device_attribute *attr,
378 379
379#endif 380#endif
380 381
382#if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
383static ssize_t d3cold_allowed_store(struct device *dev,
384 struct device_attribute *attr,
385 const char *buf, size_t count)
386{
387 struct pci_dev *pdev = to_pci_dev(dev);
388 unsigned long val;
389
390 if (strict_strtoul(buf, 0, &val) < 0)
391 return -EINVAL;
392
393 pdev->d3cold_allowed = !!val;
394 pm_runtime_resume(dev);
395
396 return count;
397}
398
399static ssize_t d3cold_allowed_show(struct device *dev,
400 struct device_attribute *attr, char *buf)
401{
402 struct pci_dev *pdev = to_pci_dev(dev);
403 return sprintf (buf, "%u\n", pdev->d3cold_allowed);
404}
405#endif
406
381struct device_attribute pci_dev_attrs[] = { 407struct device_attribute pci_dev_attrs[] = {
382 __ATTR_RO(resource), 408 __ATTR_RO(resource),
383 __ATTR_RO(vendor), 409 __ATTR_RO(vendor),
@@ -402,6 +428,9 @@ struct device_attribute pci_dev_attrs[] = {
402 __ATTR(remove, (S_IWUSR|S_IWGRP), NULL, remove_store), 428 __ATTR(remove, (S_IWUSR|S_IWGRP), NULL, remove_store),
403 __ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_rescan_store), 429 __ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_rescan_store),
404#endif 430#endif
431#if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
432 __ATTR(d3cold_allowed, 0644, d3cold_allowed_show, d3cold_allowed_store),
433#endif
405 __ATTR_NULL, 434 __ATTR_NULL,
406}; 435};
407 436
@@ -1112,7 +1141,7 @@ static struct bin_attribute pcie_config_attr = {
1112 .write = pci_write_config, 1141 .write = pci_write_config,
1113}; 1142};
1114 1143
1115int __attribute__ ((weak)) pcibios_add_platform_entries(struct pci_dev *dev) 1144int __weak pcibios_add_platform_entries(struct pci_dev *dev)
1116{ 1145{
1117 return 0; 1146 return 0;
1118} 1147}