Commit 978785a3 authored by Tomas Winkler's avatar Tomas Winkler Committed by John W. Linville
Browse files

iwlwifi: clean up printing



Use IWL_ macros where possible to unify debug output usage.
Define new unconditional printouts IWL_ERR, IWL_WARN, IWL_INFO,
and IWL_CRIT which don't use hidden priv pointer.

Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarZhu Yi <yi.zhu@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 146846ae
Loading
Loading
Loading
Loading
+18 −18
Original line number Diff line number Diff line
@@ -463,7 +463,8 @@ static int rs_collect_tx_data(struct iwl_rate_scale_data *windows,
 * Fill uCode API rate_n_flags field, based on "search" or "active" table.
 */
/* FIXME:RS:remove this function and put the flags statically in the table */
static u32 rate_n_flags_from_tbl(struct iwl_scale_tbl_info *tbl,
static u32 rate_n_flags_from_tbl(struct iwl_priv *priv,
				 struct iwl_scale_tbl_info *tbl,
				 int index, u8 use_green)
{
	u32 rate_n_flags = 0;
@@ -475,8 +476,7 @@ static u32 rate_n_flags_from_tbl(struct iwl_scale_tbl_info *tbl,

	} else if (is_Ht(tbl->lq_type)) {
		if (index > IWL_LAST_OFDM_RATE) {
			printk(KERN_ERR RS_NAME": Invalid HT rate index %d\n",
			       index);
			IWL_ERR(priv, "Invalid HT rate index %d\n", index);
			index = IWL_LAST_OFDM_RATE;
		}
		rate_n_flags = RATE_MCS_HT_MSK;
@@ -488,8 +488,7 @@ static u32 rate_n_flags_from_tbl(struct iwl_scale_tbl_info *tbl,
		else
			rate_n_flags |=	iwl_rates[index].plcp_mimo3;
	} else {
		printk(KERN_ERR RS_NAME": Invalid tbl->lq_type %d\n",
		       tbl->lq_type);
		IWL_ERR(priv, "Invalid tbl->lq_type %d\n", tbl->lq_type);
	}

	rate_n_flags |= ((tbl->ant_type << RATE_MCS_ANT_POS) &
@@ -509,8 +508,7 @@ static u32 rate_n_flags_from_tbl(struct iwl_scale_tbl_info *tbl,
			rate_n_flags |= RATE_MCS_GF_MSK;
			if (is_siso(tbl->lq_type) && tbl->is_SGI) {
				rate_n_flags &= ~RATE_MCS_SGI_MSK;
				printk(KERN_ERR RS_NAME
				       ": GF was set with SGI:SISO\n");
				IWL_ERR(priv, "GF was set with SGI:SISO\n");
			}
		}
	}
@@ -761,7 +759,7 @@ static u32 rs_get_lower_rate(struct iwl_lq_sta *lq_sta,
		low = scale_index;

out:
	return rate_n_flags_from_tbl(tbl, low, is_green);
	return rate_n_flags_from_tbl(lq_sta->drv, tbl, low, is_green);
}

/*
@@ -1179,7 +1177,7 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv,
						rate, rate_mask);
		return -1;
	}
	tbl->current_rate = rate_n_flags_from_tbl(tbl, rate, is_green);
	tbl->current_rate = rate_n_flags_from_tbl(priv, tbl, rate, is_green);

	IWL_DEBUG_RATE("LQ: Switch to new mcs %X index is green %X\n",
		     tbl->current_rate, is_green);
@@ -1239,7 +1237,7 @@ static int rs_switch_to_siso(struct iwl_priv *priv,
			     rate, rate_mask);
		return -1;
	}
	tbl->current_rate = rate_n_flags_from_tbl(tbl, rate, is_green);
	tbl->current_rate = rate_n_flags_from_tbl(priv, tbl, rate, is_green);
	IWL_DEBUG_RATE("LQ: Switch to new mcs %X index is green %X\n",
		     tbl->current_rate, is_green);
	return 0;
@@ -1442,8 +1440,9 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
				if (tpt >= search_tbl->expected_tpt[index])
					break;
			}
			search_tbl->current_rate = rate_n_flags_from_tbl(
						search_tbl, index, is_green);
			search_tbl->current_rate =
				rate_n_flags_from_tbl(priv, search_tbl,
						      index, is_green);
			goto out;
		}
		tbl->action++;
@@ -1554,8 +1553,9 @@ static int rs_move_mimo_to_other(struct iwl_priv *priv,
				if (tpt >= search_tbl->expected_tpt[index])
					break;
			}
			search_tbl->current_rate = rate_n_flags_from_tbl(
						search_tbl, index, is_green);
			search_tbl->current_rate =
				rate_n_flags_from_tbl(priv, search_tbl,
						      index, is_green);
			goto out;

		}
@@ -1947,7 +1947,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
lq_update:
	/* Replace uCode's rate table for the destination station. */
	if (update_lq) {
		rate = rate_n_flags_from_tbl(tbl, index, is_green);
		rate = rate_n_flags_from_tbl(priv, tbl, index, is_green);
		rs_fill_link_cmd(priv, lq_sta, rate);
		iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC);
	}
@@ -2031,7 +2031,7 @@ lq_update:
	}

out:
	tbl->current_rate = rate_n_flags_from_tbl(tbl, index, is_green);
	tbl->current_rate = rate_n_flags_from_tbl(priv, tbl, index, is_green);
	i = index;
	lq_sta->last_txrate_idx = i;

@@ -2084,7 +2084,7 @@ static void rs_initialize_lq(struct iwl_priv *priv,
	if (!rs_is_valid_ant(valid_tx_ant, tbl->ant_type))
	    rs_toggle_antenna(valid_tx_ant, &rate, tbl);

	rate = rate_n_flags_from_tbl(tbl, rate_idx, use_green);
	rate = rate_n_flags_from_tbl(priv, tbl, rate_idx, use_green);
	tbl->current_rate = rate;
	rs_set_expected_tpt_table(lq_sta, tbl);
	rs_fill_link_cmd(NULL, lq_sta, rate);
+10 −14
Original line number Diff line number Diff line
@@ -1634,12 +1634,12 @@ static int iwl_read_ucode(struct iwl_priv *priv)
		goto err_release;
	}
	if (api_ver != api_max)
		IWL_ERROR("Firmware has old API version. Expected v%u, "
		IWL_ERR(priv, "Firmware has old API version. Expected v%u, "
			  "got v%u. New firmware can be obtained "
			  "from http://www.intellinuxwireless.org.\n",
			  api_max, api_ver);

	printk(KERN_INFO DRV_NAME " loaded firmware version %u.%u.%u.%u\n",
	IWL_INFO(priv, "loaded firmware version %u.%u.%u.%u\n",
	       IWL_UCODE_MAJOR(priv->ucode_ver),
	       IWL_UCODE_MINOR(priv->ucode_ver),
	       IWL_UCODE_API(priv->ucode_ver),
@@ -3355,8 +3355,7 @@ static ssize_t store_debug_level(struct device *d,

	ret = strict_strtoul(buf, 0, &val);
	if (ret)
		printk(KERN_INFO DRV_NAME
		       ": %s is not in hex or decimal form.\n", buf);
		IWL_ERR(priv, "%s is not in hex or decimal form.\n", buf);
	else
		priv->debug_level = val;

@@ -3435,8 +3434,7 @@ static ssize_t store_tx_power(struct device *d,

	ret = strict_strtoul(buf, 10, &val);
	if (ret)
		printk(KERN_INFO DRV_NAME
		       ": %s is not in decimal form.\n", buf);
		IWL_INFO(priv, "%s is not in decimal form.\n", buf);
	else
		iwl_set_tx_power(priv, val, false);

@@ -3775,8 +3773,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
			err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
		/* both attempts failed: */
		if (err) {
			printk(KERN_WARNING "%s: No suitable DMA available.\n",
				DRV_NAME);
			IWL_WARN(priv, "No suitable DMA available.\n");
			goto out_pci_disable_device;
		}
	}
@@ -3802,8 +3799,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
	IWL_DEBUG_INFO("pci_resource_base = %p\n", priv->hw_base);

	iwl_hw_detect(priv);
	printk(KERN_INFO DRV_NAME
		": Detected Intel Wireless WiFi Link %s REV=0x%X\n",
	IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s REV=0x%X\n",
		priv->cfg->name, priv->hw_rev);

	/* We disable the RETRY_TIMEOUT register (0x41) to keep
+3 −5
Original line number Diff line number Diff line
@@ -511,16 +511,14 @@ static int iwlcore_init_geos(struct iwl_priv *priv)

	if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) &&
	     priv->cfg->sku & IWL_SKU_A) {
		dev_printk(KERN_INFO, &(priv->hw->wiphy->dev),
			   "Incorrectly detected BG card as ABG.  Please send "
			   "your PCI ID 0x%04X:0x%04X to maintainer.\n",
		IWL_INFO(priv, "Incorrectly detected BG card as ABG. "
			"Please send your PCI ID 0x%04X:0x%04X to maintainer.\n",
			   priv->pci_dev->device,
			   priv->pci_dev->subsystem_device);
		priv->cfg->sku &= ~IWL_SKU_A;
	}

	dev_printk(KERN_INFO, &(priv->hw->wiphy->dev),
		   "Tunable channels: %d 802.11bg, %d 802.11a channels\n",
	IWL_INFO(priv, "Tunable channels: %d 802.11bg, %d 802.11a channels\n",
		   priv->bands[IEEE80211_BAND_2GHZ].n_channels,
		   priv->bands[IEEE80211_BAND_5GHZ].n_channels);

+7 −5
Original line number Diff line number Diff line
@@ -31,6 +31,13 @@

struct iwl_priv;

#define IWL_ERROR(f, a...) dev_err(&(priv->pci_dev->dev), f, ## a)
#define IWL_WARNING(f, a...) dev_warn(&(priv->pci_dev->dev), f, ## a)
#define IWL_ERR(p, f, a...) dev_err(&((p)->pci_dev->dev), f, ## a)
#define IWL_WARN(p, f, a...) dev_warn(&((p)->pci_dev->dev), f, ## a)
#define IWL_INFO(p, f, a...) dev_info(&((p)->pci_dev->dev), f, ## a)
#define IWL_CRIT(p, f, a...) dev_crit(&((p)->pci_dev->dev), f, ## a)

#ifdef CONFIG_IWLWIFI_DEBUG
#define IWL_DEBUG(level, fmt, args...)					    \
do {									    \
@@ -164,11 +171,6 @@ static inline void iwl_dbgfs_unregister(struct iwl_priv *priv)
#define IWL_DL_TX_REPLY		(1 << 30)
#define IWL_DL_QOS		(1 << 31)

#define IWL_ERROR(f, a...)		\
		dev_printk(KERN_ERR, &(priv->hw->wiphy->dev), f, ## a)
#define IWL_WARNING(f, a...)		\
		dev_printk(KERN_WARNING, &(priv->hw->wiphy->dev), f, ## a)

#define IWL_DEBUG_INFO(f, a...)		IWL_DEBUG(IWL_DL_INFO, f, ## a)
#define IWL_DEBUG_MAC80211(f, a...)	IWL_DEBUG(IWL_DL_MAC80211, f, ## a)
#define IWL_DEBUG_MACDUMP(f, a...)	IWL_DEBUG(IWL_DL_MACDUMP, f, ## a)
+0 −3
Original line number Diff line number Diff line
@@ -172,9 +172,6 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file,
	struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
	const size_t bufsz = sizeof(buf);

	printk(KERN_DEBUG "offset is: 0x%x\tlen is: 0x%x\n",
	priv->dbgfs->sram_offset, priv->dbgfs->sram_len);

	iwl_grab_nic_access(priv);
	for (i = priv->dbgfs->sram_len; i > 0; i -= 4) {
		val = iwl_read_targ_mem(priv, priv->dbgfs->sram_offset + \
Loading