mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-12-05 18:29:47 -05:00
vfio: use match_string() helper
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]>
This commit is contained in:
parent
6a62c1dfb5
commit
e77addf018
1 changed files with 3 additions and 8 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue