linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhu Yi <yi.zhu@intel.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org, Zhu Yi <yi.zhu@intel.com>
Subject: [PATCH 22/28] iwlwifi: replace private snprint_line with common hex_dump_xxx
Date: Wed,  8 Aug 2007 15:33:39 +0800	[thread overview]
Message-ID: <11865584771950-git-send-email-yi.zhu@intel.com> (raw)
In-Reply-To: <11865584754153-git-send-email-yi.zhu@intel.com>

Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwl-base.c    |   45 ++++++++++++++++++++++++-----------
 drivers/net/wireless/iwl-helpers.h |   21 ----------------
 2 files changed, 31 insertions(+), 35 deletions(-)

diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c
index efd4762..2c107e7 100644
--- a/drivers/net/wireless/iwl-base.c
+++ b/drivers/net/wireless/iwl-base.c
@@ -184,6 +184,23 @@ static const char *iwl_escape_essid(const char *essid, u8 essid_len)
 	return escaped;
 }
 
+static void iwl_print_hex_dump(int level, void *p, u32 len)
+{
+#ifdef CONFIG_IWLWIFI_DEBUG
+	u32 ofs = 0;
+
+	if (!(iwl_debug_level & level))
+		return;
+
+	while (len) {
+		print_hex_dump(KERN_DEBUG, "iwl data: ", DUMP_PREFIX_OFFSET,
+			       16, 1, p + ofs, len, 1);
+		ofs += 16;
+		len -= min(len, 16U);
+	}
+#endif
+}
+
 /*************** DMA-QUEUE-GENERAL-FUNCTIONS  *****
  * DMA services
  *
@@ -1819,7 +1836,7 @@ void iwl_report_frame(struct iwl_priv *priv,
 		}
 	}
 	if (print_dump)
-		printk_buf(IWL_DL_RX, data, length);
+		iwl_print_hex_dump(IWL_DL_RX, data, length);
 }
 #endif
 
@@ -2836,7 +2853,7 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
 		IWL_DEBUG_DROP("Station " MAC_FMT " not in station map. "
 			       "Defaulting to broadcast...\n",
 			       MAC_ARG(hdr->addr1));
-		printk_buf(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr));
+		iwl_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr));
 		return IWL_BROADCAST_ID;
 	}
 
@@ -3028,10 +3045,11 @@ static int iwl_tx_skb(struct iwl_priv *priv,
 		txq->need_update = 0;
 	}
 
-	printk_buf(IWL_DL_TX, out_cmd->cmd.payload, sizeof(out_cmd->cmd.tx));
+	iwl_print_hex_dump(IWL_DL_TX, out_cmd->cmd.payload,
+			   sizeof(out_cmd->cmd.tx));
 
-	printk_buf(IWL_DL_TX, (u8 *) out_cmd->cmd.tx.hdr,
-		   ieee80211_get_hdrlen(fc));
+	iwl_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr,
+			   ieee80211_get_hdrlen(fc));
 
 	iwl4965_tx_queue_update_wr_ptr(priv, txq, len);
 
@@ -3939,7 +3957,7 @@ static void iwl_rx_pm_debug_statistics_notif(struct iwl_priv *priv,
 	IWL_DEBUG_RADIO("Dumping %d bytes of unhandled "
 			"notification for %s:\n",
 			le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd));
-	printk_buf(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len));
+	iwl_print_hex_dump(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len));
 }
 
 static void iwl_rx_beacon_notif(struct iwl_priv *priv,
@@ -4762,7 +4780,7 @@ int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv,
 static void iwl_print_rx_config_cmd(struct iwl_rxon_cmd *rxon)
 {
 	IWL_DEBUG_RADIO("RX CONFIG:\n");
-	printk_buf(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon));
+	iwl_print_hex_dump(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon));
 	IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel));
 	IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags));
 	IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n",
@@ -8525,7 +8543,6 @@ static ssize_t show_measurement(struct device *d,
 {
 	struct iwl_priv *priv = dev_get_drvdata(d);
 	struct iwl_spectrum_notification measure_report;
-
 	u32 size = sizeof(measure_report), len = 0, ofs = 0;
 	u8 *data = (u8 *) & measure_report;
 	unsigned long flags;
@@ -8540,9 +8557,9 @@ static ssize_t show_measurement(struct device *d,
 	spin_unlock_irqrestore(&priv->lock, flags);
 
 	while (size && (PAGE_SIZE - len)) {
-		len +=
-		    snprint_line(&buf[len], PAGE_SIZE - len,
-				 &data[ofs], min(size, 16U), ofs);
+		hex_dump_to_buffer(data + ofs, size, 16, 1, buf + len,
+				   PAGE_SIZE - len, 1);
+		len = strlen(buf);
 		if (PAGE_SIZE - len)
 			buf[len++] = '\n';
 
@@ -8828,9 +8845,9 @@ static ssize_t show_statistics(struct device *d,
 	}
 
 	while (size && (PAGE_SIZE - len)) {
-		len +=
-		    snprint_line(&buf[len], PAGE_SIZE - len,
-				 &data[ofs], min(size, 16U), ofs);
+		hex_dump_to_buffer(data + ofs, size, 16, 1, buf + len,
+				   PAGE_SIZE - len, 1);
+		len = strlen(buf);
 		if (PAGE_SIZE - len)
 			buf[len++] = '\n';
 
diff --git a/drivers/net/wireless/iwl-helpers.h b/drivers/net/wireless/iwl-helpers.h
index 6ac119f..78b536e 100644
--- a/drivers/net/wireless/iwl-helpers.h
+++ b/drivers/net/wireless/iwl-helpers.h
@@ -287,25 +287,4 @@ static inline int snprint_line(char *buf, size_t count,
 	return out;
 }
 
-#ifdef CONFIG_IWLWIFI_DEBUG
-static inline void printk_buf(int level, const void *p, u32 len)
-{
-	const u8 *data = p;
-	char line[81];
-	u32 ofs = 0;
-	if (!(iwl_debug_level & level))
-		return;
-
-	while (len) {
-		snprint_line(line, sizeof(line), &data[ofs],
-			     min(len, 16U), ofs);
-		printk(KERN_DEBUG "%s\n", line);
-		ofs += 16;
-		len -= min(len, 16U);
-	}
-}
-#else
-#define printk_buf(level, p, len) do {} while (0)
-#endif
-
 #endif				/* __iwl_helpers_h__ */
-- 
1.5.2

  reply	other threads:[~2007-08-08  7:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <11865584251026-git-send-email-yi.zhu@intel.com>
2007-08-08  7:33 ` [PATCH 01/28] iwlwifi: fix a lot of checkpatch.pl warnings Zhu Yi
2007-08-08  7:33   ` [PATCH 02/28] iwlwifi: add more Kconfig options Zhu Yi
2007-08-08  7:33     ` [PATCH 03/28] iwlwifi: Endianity fix for 4965 rate scaling Zhu Yi
2007-08-08  7:33       ` [PATCH 04/28] iwlwifi: Endianity fix for 4965 rx chain selection Zhu Yi
2007-08-08  7:33         ` [PATCH 05/28] iwlwifi: optimize iwl_queue_{inc|dec}_wrap implementation Zhu Yi
2007-08-08  7:33           ` [PATCH 06/28] iwlwifi: use mask operation to replace '%' for index calculation Zhu Yi
2007-08-08  7:33             ` [PATCH 07/28] iwlwifi: make local functions static Zhu Yi
2007-08-08  7:33               ` [PATCH 08/28] iwlwifi: some coding styles cleanup Zhu Yi
2007-08-08  7:33                 ` [PATCH 09/28] iwlwifi: replace unnecessary GFP_ATOMIC with GFP_KERNEL Zhu Yi
2007-08-08  7:33                   ` [PATCH 10/28] iwlwifi: remove priv stuff zeroing in iwl_pci_probe Zhu Yi
2007-08-08  7:33                     ` [PATCH 11/28] iwlwifi: add name for some PCI configuration space registers Zhu Yi
2007-08-08  7:33                       ` [PATCH 12/28] iwlwifi: shorten some structure and function names Zhu Yi
2007-08-08  7:33                         ` [PATCH 13/28] iwlwifi: define iwl_rx_reply_scan only when CONFIG_IWLWIFI_DEBUG enabled Zhu Yi
2007-08-08  7:33                           ` [PATCH 14/28] iwlwifi: remove redundant quotes Zhu Yi
2007-08-08  7:33                             ` [PATCH 15/28] iwlwifi: Endianity fix for rxon host commands Zhu Yi
2007-08-08  7:33                               ` [PATCH 16/28] iwlwifi: Endianity fix for beacon host command Zhu Yi
2007-08-08  7:33                                 ` [PATCH 17/28] iwlwifi: Endianity fix for channel number Zhu Yi
2007-08-08  7:33                                   ` [PATCH 18/28] iwlwifi: shorten more function names Zhu Yi
2007-08-08  7:33                                     ` [PATCH 19/28] iwlwifi: make iwl_get_bits inline function from macro Zhu Yi
2007-08-08  7:33                                       ` [PATCH 20/28] iwlwifi: remove BIT_FMT and BIT_ARG Zhu Yi
2007-08-08  7:33                                         ` [PATCH 21/28] iwlwifi: remove WLAN_FC_GET_TYPE macros Zhu Yi
2007-08-08  7:33                                           ` Zhu Yi [this message]
2007-08-08  7:33                                             ` [PATCH 23/28] iwlwifi: Endianity fix for frame control Zhu Yi
2007-08-08  7:33                                               ` [PATCH 24/28] iwlwifi: Endianity fix for ct kill configuration Zhu Yi
2007-08-08  7:33                                                 ` [PATCH 25/28] iwlwifi: remove unused snprint_line Zhu Yi
2007-08-08  7:33                                                   ` [PATCH 26/28] iwlwifi: Enhance ISR/RX/CMD debug messages Zhu Yi
2007-08-08  7:33                                                     ` [PATCH 27/28] iwlwifi: Correct missing hardware detection in iwl_isr() Zhu Yi
2007-08-08  7:33                                                       ` [PATCH 28/28] iwlwifi: Streamline irq_tasklet() when ISR debug not used Zhu Yi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11865584771950-git-send-email-yi.zhu@intel.com \
    --to=yi.zhu@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).