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

Commit dd5fe104 authored by Don Fry's avatar Don Fry Committed by Wey-Yi Guy
Browse files

iwlwifi: move ucode notification from iwl_priv to iwl_shared



Move the notification structures for ucode operations from the
iwl_priv structure to the iwl_shared structure, with associated
code changes.

Signed-off-by: default avatarDon Fry <donald.h.fry@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent 3d6acefc
Loading
Loading
Loading
Loading
+0 −51
Original line number Diff line number Diff line
@@ -934,57 +934,6 @@ u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant, u8 valid)
	return ant;
}

/* notification wait support */
void iwlagn_init_notification_wait(struct iwl_priv *priv,
				   struct iwl_notification_wait *wait_entry,
				   u8 cmd,
				   void (*fn)(struct iwl_priv *priv,
					      struct iwl_rx_packet *pkt,
					      void *data),
				   void *fn_data)
{
	wait_entry->fn = fn;
	wait_entry->fn_data = fn_data;
	wait_entry->cmd = cmd;
	wait_entry->triggered = false;
	wait_entry->aborted = false;

	spin_lock_bh(&priv->notif_wait_lock);
	list_add(&wait_entry->list, &priv->notif_waits);
	spin_unlock_bh(&priv->notif_wait_lock);
}

int iwlagn_wait_notification(struct iwl_priv *priv,
			     struct iwl_notification_wait *wait_entry,
			     unsigned long timeout)
{
	int ret;

	ret = wait_event_timeout(priv->notif_waitq,
				 wait_entry->triggered || wait_entry->aborted,
				 timeout);

	spin_lock_bh(&priv->notif_wait_lock);
	list_del(&wait_entry->list);
	spin_unlock_bh(&priv->notif_wait_lock);

	if (wait_entry->aborted)
		return -EIO;

	/* return value is always >= 0 */
	if (ret <= 0)
		return -ETIMEDOUT;
	return 0;
}

void iwlagn_remove_notification(struct iwl_priv *priv,
				struct iwl_notification_wait *wait_entry)
{
	spin_lock_bh(&priv->notif_wait_lock);
	list_del(&wait_entry->list);
	spin_unlock_bh(&priv->notif_wait_lock);
}

#ifdef CONFIG_PM_SLEEP
static void iwlagn_convert_p1k(u16 *p1k, __le16 *out)
{
+8 −8
Original line number Diff line number Diff line
@@ -1131,9 +1131,9 @@ 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->notif_wait_lock);
	INIT_LIST_HEAD(&priv->notif_waits);
	init_waitqueue_head(&priv->notif_waitq);
	spin_lock_init(&priv->shrd->notif_wait_lock);
	INIT_LIST_HEAD(&priv->shrd->notif_waits);
	init_waitqueue_head(&priv->shrd->notif_waitq);

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

		spin_lock(&priv->notif_wait_lock);
		list_for_each_entry(w, &priv->notif_waits, list) {
		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,
@@ -1167,9 +1167,9 @@ int iwl_rx_dispatch(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb,
			if (w->fn)
				w->fn(priv, pkt, w->fn_data);
		}
		spin_unlock(&priv->notif_wait_lock);
		spin_unlock(&priv->shrd->notif_wait_lock);

		wake_up_all(&priv->notif_waitq);
		wake_up_all(&priv->shrd->notif_waitq);
	}

	if (priv->pre_rx_handler)
+3 −3
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;

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

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

	if (ret) {
		IWL_ERR(priv, "Error disabling PAN (%d)\n", ret);
		iwlagn_remove_notification(priv, &disable_wait);
		iwl_remove_notification(priv->shrd, &disable_wait);
	} else {
		ret = iwlagn_wait_notification(priv, &disable_wait, HZ);
		ret = iwl_wait_notification(priv->shrd, &disable_wait, HZ);
		if (ret)
			IWL_ERR(priv, "Timed out waiting for PAN disable\n");
	}
+0 −16
Original line number Diff line number Diff line
@@ -356,22 +356,6 @@ static inline __le32 iwl_hw_set_rate_n_flags(u8 rate, u32 flags)
void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv);
void iwl_eeprom_get_mac(const struct iwl_priv *priv, u8 *mac);

/* notification wait support */
void __acquires(wait_entry)
iwlagn_init_notification_wait(struct iwl_priv *priv,
			      struct iwl_notification_wait *wait_entry,
			      u8 cmd,
			      void (*fn)(struct iwl_priv *priv,
					 struct iwl_rx_packet *pkt,
					 void *data),
			      void *fn_data);
int __must_check __releases(wait_entry)
iwlagn_wait_notification(struct iwl_priv *priv,
			 struct iwl_notification_wait *wait_entry,
			 unsigned long timeout);
void __releases(wait_entry)
iwlagn_remove_notification(struct iwl_priv *priv,
			   struct iwl_notification_wait *wait_entry);
extern int iwlagn_init_alive_start(struct iwl_priv *priv);
extern int iwl_alive_start(struct iwl_priv *priv);
/* svtool */
+1 −14
Original line number Diff line number Diff line
@@ -836,19 +836,6 @@ void iwl_print_rx_config_cmd(struct iwl_priv *priv,
}
#endif

static void iwlagn_abort_notification_waits(struct iwl_priv *priv)
{
	unsigned long flags;
	struct iwl_notification_wait *wait_entry;

	spin_lock_irqsave(&priv->notif_wait_lock, flags);
	list_for_each_entry(wait_entry, &priv->notif_waits, list)
		wait_entry->aborted = true;
	spin_unlock_irqrestore(&priv->notif_wait_lock, flags);

	wake_up_all(&priv->notif_waitq);
}

void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
{
	unsigned int reload_msec;
@@ -860,7 +847,7 @@ void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
	/* Cancel currently queued command. */
	clear_bit(STATUS_HCMD_ACTIVE, &priv->shrd->status);

	iwlagn_abort_notification_waits(priv);
	iwl_abort_notification_waits(priv->shrd);

	/* Keep the restart process from trying to send host
	 * commands by clearing the ready bit */
Loading