* [PATCH v1] vfio: platform: use platform_get_resource()
@ 2020-08-04 13:56 Andy Shevchenko
2020-08-05 11:06 ` Cornelia Huck
0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2020-08-04 13:56 UTC (permalink / raw)
To: Eric Auger, Alex Williamson, kvm, Cornelia Huck; +Cc: Andy Shevchenko
Use platform_get_resource() to fetch the memory resource
instead of open-coded variant.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/vfio/platform/vfio_platform.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/vfio/platform/vfio_platform.c b/drivers/vfio/platform/vfio_platform.c
index 1e2769010089..d216126a31c4 100644
--- a/drivers/vfio/platform/vfio_platform.c
+++ b/drivers/vfio/platform/vfio_platform.c
@@ -25,19 +25,13 @@ static struct resource *get_platform_resource(struct vfio_platform_device *vdev,
int num)
{
struct platform_device *dev = (struct platform_device *) vdev->opaque;
- int i;
+ struct resource *res;
- for (i = 0; i < dev->num_resources; i++) {
- struct resource *r = &dev->resource[i];
+ res = platform_get_resource(dev, IORESOURCE_MEM, num);
+ if (res)
+ return res;
- if (resource_type(r) & (IORESOURCE_MEM|IORESOURCE_IO)) {
- if (!num)
- return r;
-
- num--;
- }
- }
- return NULL;
+ return platform_get_resource(dev, IORESOURCE_IO, num);
}
static int get_platform_irq(struct vfio_platform_device *vdev, int i)
--
2.27.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1] vfio: platform: use platform_get_resource()
2020-08-04 13:56 [PATCH v1] vfio: platform: use platform_get_resource() Andy Shevchenko
@ 2020-08-05 11:06 ` Cornelia Huck
2020-08-05 11:57 ` Andy Shevchenko
0 siblings, 1 reply; 4+ messages in thread
From: Cornelia Huck @ 2020-08-05 11:06 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Eric Auger, Alex Williamson, kvm
On Tue, 4 Aug 2020 16:56:22 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> Use platform_get_resource() to fetch the memory resource
> instead of open-coded variant.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/vfio/platform/vfio_platform.c | 16 +++++-----------
> 1 file changed, 5 insertions(+), 11 deletions(-)
>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] vfio: platform: use platform_get_resource()
2020-08-05 11:06 ` Cornelia Huck
@ 2020-08-05 11:57 ` Andy Shevchenko
2020-12-03 12:38 ` Andy Shevchenko
0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2020-08-05 11:57 UTC (permalink / raw)
To: Cornelia Huck; +Cc: Eric Auger, Alex Williamson, kvm
On Wed, Aug 05, 2020 at 01:06:35PM +0200, Cornelia Huck wrote:
> On Tue, 4 Aug 2020 16:56:22 +0300
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
>
> > Use platform_get_resource() to fetch the memory resource
> > instead of open-coded variant.
> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Thanks! I have better approach now, please, postpone this one.
I'll send it after v5.9-rc1.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] vfio: platform: use platform_get_resource()
2020-08-05 11:57 ` Andy Shevchenko
@ 2020-12-03 12:38 ` Andy Shevchenko
0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2020-12-03 12:38 UTC (permalink / raw)
To: Cornelia Huck; +Cc: Eric Auger, Alex Williamson, kvm
On Wed, Aug 05, 2020 at 02:57:59PM +0300, Andy Shevchenko wrote:
> On Wed, Aug 05, 2020 at 01:06:35PM +0200, Cornelia Huck wrote:
> > On Tue, 4 Aug 2020 16:56:22 +0300
> > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> >
> > > Use platform_get_resource() to fetch the memory resource
> > > instead of open-coded variant.
>
> > Reviewed-by: Cornelia Huck <cohuck@redhat.com>
>
> Thanks! I have better approach now, please, postpone this one.
> I'll send it after v5.9-rc1.
FYI: It's part of the series [1].
[1]: https://lore.kernel.org/lkml/20201028162727.GX4077@smile.fi.intel.com/T/
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-12-03 12:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-04 13:56 [PATCH v1] vfio: platform: use platform_get_resource() Andy Shevchenko
2020-08-05 11:06 ` Cornelia Huck
2020-08-05 11:57 ` Andy Shevchenko
2020-12-03 12:38 ` Andy Shevchenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.