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

Commit 4bd14dd5 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville
Browse files

iwlwifi: abstract out notification wait support



This will be sharable, but needs to live in the
op_mode as it is dependent on command processing.
Make a library out of the notification wait code.

Since I wrote all of the code originally and only
Intel employees changed it, we can also relicense
it to dual BSD/GPL.

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent f4720893
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ iwlwifi-objs += iwl-1000.o
iwlwifi-objs		+= iwl-2000.o
iwlwifi-objs		+= iwl-pci.o
iwlwifi-objs		+= iwl-drv.o
iwlwifi-objs		+= iwl-notif-wait.o
iwlwifi-objs		+= iwl-trans-pcie.o iwl-trans-pcie-rx.o iwl-trans-pcie-tx.o

iwlwifi-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o
+2 −22
Original line number Diff line number Diff line
@@ -1142,9 +1142,7 @@ void iwl_setup_rx_handlers(struct iwl_priv *priv)
	priv->rx_handlers[REPLY_TX] = iwlagn_rx_reply_tx;

	/* set up notification wait support */
	spin_lock_init(&priv->shrd->notif_wait_lock);
	INIT_LIST_HEAD(&priv->shrd->notif_waits);
	init_waitqueue_head(&priv->shrd->notif_waitq);
	iwl_notification_wait_init(&priv->notif_wait);

	/* Set up BT Rx handlers */
	if (cfg(priv)->lib->bt_rx_handler_setup)
@@ -1164,25 +1162,7 @@ int iwl_rx_dispatch(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb,
	 * even if the RX handler consumes the RXB we have
	 * access to it in the notification wait entry.
	 */
	if (!list_empty(&priv->shrd->notif_waits)) {
		struct iwl_notification_wait *w;

		spin_lock(&priv->shrd->notif_wait_lock);
		list_for_each_entry(w, &priv->shrd->notif_waits, list) {
			if (w->cmd != pkt->hdr.cmd)
				continue;
			IWL_DEBUG_RX(priv,
				"Notif: %s, 0x%02x - wake the callers up\n",
				get_cmd_string(pkt->hdr.cmd),
				pkt->hdr.cmd);
			w->triggered = true;
			if (w->fn)
				w->fn(priv, pkt, w->fn_data);
		}
		spin_unlock(&priv->shrd->notif_wait_lock);

		wake_up_all(&priv->shrd->notif_waitq);
	}
	iwl_notification_wait_notify(&priv->notif_wait, pkt);

	if (priv->pre_rx_handler &&
	    priv->shrd->ucode_owner == IWL_OWNERSHIP_TM)
+6 −5
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ static int iwlagn_disable_pan(struct iwl_priv *priv,
	u8 old_dev_type = send->dev_type;
	int ret;

	iwl_init_notification_wait(priv->shrd, &disable_wait,
	iwl_init_notification_wait(&priv->notif_wait, &disable_wait,
				   REPLY_WIPAN_DEACTIVATION_COMPLETE,
				   NULL, NULL);

@@ -74,9 +74,10 @@ static int iwlagn_disable_pan(struct iwl_priv *priv,

	if (ret) {
		IWL_ERR(priv, "Error disabling PAN (%d)\n", ret);
		iwl_remove_notification(priv->shrd, &disable_wait);
		iwl_remove_notification(&priv->notif_wait, &disable_wait);
	} else {
		ret = iwl_wait_notification(priv->shrd, &disable_wait, HZ);
		ret = iwl_wait_notification(&priv->notif_wait,
					    &disable_wait, HZ);
		if (ret)
			IWL_ERR(priv, "Timed out waiting for PAN disable\n");
	}
+1 −1
Original line number Diff line number Diff line
@@ -845,7 +845,7 @@ static void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
	/* Cancel currently queued command. */
	clear_bit(STATUS_HCMD_ACTIVE, &priv->shrd->status);

	iwl_abort_notification_waits(priv->shrd);
	iwl_abort_notification_waits(&priv->notif_wait);

	/* Keep the restart process from trying to send host
	 * commands by clearing the ready bit */
+3 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@
#include "iwl-trans.h"
#include "iwl-shared.h"
#include "iwl-op-mode.h"
#include "iwl-notif-wait.h"

struct iwl_tx_queue;

@@ -739,6 +740,8 @@ struct iwl_priv {
				       struct iwl_rx_cmd_buffer *rxb,
				       struct iwl_device_cmd *cmd);

	struct iwl_notif_wait_data notif_wait;

	struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];

	/* spectrum measurement report caching */
Loading