Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp559486pxx; Wed, 28 Oct 2020 11:05:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9Z3exH5aEEONT50xV5GqzFIULzmtTa//xnsWBSQ97sTjNTMWJpbP7g/rySGF+CieBSqNo X-Received: by 2002:a17:906:1c50:: with SMTP id l16mr312908ejg.144.1603908313628; Wed, 28 Oct 2020 11:05:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603908313; cv=none; d=google.com; s=arc-20160816; b=vceD+duOU/c+B7O4LxEC2cMyGnddRQv87vE8ANxhBaX4wvokpB7ia2m3BgHMgkuGPr Wwrqf80gUd3LuSNvIcd1XMb6GAvupexOmc4S4ze2bzLkD70Te+kwzOZMpQewYbI8ty8t UQ3wC2Y6Mc8GFQL12GWJ0gQ7SK8GZToGrb6gnlivHv1coF1CmOpENu6skeCOLVCvBAAi gj/Cpr3Wj6xhbXp5fe5q1nnuZpRQi8RYgbgN6hZrdzCXjoe2gzRy9uFWpI64rXFHKzct 1I+1D++l2XGGshJFsGsyJnpNMbvFWZppvG3e9e2iv9f+9J8EXq7/gjd1ibhCpNGczgwR E0Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=BZ3sJbJsIiPfo8+b21bow/H6hROMz8upDh/HDt9rR4g=; b=OjUH0j4ooePRznYSDXPeLzpnFVMeqhx+PVi4881b/yqKZPLFteDOIErd3sUZXRTT6M IS5/Elslp1d3Tn2D6+x//s4uT+LSnlMqzv13mnkB1+fzO9rC6sTMR8xXxdr8lN38XqHc p2EBlhfmy0w4cYZ/S9j74fR4rlPVMmLEF8IeAN8xSfkXdNUdR32TC9gEvEfGevrF4D72 li5QN7o5pkYS/Wb32I+39dd8qzLpTvEP3ZnAzU+ig8SBDMLUueUHf8hpcCXeEOM/N0/E JJXigNV2XU6x+3CCqeXriFSfgoQQWy0/w2Fh0/CFsbL1H9rYgIkfuXfVXaijo7VVIQ6T oHdw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h13si2268edr.541.2020.10.28.11.04.51; Wed, 28 Oct 2020 11:05:13 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1823636AbgJ0R7H (ORCPT + 99 others); Tue, 27 Oct 2020 13:59:07 -0400 Received: from mga18.intel.com ([134.134.136.126]:41011 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1823232AbgJ0R60 (ORCPT ); Tue, 27 Oct 2020 13:58:26 -0400 IronPort-SDR: tv2AXyGcjbo/W0fJDYrKQ7Lr7vZE3BmcLCFCroxm09vtSWEnjU4SThl4cmeHo09jtWN4l16te1 JhvbcIJfzCxA== X-IronPort-AV: E=McAfee;i="6000,8403,9787"; a="155910868" X-IronPort-AV: E=Sophos;i="5.77,424,1596524400"; d="scan'208";a="155910868" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2020 10:58:09 -0700 IronPort-SDR: FVTLGKaPm2nU8nQKKMMyNr0H3IvtVTsE/+UA5+5KS0SCJgBb4qe1dEnGuDqICwUTjJ1SuENcSU Nm6bSf3gOqzw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,424,1596524400"; d="scan'208";a="323036172" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 27 Oct 2020 10:58:07 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 00436178; Tue, 27 Oct 2020 19:58:06 +0200 (EET) From: Andy Shevchenko To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Eric Auger , Alex Williamson , Cornelia Huck , 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 Message-Id: <20201027175806.20305-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201027175806.20305-1-andriy.shevchenko@linux.intel.com> References: <20201027175806.20305-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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