Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0dbba66 authored by Amitkumar Karwar's avatar Amitkumar Karwar Committed by John W. Linville
Browse files

mwifiex: cancel pending commands during host sleep



Sometimes we may end up downloading other commands when host
sleep is configured. This patch makes sure that pending
commands are cancelled and we stop queueing further commands
during host sleep.

Signed-off-by: default avatarAmitkumar Karwar <akarwar@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent b49f639f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -509,6 +509,11 @@ int mwifiex_send_cmd(struct mwifiex_private *priv, u16 cmd_no,
		return -1;
	}

	if (adapter->hs_enabling && cmd_no != HostCmd_CMD_802_11_HS_CFG_ENH) {
		dev_err(adapter->dev, "PREP_CMD: host entering sleep state\n");
		return -1;
	}

	if (adapter->surprise_removed) {
		dev_err(adapter->dev, "PREP_CMD: card is removed\n");
		return -1;
+1 −0
Original line number Diff line number Diff line
@@ -774,6 +774,7 @@ struct mwifiex_adapter {
	u16 hs_activate_wait_q_woken;
	wait_queue_head_t hs_activate_wait_q;
	bool is_suspended;
	bool hs_enabling;
	u8 event_body[MAX_EVENT_SIZE];
	u32 hw_dot_11n_dev_cap;
	u8 hw_dev_mcs_support;
+1 −0
Original line number Diff line number Diff line
@@ -120,6 +120,7 @@ static int mwifiex_pcie_suspend(struct device *dev)

	/* Indicate device suspended */
	adapter->is_suspended = true;
	adapter->hs_enabling = false;

	return 0;
}
+2 −0
Original line number Diff line number Diff line
@@ -237,6 +237,7 @@ static int mwifiex_sdio_suspend(struct device *dev)
	/* Enable the Host Sleep */
	if (!mwifiex_enable_hs(adapter)) {
		dev_err(adapter->dev, "cmd: failed to suspend\n");
		adapter->hs_enabling = false;
		return -EFAULT;
	}

@@ -245,6 +246,7 @@ static int mwifiex_sdio_suspend(struct device *dev)

	/* Indicate device suspended */
	adapter->is_suspended = true;
	adapter->hs_enabling = false;

	return ret;
}
+3 −0
Original line number Diff line number Diff line
@@ -508,6 +508,9 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
	memset(&hscfg, 0, sizeof(struct mwifiex_ds_hs_cfg));
	hscfg.is_invoke_hostcmd = true;

	adapter->hs_enabling = true;
	mwifiex_cancel_all_pending_cmd(adapter);

	if (mwifiex_set_hs_params(mwifiex_get_priv(adapter,
						   MWIFIEX_BSS_ROLE_STA),
				  HostCmd_ACT_GEN_SET, MWIFIEX_SYNC_CMD,
Loading