* [PATCH 1/1] PCI/AER: Change to use helper pcie_aer_is_native() in some places
@ 2021-02-04 6:28 Xiaofei Tan
2021-02-04 21:50 ` Krzysztof Wilczyński
0 siblings, 1 reply; 3+ messages in thread
From: Xiaofei Tan @ 2021-02-04 6:28 UTC (permalink / raw)
To: bhelgaas, sathyanarayanan.kuppuswamy, sean.v.kelley,
Jonathan.Cameron, refactormyself
Cc: Xiaofei Tan, linux-pci, linux-kernel, linuxarm
Use helper function pcie_aer_is_native() in some places to keep
the code tidy. No function changes.
Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
drivers/pci/pcie/aer.c | 4 ++--
drivers/pci/pcie/err.c | 2 +-
drivers/pci/pcie/portdrv_core.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index 77b0f2c..03212d0 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -1397,7 +1397,7 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev)
*/
aer = root ? root->aer_cap : 0;
- if ((host->native_aer || pcie_ports_native) && aer) {
+ if (pcie_aer_is_native(dev) && aer) {
/* Disable Root's interrupt in response to error messages */
pci_read_config_dword(root, aer + PCI_ERR_ROOT_COMMAND, ®32);
reg32 &= ~ROOT_PORT_INTR_ON_MESG_MASK;
@@ -1417,7 +1417,7 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev)
pci_info(dev, "Root Port link has been reset (%d)\n", rc);
}
- if ((host->native_aer || pcie_ports_native) && aer) {
+ if (pcie_aer_is_native(dev) && aer) {
/* Clear Root Error Status */
pci_read_config_dword(root, aer + PCI_ERR_ROOT_STATUS, ®32);
pci_write_config_dword(root, aer + PCI_ERR_ROOT_STATUS, reg32);
diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c
index 510f31f..1d6cfb9 100644
--- a/drivers/pci/pcie/err.c
+++ b/drivers/pci/pcie/err.c
@@ -237,7 +237,7 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev,
* this status. In that case, the signaling device may not even be
* visible to the OS.
*/
- if (host->native_aer || pcie_ports_native) {
+ if (pcie_aer_is_native(dev)) {
pcie_clear_device_status(bridge);
pci_aer_clear_nonfatal_status(bridge);
}
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index e1fed664..1e6a690 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -222,7 +222,7 @@ static int get_port_device_capability(struct pci_dev *dev)
#ifdef CONFIG_PCIEAER
if (dev->aer_cap && pci_aer_available() &&
- (pcie_ports_native || host->native_aer)) {
+ pcie_aer_is_native(dev)) {
services |= PCIE_PORT_SERVICE_AER;
/*
--
2.8.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] PCI/AER: Change to use helper pcie_aer_is_native() in some places
2021-02-04 6:28 [PATCH 1/1] PCI/AER: Change to use helper pcie_aer_is_native() in some places Xiaofei Tan
@ 2021-02-04 21:50 ` Krzysztof Wilczyński
2021-02-05 1:20 ` tanxiaofei
0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Wilczyński @ 2021-02-04 21:50 UTC (permalink / raw)
To: Xiaofei Tan
Cc: helgaas, sathyanarayanan.kuppuswamy, sean.v.kelley,
Jonathan.Cameron, refactormyself, linux-pci, linux-kernel,
linuxarm
Hi Tan,
This is very nice! Thank you for this.
[...]
> if (dev->aer_cap && pci_aer_available() &&
> - (pcie_ports_native || host->native_aer)) {
> + pcie_aer_is_native(dev)) {
> services |= PCIE_PORT_SERVICE_AER;
[...]
A suggestion. You could improve this even further, for example:
if (pci_aer_available() && pcie_aer_is_native(dev)) {
This is because the pcie_aer_is_native() function performs the
dev->aer_cap check internally, so we could rely on it, and avoid
checking the same thing twice.
What do you think?
Reviewed-by: Krzysztof Wilczyński <kw@linux.com>
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] PCI/AER: Change to use helper pcie_aer_is_native() in some places
2021-02-04 21:50 ` Krzysztof Wilczyński
@ 2021-02-05 1:20 ` tanxiaofei
0 siblings, 0 replies; 3+ messages in thread
From: tanxiaofei @ 2021-02-05 1:20 UTC (permalink / raw)
To: Krzysztof Wilczyński
Cc: helgaas, sathyanarayanan.kuppuswamy, sean.v.kelley,
Jonathan.Cameron, refactormyself, linux-pci, linux-kernel,
linuxarm
Hi Krzysztof,
On 2021/2/5 5:50, Krzysztof Wilczyński wrote:
> Hi Tan,
>
> This is very nice! Thank you for this.
>
> [...]
>> if (dev->aer_cap && pci_aer_available() &&
>> - (pcie_ports_native || host->native_aer)) {
>> + pcie_aer_is_native(dev)) {
>> services |= PCIE_PORT_SERVICE_AER;
> [...]
>
> A suggestion. You could improve this even further, for example:
>
> if (pci_aer_available() && pcie_aer_is_native(dev)) {
>
> This is because the pcie_aer_is_native() function performs the
> dev->aer_cap check internally, so we could rely on it, and avoid
> checking the same thing twice.
>
> What do you think?
>
Yes, it's better, i will send v2 patch including this.thanks.
> Reviewed-by: Krzysztof Wilczyński <kw@linux.com>
>
> Krzysztof
>
> .
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-05 1:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04 6:28 [PATCH 1/1] PCI/AER: Change to use helper pcie_aer_is_native() in some places Xiaofei Tan
2021-02-04 21:50 ` Krzysztof Wilczyński
2021-02-05 1:20 ` tanxiaofei
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).