kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Eric Auger <eric.auger@redhat.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Cornelia Huck <cohuck@redhat.com>,
	kvm@vger.kernel.org
Subject: [PATCH v1 2/5] vfio: platform: Switch to use platform_get_mem_or_io_resource()
Date: Tue, 27 Oct 2020 19:58:03 +0200	[thread overview]
Message-ID: <20201027175806.20305-2-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20201027175806.20305-1-andriy.shevchenko@linux.intel.com>

Switch to use new platform_get_mem_or_io_resource() instead of
home grown analogue.

Cc: Eric Auger <eric.auger@redhat.com>
Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: Cornelia Huck <cohuck@redhat.com>
Cc: kvm@vger.kernel.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/vfio/platform/vfio_platform.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/vfio/platform/vfio_platform.c b/drivers/vfio/platform/vfio_platform.c
index 1e2769010089..84afafb6941b 100644
--- a/drivers/vfio/platform/vfio_platform.c
+++ b/drivers/vfio/platform/vfio_platform.c
@@ -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_resource(dev, num);
 }
 
 static int get_platform_irq(struct vfio_platform_device *vdev, int i)
-- 
2.28.0


  reply	other threads:[~2020-10-27 17:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27 17:58 [PATCH v1 1/5] driver core: platform: Introduce platform_get_mem_or_io_resource() Andy Shevchenko
2020-10-27 17:58 ` Andy Shevchenko [this message]
2020-12-03 12:54   ` [PATCH v1 2/5] vfio: platform: Switch to use platform_get_mem_or_io_resource() Auger Eric
2020-12-03 13:07     ` Andy Shevchenko
2020-12-09 14:47       ` Greg Kroah-Hartman
2020-12-09 16:48         ` Andy Shevchenko
2020-12-09 16:53           ` Greg Kroah-Hartman
2020-12-09 18:22             ` Andy Shevchenko
2020-12-03 13:22   ` Cornelia Huck
2020-12-03 18:05   ` Alex Williamson
2020-12-03 13:21 ` [PATCH v1 1/5] driver core: platform: Introduce platform_get_mem_or_io_resource() Cornelia Huck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201027175806.20305-2-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).