Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2622735ybi; Sun, 28 Jul 2019 13:25:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqxMndLgseEGt9mmkx/iHSjhZW3VbCzjIfXATrGXzyzh/oVYAboiA6iV/cO3XQgPUPTJA0qT X-Received: by 2002:a62:6:: with SMTP id 6mr32439487pfa.159.1564345547891; Sun, 28 Jul 2019 13:25:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564345547; cv=none; d=google.com; s=arc-20160816; b=AMC/QH2Z1fV6yrkOknnSFywRXxs4V7L4Ikf2n8jmUWRqcClEnowXSPUOQwVpdBymn/ pq662Y9xI8pKJO9Y3exKZ/kYgjxD5o2VC2SnatxbvOxtfVO8uSBMII7B0b/RKO/0le2u UFOuQi7+TWCEsTX+qSv3F2FKYoaJyVbHedQyej4AsvDE+/rZLh8Q8s2hrWPDiMF+x6e8 At2ftOgRJ5zWKkL3QpPk9ejQg9SRxd2NEV2nZfz2hadDS11h3PDBkRjYHN65Fvynm4Mw /HOo2xgT/KLzYUg4zf0gsh4LjY+17X1UJVdnCLl+L7nN2mt0MqM3dYvYPi7EkGYhLTpc lh1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=svIZnH3LFn3SCsAf3hZ7NcuCk5uSXQPw/o877w6XO80=; b=PB2FU9+LTm90ripp5V3T6OtLjdQexd2dBKIauA4Gc+iVXLiRfvhFss8zueaUWLL5PR GzMNbnEbTo8FuUGfjyn7z5Dn1Sz/7DGINvx5ELKVrS2woKHuTLFs6SZK4nqKhj98a4zY 9CzOmC5NN9oBvi/PJqquiEmha5IyHL/wE++3aAau/500ZFePz/fWtW5vdhqY+vHPCCK1 xbg/MqqjCqG5tBwnJo973McWX9tjkrxpu3plRdgJdVXptH2306chuUV6ng2Mf0Q21vW3 HIolYDE1wTy971MCDvPOP72s8tdptbMBXlC2ChGwEz2NEqS4stbwC18CEQX3TTli2mzp z42A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 80si27823826pgf.5.2019.07.28.13.25.32; Sun, 28 Jul 2019 13:25:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726439AbfG1UXQ (ORCPT + 99 others); Sun, 28 Jul 2019 16:23:16 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:44648 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726129AbfG1UXP (ORCPT ); Sun, 28 Jul 2019 16:23:15 -0400 Received: by mail-lj1-f196.google.com with SMTP id k18so56449988ljc.11; Sun, 28 Jul 2019 13:23:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=svIZnH3LFn3SCsAf3hZ7NcuCk5uSXQPw/o877w6XO80=; b=eMFeppMRMFt/PfqKwzpNzERlfcQ6h72DB+BzrL7nDe/URd0PolGXPL7GsJsqo0oSn+ sz+gQydnhVQrz2cNHgS2qik1VK+L/rOdiFur9neMpbqu69bReubr2DswQM8AOogAr2T1 7Qnfe/MayCrHf0kNX0D/TTsbs7Fbb+pHhhxDoV2vSk+NNTo8FR/HydTN+uP/RlkNkK7C IDjAd78vxUlcsmfE+LFhQILeexPWpY9jwCh3uS3JwfyTs282vDVNWbiGSofPRMtr71kQ b1k4YooMbgTm3iNsZvUwffVXpGhoYFGowd9OPF38kUc1e0KBXVvioemkKIepzg1jk3Z8 Fqww== X-Gm-Message-State: APjAAAVMYcINoOHqR3MnhlFczLSn7nvati9HvN+WFRYoCoRxgEjWpV+Y TuWN3OUfOrkEablHAIR/ZMYsIUmQwnw= X-Received: by 2002:a2e:2993:: with SMTP id p19mr54104888ljp.202.1564345393166; Sun, 28 Jul 2019 13:23:13 -0700 (PDT) Received: from localhost.localdomain (broadband-188-32-48-208.ip.moscow.rt.ru. [188.32.48.208]) by smtp.googlemail.com with ESMTPSA id z17sm12395917ljc.37.2019.07.28.13.23.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Jul 2019 13:23:12 -0700 (PDT) From: Denis Efremov To: Bjorn Helgaas Cc: Denis Efremov , "David S. Miller" , "Benjamin Herrenschmidt" , Paul Mackerras , Michael Ellerman , Ralf Baechle , Paul Burton , James Hogan , Michal Simek , linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] PCI: Convert pci_resource_to_user to a weak function Date: Sun, 28 Jul 2019 23:22:09 +0300 Message-Id: <20190728202213.15550-2-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190728202213.15550-1-efremov@linux.com> References: <20190728202213.15550-1-efremov@linux.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch turns pci_resource_to_user() to a weak function. Thus, architecture-specific versions will automatically override the generic one. This allows to remove the HAVE_ARCH_PCI_RESOURCE_TO_USER macro and avoid the conditional compilation for this single function. Signed-off-by: Denis Efremov --- drivers/pci/pci.c | 8 ++++++++ include/linux/pci.h | 18 +++--------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 29ed5ec1ac27..f9dc7563a8b9 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -5932,6 +5932,14 @@ resource_size_t __weak pcibios_default_alignment(void) return 0; } +void __weak pci_resource_to_user(const struct pci_dev *dev, int bar, + const struct resource *rsrc, resource_size_t *start, + resource_size_t *end) +{ + *start = rsrc->start; + *end = rsrc->end; +} + #define RESOURCE_ALIGNMENT_PARAM_SIZE COMMAND_LINE_SIZE static char resource_alignment_param[RESOURCE_ALIGNMENT_PARAM_SIZE] = {0}; static DEFINE_SPINLOCK(resource_alignment_lock); diff --git a/include/linux/pci.h b/include/linux/pci.h index 9e700d9f9f28..1a19d0151b0a 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1870,25 +1870,13 @@ static inline const char *pci_name(const struct pci_dev *pdev) return dev_name(&pdev->dev); } - /* * Some archs don't want to expose struct resource to userland as-is * in sysfs and /proc */ -#ifdef HAVE_ARCH_PCI_RESOURCE_TO_USER -void pci_resource_to_user(const struct pci_dev *dev, int bar, - const struct resource *rsrc, - resource_size_t *start, resource_size_t *end); -#else -static inline void pci_resource_to_user(const struct pci_dev *dev, int bar, - const struct resource *rsrc, resource_size_t *start, - resource_size_t *end) -{ - *start = rsrc->start; - *end = rsrc->end; -} -#endif /* HAVE_ARCH_PCI_RESOURCE_TO_USER */ - +void __weak pci_resource_to_user(const struct pci_dev *dev, int bar, + const struct resource *rsrc, + resource_size_t *start, resource_size_t *end); /* * The world is not perfect and supplies us with broken PCI devices. -- 2.21.0