Merge branch 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspe...
[pandora-kernel.git] / drivers / pci / pci-sysfs.c
index ad44557..c9957f6 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/stat.h>
 #include <linux/topology.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/capability.h>
 #include <linux/pci-aspm.h>
 #include <linux/slab.h>
@@ -367,7 +368,7 @@ pci_read_config(struct file *filp, struct kobject *kobj,
        u8 *data = (u8*) buf;
 
        /* Several chips lock up trying to read undefined config space */
-       if (capable(CAP_SYS_ADMIN)) {
+       if (cap_raised(filp->f_cred->cap_effective, CAP_SYS_ADMIN)) {
                size = dev->cfg_size;
        } else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) {
                size = 128;
@@ -978,7 +979,12 @@ static ssize_t reset_store(struct device *dev,
 
        if (val != 1)
                return -EINVAL;
-       return pci_reset_function(pdev);
+
+       result = pci_reset_function(pdev);
+       if (result < 0)
+               return result;
+
+       return count;
 }
 
 static struct device_attribute reset_attr = __ATTR(reset, 0200, NULL, reset_store);