Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 36061
b: refs/heads/master
c: fe97064
h: refs/heads/master
i:
  36059: 19afc89
v: v3
  • Loading branch information
Brice Goglin authored and Greg Kroah-Hartman committed Sep 27, 2006
1 parent 94bc4d5 commit 8f176ac
Show file tree
Hide file tree
Showing 2 changed files with 42 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: 24334a12533e9ac70dcb467ccd629f190afc5361
refs/heads/master: fe97064c2870e174a6ff4a93feb11a70c4b71cc5
41 changes: 41 additions & 0 deletions trunk/drivers/pci/pci-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,46 @@ is_enabled_store(struct device *dev, struct device_attribute *attr,
return count;
}

static ssize_t
msi_bus_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct pci_dev *pdev = to_pci_dev(dev);

if (!pdev->subordinate)
return 0;

return sprintf (buf, "%u\n",
!(pdev->subordinate->bus_flags & PCI_BUS_FLAGS_NO_MSI));
}

static ssize_t
msi_bus_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct pci_dev *pdev = to_pci_dev(dev);

/* bad things may happen if the no_msi flag is changed
* while some drivers are loaded */
if (!capable(CAP_SYS_ADMIN))
return count;

if (!pdev->subordinate)
return count;

if (*buf == '0') {
pdev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
dev_warn(&pdev->dev, "forced subordinate bus to not support MSI,"
" bad things could happen.\n");
}

if (*buf == '1') {
pdev->subordinate->bus_flags &= ~PCI_BUS_FLAGS_NO_MSI;
dev_warn(&pdev->dev, "forced subordinate bus to support MSI,"
" bad things could happen.\n");
}

return count;
}

struct device_attribute pci_dev_attrs[] = {
__ATTR_RO(resource),
Expand All @@ -145,6 +185,7 @@ struct device_attribute pci_dev_attrs[] = {
__ATTR(enable, 0600, is_enabled_show, is_enabled_store),
__ATTR(broken_parity_status,(S_IRUGO|S_IWUSR),
broken_parity_status_show,broken_parity_status_store),
__ATTR(msi_bus, 0644, msi_bus_show, msi_bus_store),
__ATTR_NULL,
};

Expand Down

0 comments on commit 8f176ac

Please sign in to comment.