2023-09-13 12:02:22

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 01/15] wifi: iwlwifi: pcie: rescan bus if no parent

From: Johannes Berg <[email protected]>

If the bus has no parent due to the topology, platform level device
reset (PLDR) wouldn't work. On the other hand, some platforms appear
to require scanning the parent, though it's not clear why.

However if there's no parent, then we skip the rescan, which isn't a
good idea. Change the code to go to the parent only if that exists,
and rescan the bus itself where it doesn't.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index a9e00a2cd9ba..51012435e39b 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -2112,8 +2112,11 @@ static void iwl_trans_pcie_removal_wk(struct work_struct *wk)
pci_lock_rescan_remove();
pci_dev_put(pdev);
pci_stop_and_remove_bus_device(pdev);
- if (removal->rescan)
- pci_rescan_bus(bus->parent);
+ if (removal->rescan && bus) {
+ if (bus->parent)
+ bus = bus->parent;
+ pci_rescan_bus(bus);
+ }
pci_unlock_rescan_remove();

kfree(removal);
--
2.38.1


2023-09-13 13:09:02

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 01/15] wifi: iwlwifi: pcie: rescan bus if no parent

On Wed, 2023-09-13 at 14:56 +0300, [email protected] wrote:
> From: Johannes Berg <[email protected]>
>
> If the bus has no parent due to the topology, platform level device
> reset (PLDR) wouldn't work.

I learned later that this description is really pretty much wrong - it
shouldn't really reference PLDR at all, that's not what's going on
here. It should be talking about just the rescanning not working, or so,
that's the only part here that matters.

Anyway, I can fix it when I commit it, just wanted to state it in public
and not just silently do it.

johannes