Commit e4585da2 authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman

pci syscall.c: Switch to refcounting API

Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a23adb5b
...@@ -23,14 +23,14 @@ sys_pciconfig_read(unsigned long bus, unsigned long dfn, ...@@ -23,14 +23,14 @@ sys_pciconfig_read(unsigned long bus, unsigned long dfn,
u8 byte; u8 byte;
u16 word; u16 word;
u32 dword; u32 dword;
long err, cfg_ret; long err;
long cfg_ret;
err = -EPERM;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
goto error; return -EPERM;
err = -ENODEV; err = -ENODEV;
dev = pci_find_slot(bus, dfn); dev = pci_get_bus_and_slot(bus, dfn);
if (!dev) if (!dev)
goto error; goto error;
...@@ -66,7 +66,8 @@ sys_pciconfig_read(unsigned long bus, unsigned long dfn, ...@@ -66,7 +66,8 @@ sys_pciconfig_read(unsigned long bus, unsigned long dfn,
case 4: case 4:
err = put_user(dword, (unsigned int __user *)buf); err = put_user(dword, (unsigned int __user *)buf);
break; break;
}; }
pci_dev_put(dev);
return err; return err;
error: error:
...@@ -83,7 +84,8 @@ sys_pciconfig_read(unsigned long bus, unsigned long dfn, ...@@ -83,7 +84,8 @@ sys_pciconfig_read(unsigned long bus, unsigned long dfn,
case 4: case 4:
put_user(-1, (unsigned int __user *)buf); put_user(-1, (unsigned int __user *)buf);
break; break;
}; }
pci_dev_put(dev);
return err; return err;
} }
...@@ -101,7 +103,7 @@ sys_pciconfig_write(unsigned long bus, unsigned long dfn, ...@@ -101,7 +103,7 @@ sys_pciconfig_write(unsigned long bus, unsigned long dfn,
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
dev = pci_find_slot(bus, dfn); dev = pci_get_bus_and_slot(bus, dfn);
if (!dev) if (!dev)
return -ENODEV; return -ENODEV;
...@@ -137,8 +139,8 @@ sys_pciconfig_write(unsigned long bus, unsigned long dfn, ...@@ -137,8 +139,8 @@ sys_pciconfig_write(unsigned long bus, unsigned long dfn,
default: default:
err = -EINVAL; err = -EINVAL;
break; break;
}; }
unlock_kernel(); unlock_kernel();
pci_dev_put(dev);
return err; return err;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment