Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28581
b: refs/heads/master
c: 9f125d3
h: refs/heads/master
i:
  28579: 19c6c41
v: v3
  • Loading branch information
Arjan van de Ven authored and Greg Kroah-Hartman committed Jun 21, 2006
1 parent 3cb9ddf commit e932dd0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 75acfecaa031c0e1bc412cee4fe58ba49ff3406c
refs/heads/master: 9f125d30487cea72542a84b4835c037163c7f3d5
21 changes: 21 additions & 0 deletions trunk/drivers/pci/pci-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pci_config_attr(subsystem_vendor, "0x%04x\n");
pci_config_attr(subsystem_device, "0x%04x\n");
pci_config_attr(class, "0x%06x\n");
pci_config_attr(irq, "%u\n");
pci_config_attr(is_enabled, "%u\n");

static ssize_t local_cpus_show(struct device *dev,
struct device_attribute *attr, char *buf)
Expand Down Expand Up @@ -90,6 +91,25 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
(u8)(pci_dev->class >> 16), (u8)(pci_dev->class >> 8),
(u8)(pci_dev->class));
}
static ssize_t
is_enabled_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct pci_dev *pdev = to_pci_dev(dev);

/* this can crash the machine when done on the "wrong" device */
if (!capable(CAP_SYS_ADMIN))
return count;

if (*buf == '0')
pci_disable_device(pdev);

if (*buf == '1')
pci_enable_device(pdev);

return count;
}


struct device_attribute pci_dev_attrs[] = {
__ATTR_RO(resource),
Expand All @@ -101,6 +121,7 @@ struct device_attribute pci_dev_attrs[] = {
__ATTR_RO(irq),
__ATTR_RO(local_cpus),
__ATTR_RO(modalias),
__ATTR(enable, 0600, is_enabled_show, is_enabled_store),
__ATTR_NULL,
};

Expand Down

0 comments on commit e932dd0

Please sign in to comment.