projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6a62c1d
)
vfio: use match_string() helper
author
Yisheng Xie
<
[email protected]
>
Mon, 21 May 2018 11:57:45 +0000
(19:57 +0800)
committer
Alex Williamson
<
[email protected]
>
Fri, 8 Jun 2018 16:24:33 +0000
(10:24 -0600)
match_string() returns the index of an array for a matching string,
which can be used intead of open coded variant.
Cc: Alex Williamson <
[email protected]
>
Cc:
[email protected]
Signed-off-by: Yisheng Xie <
[email protected]
>
Reviewed-by: Andy Shevchenko <
[email protected]
>
Signed-off-by: Alex Williamson <
[email protected]
>
drivers/vfio/vfio.c
patch
|
blob
|
history
diff --git
a/drivers/vfio/vfio.c
b/drivers/vfio/vfio.c
index 721f97f8dac1f2c979e846dcd89aa6878e195b59..64833879f75d3cf2d0739f03e4ca4b587c639cca 100644
(file)
--- a/
drivers/vfio/vfio.c
+++ b/
drivers/vfio/vfio.c
@@
-630,8
+630,6
@@
static const char * const vfio_driver_whitelist[] = { "pci-stub" };
static bool vfio_dev_whitelisted(struct device *dev, struct device_driver *drv)
{
- int i;
-
if (dev_is_pci(dev)) {
struct pci_dev *pdev = to_pci_dev(dev);
@@
-639,12
+637,9
@@
static bool vfio_dev_whitelisted(struct device *dev, struct device_driver *drv)
return true;
}
- for (i = 0; i < ARRAY_SIZE(vfio_driver_whitelist); i++) {
- if (!strcmp(drv->name, vfio_driver_whitelist[i]))
- return true;
- }
-
- return false;
+ return match_string(vfio_driver_whitelist,
+ ARRAY_SIZE(vfio_driver_whitelist),
+ drv->name) >= 0;
}
/*