From patchwork Wed Dec 9 20:36:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11962521 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61F96C4167B for ; Wed, 9 Dec 2020 20:40:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 32D6C23D1F for ; Wed, 9 Dec 2020 20:40:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729590AbgLIUja (ORCPT ); Wed, 9 Dec 2020 15:39:30 -0500 Received: from mga14.intel.com ([192.55.52.115]:65313 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729166AbgLIUii (ORCPT ); Wed, 9 Dec 2020 15:38:38 -0500 IronPort-SDR: CRglw6bTGdeN0gWBdzXTT1e7Dj8f31Gl1OAILmZLs3igTEpl5uMTEQIGkk63/0OorQuX4IwCBU 3psgGAtY7Ywg== X-IronPort-AV: E=McAfee;i="6000,8403,9830"; a="173383933" X-IronPort-AV: E=Sophos;i="5.78,405,1599548400"; d="scan'208";a="173383933" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Dec 2020 12:36:46 -0800 IronPort-SDR: QT5G4J1IVZQEbh0tSDySV+/0rHVoWLWjDEJxGQq4njrDU8zPIqnzpgMQX66IVCYTCzZfME+nZO 7bxhnC+1TXUA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,405,1599548400"; d="scan'208";a="408217591" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga001.jf.intel.com with ESMTP; 09 Dec 2020 12:36:44 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 89D5614B; Wed, 9 Dec 2020 22:36:43 +0200 (EET) From: Andy Shevchenko To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Alex Williamson , Cornelia Huck , kvm@vger.kernel.org, Eric Auger Subject: [PATCH v2 2/5] vfio: platform: Switch to use platform_get_mem_or_io() Date: Wed, 9 Dec 2020 22:36:39 +0200 Message-Id: <20201209203642.27648-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201209203642.27648-1-andriy.shevchenko@linux.intel.com> References: <20201209203642.27648-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Switch to use new platform_get_mem_or_io() instead of home grown analogue. Cc: Alex Williamson Cc: Cornelia Huck Cc: kvm@vger.kernel.org Signed-off-by: Andy Shevchenko Acked-by: Eric Auger --- v2: added tag (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..9fb6818cea12 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(dev, num); } static int get_platform_irq(struct vfio_platform_device *vdev, int i)