diff mbox series

[v1,2/5] vfio: platform: Switch to use platform_get_mem_or_io_resource()

Message ID 20201027175806.20305-2-andriy.shevchenko@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [v1,1/5] driver core: platform: Introduce platform_get_mem_or_io_resource() | expand

Commit Message

Andy Shevchenko Oct. 27, 2020, 5:58 p.m. UTC
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(-)

Comments

Eric Auger Dec. 3, 2020, 12:54 p.m. UTC | #1
Hi Andy,

On 10/27/20 6:58 PM, Andy Shevchenko wrote:
> 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>
Acked-by: Eric Auger <eric.auger@redhat.com>

Thanks

Eric
> ---
>  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)
>
Andy Shevchenko Dec. 3, 2020, 1:07 p.m. UTC | #2
On Thu, Dec 03, 2020 at 01:54:38PM +0100, Auger Eric wrote:
> Hi Andy,
> 
> On 10/27/20 6:58 PM, Andy Shevchenko wrote:
> > 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>
> Acked-by: Eric Auger <eric.auger@redhat.com>

Thanks!

Greg, do I need to do anything else with this series?
Cornelia Huck Dec. 3, 2020, 1:22 p.m. UTC | #3
On Tue, 27 Oct 2020 19:58:03 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> 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(-)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Alex Williamson Dec. 3, 2020, 6:05 p.m. UTC | #4
On Tue, 27 Oct 2020 19:58:03 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> 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(-)

Acked-by: Alex Williamson <alex.williamson@redhat.com>
Greg KH Dec. 9, 2020, 2:47 p.m. UTC | #5
On Thu, Dec 03, 2020 at 03:07:19PM +0200, Andy Shevchenko wrote:
> On Thu, Dec 03, 2020 at 01:54:38PM +0100, Auger Eric wrote:
> > Hi Andy,
> > 
> > On 10/27/20 6:58 PM, Andy Shevchenko wrote:
> > > 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>
> > Acked-by: Eric Auger <eric.auger@redhat.com>
> 
> Thanks!
> 
> Greg, do I need to do anything else with this series?

Have them taken by the vfio maintainers?  I'm not that person :)
Andy Shevchenko Dec. 9, 2020, 4:48 p.m. UTC | #6
On Wed, Dec 09, 2020 at 03:47:06PM +0100, Greg Kroah-Hartman wrote:
> On Thu, Dec 03, 2020 at 03:07:19PM +0200, Andy Shevchenko wrote:
> > On Thu, Dec 03, 2020 at 01:54:38PM +0100, Auger Eric wrote:
> > > On 10/27/20 6:58 PM, Andy Shevchenko wrote:
> > > > 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>
> > > Acked-by: Eric Auger <eric.auger@redhat.com>
> > 
> > Thanks!
> > 
> > Greg, do I need to do anything else with this series?
> 
> Have them taken by the vfio maintainers?  I'm not that person :)

But it can't be done with a first patch that provides a new API.
The rest seems under your realm, if I didn't miss anything.
Btw, VFIO agreed on the change (as per given tags).
Greg KH Dec. 9, 2020, 4:53 p.m. UTC | #7
On Wed, Dec 09, 2020 at 06:48:16PM +0200, Andy Shevchenko wrote:
> On Wed, Dec 09, 2020 at 03:47:06PM +0100, Greg Kroah-Hartman wrote:
> > On Thu, Dec 03, 2020 at 03:07:19PM +0200, Andy Shevchenko wrote:
> > > On Thu, Dec 03, 2020 at 01:54:38PM +0100, Auger Eric wrote:
> > > > On 10/27/20 6:58 PM, Andy Shevchenko wrote:
> > > > > 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>
> > > > Acked-by: Eric Auger <eric.auger@redhat.com>
> > > 
> > > Thanks!
> > > 
> > > Greg, do I need to do anything else with this series?
> > 
> > Have them taken by the vfio maintainers?  I'm not that person :)
> 
> But it can't be done with a first patch that provides a new API.
> The rest seems under your realm, if I didn't miss anything.
> Btw, VFIO agreed on the change (as per given tags).

Ok, can you resend all of these, with the vfio tags added, so I know to
take them all?

thanks,

greg k-h
Andy Shevchenko Dec. 9, 2020, 6:22 p.m. UTC | #8
On Wed, Dec 09, 2020 at 05:53:45PM +0100, Greg Kroah-Hartman wrote:
> On Wed, Dec 09, 2020 at 06:48:16PM +0200, Andy Shevchenko wrote:
> > On Wed, Dec 09, 2020 at 03:47:06PM +0100, Greg Kroah-Hartman wrote:
> > > On Thu, Dec 03, 2020 at 03:07:19PM +0200, Andy Shevchenko wrote:
> > > > On Thu, Dec 03, 2020 at 01:54:38PM +0100, Auger Eric wrote:

...

> > > > Greg, do I need to do anything else with this series?

> > > Have them taken by the vfio maintainers?  I'm not that person :)

> > But it can't be done with a first patch that provides a new API.
> > The rest seems under your realm, if I didn't miss anything.
> > Btw, VFIO agreed on the change (as per given tags).

> Ok, can you resend all of these, with the vfio tags added, so I know to
> take them all?

Sure. Will do soon.
diff mbox series

Patch

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)