Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp462789pxu; Thu, 3 Dec 2020 04:59:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJnY/EjUPWglyFHo/U7e0P5dpMfnCe8hcPc3KegAZ9h+7QQBctDsYY9/cttYBqQtf0PWmQ X-Received: by 2002:a50:8a8b:: with SMTP id j11mr2815196edj.19.1607000349569; Thu, 03 Dec 2020 04:59:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607000349; cv=none; d=google.com; s=arc-20160816; b=WVvkd/eOUXtd/pulU2IIoU4t9qkKyRWU60sdEzMYuygRVhRX2V8/FajdtL6RZwvXuj RsTGdFH3TItQC6G399m5vb1wiBmKhDHenAfJFgDzq60W3UqoVojX6ykZZ/H1tzMO2NHA 8cgNHsmeRzQ/2MI9TZDERptbc6wIMG96O5HSyr2qFaxn39EwCXwEE9cIM/v70I0TJSQV 13Ui0nuiHqfneK9XA2eLKczYNPO7ermbuSFdoBd6X7Ns6XGrBRlYFUye/3I2hncDuMXn J6YyLFyZd4/WMC6zc6wlaZpdP31atjz+8TQoHRBrUywpg1PdgKjxyvTskSGjtsVqLcR9 L5mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=JQ5li8kW8vouw7a1BEvL2lAOLaEbq6lyvNfsM0+NZP8=; b=y67IKrj2UNvo3Z1Pxy47BpD0yTfm5XZINx3vdO+eebRvM7oDMTXkkrAkQNGj/4lpcG d4b01mQasgRPAoSwS0D19cL2vHoKGCH+BkbR/bOlQUV0MEzLez5QSG6vruMof/iomNmc nZ0aHYdn0zKH3Jl7hBBZQGeYWc7w+xndYfBx01MhcfiBCt+Umcw1GUSBSECp8hkFma7S 36k7rBq6c1AnyzG0PL9a6Fe9Ce/sX2dftOif/qQGOT9q9vwXpr1oxV67gpMrW7eeC58/ 4osoyQQ7cD7Ho4u8HMBqHpaWoAJFhnu94gUlgMjCt3FELwbdLSKrX8JfxMK4strVL0h6 hMPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ivis+vVl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb20si1092303ejc.685.2020.12.03.04.58.46; Thu, 03 Dec 2020 04:59:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ivis+vVl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730517AbgLCM4O (ORCPT + 99 others); Thu, 3 Dec 2020 07:56:14 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:48018 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730503AbgLCM4O (ORCPT ); Thu, 3 Dec 2020 07:56:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607000087; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JQ5li8kW8vouw7a1BEvL2lAOLaEbq6lyvNfsM0+NZP8=; b=Ivis+vVlQTzNc4XiWTut0KHCdHChTsVec3PzY7RndG53evPESBkNUxxepzoGmjsOj7jTjo 3z2TeY17rs+F6G6fZ483b1cqdEO5p3QZwVjejy4QlMShUlDea7R1FxwSmKwFeZAemKn/Ip rTaZkonM3T6fIokW/eqznon+s6Q0A2Q= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-392-NzWvwRlEO_ae3PfSfHTaAg-1; Thu, 03 Dec 2020 07:54:46 -0500 X-MC-Unique: NzWvwRlEO_ae3PfSfHTaAg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 05371800050; Thu, 3 Dec 2020 12:54:45 +0000 (UTC) Received: from [10.36.112.89] (ovpn-112-89.ams2.redhat.com [10.36.112.89]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4F94410016F4; Thu, 3 Dec 2020 12:54:40 +0000 (UTC) Subject: Re: [PATCH v1 2/5] vfio: platform: Switch to use platform_get_mem_or_io_resource() To: Andy Shevchenko , Greg Kroah-Hartman , linux-kernel@vger.kernel.org Cc: Alex Williamson , Cornelia Huck , kvm@vger.kernel.org References: <20201027175806.20305-1-andriy.shevchenko@linux.intel.com> <20201027175806.20305-2-andriy.shevchenko@linux.intel.com> From: Auger Eric Message-ID: Date: Thu, 3 Dec 2020 13:54:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20201027175806.20305-2-andriy.shevchenko@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Cc: Alex Williamson > Cc: Cornelia Huck > Cc: kvm@vger.kernel.org > Signed-off-by: Andy Shevchenko Acked-by: Eric Auger 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) >