@@ -146,6 +146,10 @@ static bool mwifiex_pcie_ok_to_access_hw(struct mwifiex_adapter *adapter)
146146 *
147147 * If already not suspended, this function allocates and sends a host
148148 * sleep activate request to the firmware and turns off the traffic.
149+ *
150+ * XXX: ignoring all the above comment and just removes the card to
151+ * fix S0ix and "AP scanning (sometimes) not working after suspend".
152+ * Required code is extracted from mwifiex_pcie_remove().
149153 */
150154static int mwifiex_pcie_suspend (struct device * dev )
151155{
@@ -192,6 +196,9 @@ static int mwifiex_pcie_suspend(struct device *dev)
192196 *
193197 * If already not resumed, this function turns on the traffic and
194198 * sends a host sleep cancel request to the firmware.
199+ *
200+ * XXX: ignoring all the above comment and probes the card that was
201+ * removed on suspend. Required code is extracted from mwifiex_pcie_probe().
195202 */
196203static int mwifiex_pcie_resume (struct device * dev )
197204{
@@ -233,8 +240,13 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
233240 const struct pci_device_id * ent )
234241{
235242 struct pcie_service_card * card ;
243+ struct pci_dev * parent_pdev = pci_upstream_bridge (pdev );
236244 int ret ;
237245
246+ /* disable bridge_d3 to fix driver crashing after suspend on gen4+
247+ * Surface devices */
248+ parent_pdev -> bridge_d3 = false;
249+
238250 pr_debug ("info: vendor=0x%4.04X device=0x%4.04X rev=%d\n" ,
239251 pdev -> vendor , pdev -> device , pdev -> revision );
240252
@@ -271,8 +283,6 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
271283 return -1 ;
272284 }
273285
274- pdev -> bus -> self -> bridge_d3 = false;
275-
276286 return 0 ;
277287}
278288
0 commit comments