From: Denis Efremov <efremov@linux.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Michal Simek <monstr@monstr.eu>,
linux-pci@vger.kernel.org, linux-mips@vger.kernel.org,
Ralf Baechle <ralf@linux-mips.org>,
linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org,
Paul Burton <paul.burton@mips.com>,
Paul Mackerras <paulus@samba.org>,
Denis Efremov <efremov@linux.com>,
James Hogan <jhogan@kernel.org>,
linuxppc-dev@lists.ozlabs.org,
"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 1/5] PCI: Convert pci_resource_to_user to a weak function
Date: Sun, 28 Jul 2019 23:22:09 +0300 [thread overview]
Message-ID: <20190728202213.15550-2-efremov@linux.com> (raw)
In-Reply-To: <20190728202213.15550-1-efremov@linux.com>
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 <efremov@linux.com>
---
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
next prev parent reply other threads:[~2019-07-28 21:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-28 20:22 [PATCH 0/5] PCI: Convert pci_resource_to_user() to a weak function Denis Efremov
2019-07-28 20:22 ` Denis Efremov [this message]
2019-07-28 22:49 ` [EXTERNAL][PATCH 1/5] PCI: Convert pci_resource_to_user " Paul Burton
2019-07-29 6:31 ` Joe Perches
2019-07-29 10:06 ` Denis Efremov
2019-07-28 20:22 ` [PATCH 4/5] powerpc/PCI: Remove HAVE_ARCH_PCI_RESOURCE_TO_USER Denis Efremov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190728202213.15550-2-efremov@linux.com \
--to=efremov@linux.com \
--cc=bhelgaas@google.com \
--cc=davem@davemloft.net \
--cc=jhogan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=monstr@monstr.eu \
--cc=paul.burton@mips.com \
--cc=paulus@samba.org \
--cc=ralf@linux-mips.org \
--cc=sparclinux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).