Re: [PATCH v3] net: wwan: iosm: Fix hibernation by re-binding the driver around it

From: Maciej S. Szmigiero
Date: Tue Jan 14 2025 - 06:31:54 EST


On 14.01.2025 09:49, Paolo Abeni wrote:
On 1/9/25 12:33 AM, Maciej S. Szmigiero wrote:
@@ -530,3 +531,56 @@ void ipc_pcie_kfree_skb(struct iosm_pcie
*ipc_pcie, struct sk_buff *skb)
IPC_CB(skb)->mapping = 0;
dev_kfree_skb(skb);
}
+
+static int pm_notify(struct notifier_block *nb, unsigned long mode, void *_unused)
+{
+ if (mode == PM_HIBERNATION_PREPARE || mode == PM_RESTORE_PREPARE) {
+ if (pci_registered) {

Out of sheer ignorance on my side, why 'mode == PM_RESTORE_PREPARE' is
required above? Isn't the driver already unregistered by the previous
PM_HIBERNATION_PREPARE call?

If the restore kernel had this driver loaded then it needs to be unregistered
before restoring the hibernation image so it has chance to shut the modem
firmware down rather than keep it running during the restore process.

This way when the driver from the restored image re-binds the device it finds
it in the proper non-running state.

Thanks,

Paolo


Thanks,
Maciej