vfio: platform: Switch to use platform_get_mem_or_io()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 9 Dec 2020 20:36:39 +0000 (22:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Dec 2020 15:31:46 +0000 (16:31 +0100)
Switch to use new platform_get_mem_or_io() instead of home grown analogue.

Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: Cornelia Huck <cohuck@redhat.com>
Cc: kvm@vger.kernel.org
Acked-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20201209203642.27648-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/vfio/platform/vfio_platform.c

index 1e27690..9fb6818 100644 (file)
@@ -25,19 +25,8 @@ static struct resource *get_platform_resource(struct vfio_platform_device *vdev,
                                              int num)
 {
        struct platform_device *dev = (struct platform_device *) vdev->opaque;
-       int i;
 
-       for (i = 0; i < dev->num_resources; i++) {
-               struct resource *r = &dev->resource[i];
-
-               if (resource_type(r) & (IORESOURCE_MEM|IORESOURCE_IO)) {
-                       if (!num)
-                               return r;
-
-                       num--;
-               }
-       }
-       return NULL;
+       return platform_get_mem_or_io(dev, num);
 }
 
 static int get_platform_irq(struct vfio_platform_device *vdev, int i)