From: Tomasz Nowicki <tomasz.nowicki@linaro.org>
To: Arnd Bergmann <arnd@arndb.de>, linux-arm-kernel@lists.infradead.org
Cc: catalin.marinas@arm.com, will.deacon@arm.com,
bhelgaas@google.com, lorenzo.pieralisi@arm.com,
wangyijing@huawei.com, hanjun.guo@linaro.org,
Liviu.Dudau@arm.com, tglx@linutronix.de, mingo@redhat.com,
hpa@zytor.com, rjw@rjwysocki.net, linaro-acpi@lists.linaro.org,
linux-pci@vger.kernel.org, x86@kernel.org,
linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org
Subject: Re: [PATCH 6/6] pci, acpi: Share ACPI PCI config space accessors.
Date: Wed, 19 Nov 2014 17:24:22 +0100 [thread overview]
Message-ID: <546CC436.4000902@linaro.org> (raw)
In-Reply-To: <2360791.Aj7tQ0nCJ3@wuerfel>
On 19.11.2014 17:19, Arnd Bergmann wrote:
> On Wednesday 19 November 2014 17:04:51 Tomasz Nowicki wrote:
>> +/*
>> + * raw_pci_read/write - ACPI PCI config space accessors.
>> + *
>> + * ACPI spec defines MMCFG as the way we can access PCI config space,
>> + * so let MMCFG be default (__weak).
>> + *
>> + * If platform needs more fancy stuff, should provides its own implementation.
>> + */
>> +int __weak raw_pci_read(unsigned int domain, unsigned int bus,
>> + unsigned int devfn, int reg, int len, u32 *val)
>> +{
>> + return pci_mmcfg_read(domain, bus, devfn, reg, len, val);
>> +}
>> +
>> +int __weak raw_pci_write(unsigned int domain, unsigned int bus,
>> + unsigned int devfn, int reg, int len, u32 val)
>> +{
>> + return pci_mmcfg_write(domain, bus, devfn, reg, len, val);
>> +}
>> +
>>
>
> I think it would be better to avoid __weak functions here, as they tend
> to be hard to follow when trying to understand the code.
>
> How about using a Kconfig symbol like this:
>
> #ifdef CONFIG_ARCH_RAW_PCI_READWRITE
> int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn,
> int reg, int len, u32 *val);
> int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn,
> int reg, int len, u32 val);
> #else
> static inline int raw_pci_read(unsigned int domain, unsigned int bus,
> unsigned int devfn, int reg, int len, u32 *val)
> {
> return pci_mmcfg_read(domain, bus, devfn, reg, len, val);
> }
>
> static inline int raw_pci_write(unsigned int domain, unsigned int bus,
> unsigned int devfn, int reg, int len, u32 val)
> {
> return pci_mmcfg_write(domain, bus, devfn, reg, len, val);
> }
> #endif
>
> Same thing for the weak symbols in patch 5.
>
It makes sense to me, thanks!
Tomasz
WARNING: multiple messages have this Message-ID (diff)
From: tomasz.nowicki@linaro.org (Tomasz Nowicki)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/6] pci, acpi: Share ACPI PCI config space accessors.
Date: Wed, 19 Nov 2014 17:24:22 +0100 [thread overview]
Message-ID: <546CC436.4000902@linaro.org> (raw)
In-Reply-To: <2360791.Aj7tQ0nCJ3@wuerfel>
On 19.11.2014 17:19, Arnd Bergmann wrote:
> On Wednesday 19 November 2014 17:04:51 Tomasz Nowicki wrote:
>> +/*
>> + * raw_pci_read/write - ACPI PCI config space accessors.
>> + *
>> + * ACPI spec defines MMCFG as the way we can access PCI config space,
>> + * so let MMCFG be default (__weak).
>> + *
>> + * If platform needs more fancy stuff, should provides its own implementation.
>> + */
>> +int __weak raw_pci_read(unsigned int domain, unsigned int bus,
>> + unsigned int devfn, int reg, int len, u32 *val)
>> +{
>> + return pci_mmcfg_read(domain, bus, devfn, reg, len, val);
>> +}
>> +
>> +int __weak raw_pci_write(unsigned int domain, unsigned int bus,
>> + unsigned int devfn, int reg, int len, u32 val)
>> +{
>> + return pci_mmcfg_write(domain, bus, devfn, reg, len, val);
>> +}
>> +
>>
>
> I think it would be better to avoid __weak functions here, as they tend
> to be hard to follow when trying to understand the code.
>
> How about using a Kconfig symbol like this:
>
> #ifdef CONFIG_ARCH_RAW_PCI_READWRITE
> int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn,
> int reg, int len, u32 *val);
> int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn,
> int reg, int len, u32 val);
> #else
> static inline int raw_pci_read(unsigned int domain, unsigned int bus,
> unsigned int devfn, int reg, int len, u32 *val)
> {
> return pci_mmcfg_read(domain, bus, devfn, reg, len, val);
> }
>
> static inline int raw_pci_write(unsigned int domain, unsigned int bus,
> unsigned int devfn, int reg, int len, u32 val)
> {
> return pci_mmcfg_write(domain, bus, devfn, reg, len, val);
> }
> #endif
>
> Same thing for the weak symbols in patch 5.
>
It makes sense to me, thanks!
Tomasz
next prev parent reply other threads:[~2014-11-19 16:24 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-19 16:04 [PATCH 0/6] PCI: MMCONFIG clean up Tomasz Nowicki
2014-11-19 16:04 ` Tomasz Nowicki
2014-11-19 16:04 ` [PATCH 1/6] x86, acpi, pci: Reorder logic of pci_mmconfig_insert() function Tomasz Nowicki
2014-11-19 16:04 ` Tomasz Nowicki
2014-11-19 16:04 ` Tomasz Nowicki
2014-11-19 16:04 ` [PATCH 2/6] x86, acpi, pci: Move arch-agnostic MMCFG code out of arch/x86/ directory Tomasz Nowicki
2014-11-19 16:04 ` Tomasz Nowicki
2014-12-10 23:35 ` Bjorn Helgaas
2014-12-10 23:35 ` Bjorn Helgaas
2014-12-10 23:55 ` Bjorn Helgaas
2014-12-10 23:55 ` Bjorn Helgaas
2014-12-12 14:55 ` [Linaro-acpi] " Arnd Bergmann
2014-12-12 14:55 ` Arnd Bergmann
2014-11-19 16:04 ` [PATCH 3/6] x86, acpi, pci: Move PCI config space accessors Tomasz Nowicki
2014-11-19 16:04 ` Tomasz Nowicki
2014-12-10 23:17 ` Bjorn Helgaas
2014-12-10 23:17 ` Bjorn Helgaas
2015-02-03 9:30 ` Tomasz Nowicki
2015-02-03 9:30 ` Tomasz Nowicki
2015-02-17 13:03 ` Tomasz Nowicki
2015-02-17 13:03 ` Tomasz Nowicki
2015-02-18 18:27 ` Bjorn Helgaas
2015-02-18 18:27 ` Bjorn Helgaas
2015-02-18 19:02 ` Rob Herring
2015-02-18 19:02 ` Rob Herring
2014-11-19 16:04 ` [PATCH 4/6] x86, acpi, pci: mmconfig_{32,64}.c code refactoring - remove code duplication Tomasz Nowicki
2014-11-19 16:04 ` [PATCH 4/6] x86, acpi, pci: mmconfig_{32, 64}.c " Tomasz Nowicki
2014-11-19 16:04 ` [PATCH 5/6] x86, acpi, pci: mmconfig_64.c becomes default implementation for arch agnostic low-level direct PCI config space accessors via MMCONFIG Tomasz Nowicki
2014-11-19 16:04 ` Tomasz Nowicki
2014-11-19 16:04 ` [PATCH 6/6] pci, acpi: Share ACPI PCI config space accessors Tomasz Nowicki
2014-11-19 16:04 ` Tomasz Nowicki
2014-11-19 16:19 ` Arnd Bergmann
2014-11-19 16:19 ` Arnd Bergmann
2014-11-19 16:24 ` Tomasz Nowicki [this message]
2014-11-19 16:24 ` Tomasz Nowicki
2014-11-20 22:26 ` Bjorn Helgaas
2014-11-20 22:26 ` Bjorn Helgaas
2014-11-21 4:00 ` Myron Stowe
2014-11-21 4:00 ` Myron Stowe
2014-11-21 12:24 ` Arnd Bergmann
2014-11-21 12:24 ` Arnd Bergmann
2014-11-21 18:08 ` Bjorn Helgaas
2014-11-21 18:08 ` Bjorn Helgaas
2014-11-24 10:41 ` Arnd Bergmann
2014-11-24 10:41 ` Arnd Bergmann
2014-12-08 7:13 ` Tomasz Nowicki
2014-12-08 7:13 ` Tomasz Nowicki
2014-12-09 21:50 ` Bjorn Helgaas
2014-12-09 21:50 ` Bjorn Helgaas
2014-12-10 6:16 ` Tomasz Nowicki
2014-12-10 6:16 ` Tomasz Nowicki
2015-02-02 20:42 ` [PATCH 0/6] PCI: MMCONFIG clean up Bjorn Helgaas
2015-02-02 20:42 ` Bjorn Helgaas
2015-02-03 7:42 ` Tomasz Nowicki
2015-02-03 7:42 ` Tomasz Nowicki
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=546CC436.4000902@linaro.org \
--to=tomasz.nowicki@linaro.org \
--cc=Liviu.Dudau@arm.com \
--cc=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=catalin.marinas@arm.com \
--cc=hanjun.guo@linaro.org \
--cc=hpa@zytor.com \
--cc=linaro-acpi@lists.linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=mingo@redhat.com \
--cc=rjw@rjwysocki.net \
--cc=tglx@linutronix.de \
--cc=wangyijing@huawei.com \
--cc=will.deacon@arm.com \
--cc=x86@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.