diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2009-07-27 16:37:48 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-09-09 16:29:24 -0400 |
commit | 711d57796f5ce2d02d6e62c9034afbb16aedda31 (patch) | |
tree | 935861fee775b171cafc96de57fe4fbfa19892eb /drivers/pci/pci.c | |
parent | 5228a828ee044834d78abdf25306bf46b19dcc4d (diff) |
PCI: expose function reset capability in sysfs
Some devices allow an individual function to be reset without affecting
other functions in the same device: that's what pci_reset_function does.
For devices that have this support, expose reset attribite in sysfs.
This is useful e.g. for virtualization, where a qemu userspace
process wants to reset the device when the guest is reset,
to emulate machine reboot as closely as possible.
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r-- | drivers/pci/pci.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 7b70312181d7..7d55039ffa05 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -2262,6 +2262,22 @@ int __pci_reset_function(struct pci_dev *dev) | |||
2262 | EXPORT_SYMBOL_GPL(__pci_reset_function); | 2262 | EXPORT_SYMBOL_GPL(__pci_reset_function); |
2263 | 2263 | ||
2264 | /** | 2264 | /** |
2265 | * pci_probe_reset_function - check whether the device can be safely reset | ||
2266 | * @dev: PCI device to reset | ||
2267 | * | ||
2268 | * Some devices allow an individual function to be reset without affecting | ||
2269 | * other functions in the same device. The PCI device must be responsive | ||
2270 | * to PCI config space in order to use this function. | ||
2271 | * | ||
2272 | * Returns 0 if the device function can be reset or negative if the | ||
2273 | * device doesn't support resetting a single function. | ||
2274 | */ | ||
2275 | int pci_probe_reset_function(struct pci_dev *dev) | ||
2276 | { | ||
2277 | return pci_dev_reset(dev, 1); | ||
2278 | } | ||
2279 | |||
2280 | /** | ||
2265 | * pci_reset_function - quiesce and reset a PCI device function | 2281 | * pci_reset_function - quiesce and reset a PCI device function |
2266 | * @dev: PCI device to reset | 2282 | * @dev: PCI device to reset |
2267 | * | 2283 | * |