Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp559379pxx; Wed, 28 Oct 2020 11:05:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOY900WxUmc8bjSu3cbXK/JyUSXRZjXZSus5u5k+NoICBmcXRWhG3jMOOY48+7bSzBonu0 X-Received: by 2002:a17:906:4816:: with SMTP id w22mr306354ejq.458.1603908306261; Wed, 28 Oct 2020 11:05:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603908306; cv=none; d=google.com; s=arc-20160816; b=uQlwocUjPIAy3pe7HOHChJTNkBYhN02ZqJETfsSYWCwxXPRm0YdGu/FWDq3WoL4lBt 838uCkmoth2LQx7YauCn8vOQOsAmF9lXIOPrctoANe3sivVr+KmXw444A2NedlT4Rwkm QlvZ8/DJetAvlbDVx29qXuae9Do9zW8OPo1+dgIrbQG6avXtmaVCZed9nf8HUYGTQ2RA idUgTquFUJzQuEKr9vkOlG9OD+lITxVpsTxOGcnVp8IdJ8G0a4QrPXPUYkQ6NnkJT6gn RMpDwC9ckoU2fHx4AKLFzZ4E2g6e3Te/phc8+DWMKpXnMhu/mIntR2D3Tqg8rrUwF6Ko T09g== 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 :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=jA38B03U2A7/j6QzN1U4a/f5a8B7MB0e63dr577vtZo=; b=Kvvg1BhbytausT0gb8BVIxBEj/dZU060ssyKqfA9fcLLQdPLRbj2MBv6twAH8ZZT/c JR7RwWRuIpWgR3WZjWV3QW/06KIXeN1KPiSTE7bmAex3CBVzsqQxFSEst1UJpMZIa4XK 1yj7EXVM+IMD7YE6hGQsIJNRq3iEK0dc/Pr3zUUX/HqaHcTIcLUM6r8PSuwHw3920piR /VRf7+NMTKL1utWBLMNqa6i53a7tNMwWj5MIPNyADRRt/ZkdQeI8qqO9iqy6YyvmGNGD APVmLPNsW82UOmicx2xbp1PfHZwlAfPEVy/V2jYTRBS6jJpEhYmy7LYrR8cz7ET5Csah tVLA== 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 y1si30775edp.57.2020.10.28.11.04.42; Wed, 28 Oct 2020 11:05:06 -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 S1823661AbgJ0R70 (ORCPT + 99 others); Tue, 27 Oct 2020 13:59:26 -0400 Received: from mga03.intel.com ([134.134.136.65]:34126 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1823203AbgJ0R6L (ORCPT ); Tue, 27 Oct 2020 13:58:11 -0400 IronPort-SDR: fW7T60hx1U28IPgMbQ/ufL/NsJsLrDr8h6qOpKkB5QSrnKFjB6eeDphAXriX73rCczz297b1SU KEzTXfMmJZLg== X-IronPort-AV: E=McAfee;i="6000,8403,9787"; a="168230686" X-IronPort-AV: E=Sophos;i="5.77,424,1596524400"; d="scan'208";a="168230686" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2020 10:58:10 -0700 IronPort-SDR: pVBI96o6WMqJ6mq5a8oXe8bATKbSaxP/VCM1wYfH+mNa36hNrOtpMcv+1HKUfbt7UIprRLPVTs BcddLyFjzpHQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,424,1596524400"; d="scan'208";a="303841822" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 27 Oct 2020 10:58:07 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id E4DE0179; 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, linux-usb@vger.kernel.org, Peng Hao , Arnd Bergmann Subject: [PATCH v1 1/5] driver core: platform: Introduce platform_get_mem_or_io_resource() Date: Tue, 27 Oct 2020 19:58:02 +0200 Message-Id: <20201027175806.20305-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are at least few existing users of the proposed API which retrieves either MEM or IO resource from platform device. Make it common to utilize in the existing and new users. Signed-off-by: Andy Shevchenko Cc: Eric Auger Cc: Alex Williamson Cc: Cornelia Huck Cc: kvm@vger.kernel.org Cc: linux-usb@vger.kernel.org Cc: Peng Hao Cc: Arnd Bergmann --- include/linux/platform_device.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 77a2aada106d..eb8d74744e29 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h @@ -52,6 +52,19 @@ extern struct device platform_bus; extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int); +static inline +struct resource *platform_get_mem_or_io_resource(struct platform_device *pdev, + unsigned int num) +{ + struct resource *res; + + res = platform_get_resource(pdev, IORESOURCE_MEM, num); + if (res) + return res; + + return platform_get_resource(pdev, IORESOURCE_IO, num); +} + extern struct device * platform_find_device_by_driver(struct device *start, const struct device_driver *drv); -- 2.28.0