From 4db02435652dad3233d347c0ba6d9dece8ff791a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristina=20Mart=C5=A1enko?= Date: Sat, 15 Mar 2014 01:10:04 +0200 Subject: [PATCH] staging: gdm72xx: use print_hex_dump_debug and remove debug macros MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Since the kernel already has a function for hex dumps, use that instead of the driver's own versions. The function supports dynamic debugging, so also remove some unnecessary debug macros. Signed-off-by: Kristina Martšenko Signed-off-by: Peter P Waskiewicz Jr --- drivers/staging/gdm72xx/gdm_sdio.c | 34 ++++++++----------------------- drivers/staging/gdm72xx/gdm_usb.c | 24 ++++------------------ drivers/staging/gdm72xx/gdm_wimax.c | 40 +------------------------------------ drivers/staging/gdm72xx/gdm_wimax.h | 16 --------------- 4 files changed, 13 insertions(+), 101 deletions(-) diff --git a/drivers/staging/gdm72xx/gdm_sdio.c b/drivers/staging/gdm72xx/gdm_sdio.c index 047a4d7..e469881 100644 --- a/drivers/staging/gdm72xx/gdm_sdio.c +++ b/drivers/staging/gdm72xx/gdm_sdio.c @@ -43,21 +43,6 @@ static int init_sdio(struct sdiowm_dev *sdev); static void release_sdio(struct sdiowm_dev *sdev); -#ifdef DEBUG -static void hexdump(char *title, u8 *data, int len) -{ - int i; - - printk(KERN_DEBUG "%s: length = %d\n", title, len); - for (i = 0; i < len; i++) { - printk(KERN_DEBUG "%02x ", data[i]); - if ((i & 0xf) == 0xf) - printk(KERN_DEBUG "\n"); - } - printk(KERN_DEBUG "\n"); -} -#endif - static struct sdio_tx *alloc_tx_struct(struct tx_cxt *tx) { struct sdio_tx *t = kzalloc(sizeof(*t), GFP_ATOMIC); @@ -297,10 +282,9 @@ static void send_sdu(struct sdio_func *func, struct tx_cxt *tx) spin_unlock_irqrestore(&tx->lock, flags); -#ifdef DEBUG - hexdump("sdio_send", tx->sdu_buf + TYPE_A_HEADER_SIZE, - aggr_len - TYPE_A_HEADER_SIZE); -#endif + print_hex_dump_debug("sdio_send: ", DUMP_PREFIX_NONE, 16, 1, + tx->sdu_buf + TYPE_A_HEADER_SIZE, + aggr_len - TYPE_A_HEADER_SIZE, false); for (pos = TYPE_A_HEADER_SIZE; pos < aggr_len; pos += TX_CHUNK_SIZE) { len = aggr_len - pos; @@ -335,10 +319,9 @@ static void send_hci(struct sdio_func *func, struct tx_cxt *tx, { unsigned long flags; -#ifdef DEBUG - hexdump("sdio_send", t->buf + TYPE_A_HEADER_SIZE, - t->len - TYPE_A_HEADER_SIZE); -#endif + print_hex_dump_debug("sdio_send: ", DUMP_PREFIX_NONE, 16, 1, + t->buf + TYPE_A_HEADER_SIZE, + t->len - TYPE_A_HEADER_SIZE, false); send_sdio_pkt(func, t->buf, t->len); spin_lock_irqsave(&tx->lock, flags); @@ -579,9 +562,8 @@ static void gdm_sdio_irq(struct sdio_func *func) } end_io: -#ifdef DEBUG - hexdump("sdio_receive", rx->rx_buf, len); -#endif + print_hex_dump_debug("sdio_receive: ", DUMP_PREFIX_NONE, 16, 1, + rx->rx_buf, len, false); len = control_sdu_tx_flow(sdev, rx->rx_buf, len); spin_lock_irqsave(&rx->lock, flags); diff --git a/drivers/staging/gdm72xx/gdm_usb.c b/drivers/staging/gdm72xx/gdm_usb.c index cdeffe7..ff0e573 100644 --- a/drivers/staging/gdm72xx/gdm_usb.c +++ b/drivers/staging/gdm72xx/gdm_usb.c @@ -56,20 +56,6 @@ static int init_usb(struct usbwm_dev *udev); static void release_usb(struct usbwm_dev *udev); /*#define DEBUG */ -#ifdef DEBUG -static void hexdump(char *title, u8 *data, int len) -{ - int i; - - printk(KERN_DEBUG "%s: length = %d\n", title, len); - for (i = 0; i < len; i++) { - printk(KERN_DEBUG "%02x ", data[i]); - if ((i & 0xf) == 0xf) - printk(KERN_DEBUG "\n"); - } - printk(KERN_DEBUG "\n"); -} -#endif static struct usb_tx *alloc_tx_struct(struct tx_cxt *tx) { @@ -368,9 +354,8 @@ static int gdm_usb_send(void *priv_dev, void *data, int len, gdm_usb_send_complete, t); -#ifdef DEBUG - hexdump("usb_send", t->buf, len + padding); -#endif + print_hex_dump_debug("usb_send: ", DUMP_PREFIX_NONE, 16, 1, + t->buf, len + padding, false); #ifdef CONFIG_WIMAX_GDM72XX_USB_PM if (usbdev->state & USB_STATE_SUSPENDED) { list_add_tail(&t->p_list, &tx->pending_list); @@ -451,9 +436,8 @@ static void gdm_usb_rcv_complete(struct urb *urb) if (!urb->status) { cmd_evt = (r->buf[0] << 8) | (r->buf[1]); -#ifdef DEBUG - hexdump("usb_receive", r->buf, urb->actual_length); -#endif + print_hex_dump_debug("usb_receive: ", DUMP_PREFIX_NONE, 16, 1, + r->buf, urb->actual_length, false); if (cmd_evt == WIMAX_SDU_TX_FLOW) { if (r->buf[4] == 0) { #ifdef DEBUG diff --git a/drivers/staging/gdm72xx/gdm_wimax.c b/drivers/staging/gdm72xx/gdm_wimax.c index df93a73..dd2d807 100644 --- a/drivers/staging/gdm72xx/gdm_wimax.c +++ b/drivers/staging/gdm72xx/gdm_wimax.c @@ -63,20 +63,6 @@ static void gdm_wimax_ind_fsm_update(struct net_device *dev, struct fsm_s *fsm); static void gdm_wimax_ind_if_updown(struct net_device *dev, int if_up); #if defined(DEBUG_SDU) -static void printk_hex(u8 *buf, u32 size) -{ - int i; - - for (i = 0; i < size; i++) { - if (i && i % 16 == 0) - printk(KERN_DEBUG "\n%02x ", *buf++); - else - printk(KERN_DEBUG "%02x ", *buf++); - } - - printk(KERN_DEBUG "\n"); -} - static const char *get_protocol_name(u16 protocol) { static char buf[32]; @@ -175,31 +161,7 @@ static void dump_eth_packet(const char *title, u8 *data, int len) printk(KERN_DEBUG " src=%pI6\n", &ih->saddr); } - #if (DUMP_PACKET & DUMP_SDU_ALL) - printk_hex(data, len); - #else - #if (DUMP_PACKET & DUMP_SDU_ARP) - if (protocol == ETH_P_ARP) - printk_hex(data, len); - #endif - #if (DUMP_PACKET & DUMP_SDU_IP) - if (protocol == ETH_P_IP || protocol == ETH_P_IPV6) - printk_hex(data, len); - #else - #if (DUMP_PACKET & DUMP_SDU_IP_TCP) - if (ip_protocol == IPPROTO_TCP) - printk_hex(data, len); - #endif - #if (DUMP_PACKET & DUMP_SDU_IP_UDP) - if (ip_protocol == IPPROTO_UDP) - printk_hex(data, len); - #endif - #if (DUMP_PACKET & DUMP_SDU_IP_ICMP) - if (ip_protocol == IPPROTO_ICMP) - printk_hex(data, len); - #endif - #endif - #endif + print_hex_dump_debug("", DUMP_PREFIX_NONE, 16, 1, data, len, false); } #endif diff --git a/drivers/staging/gdm72xx/gdm_wimax.h b/drivers/staging/gdm72xx/gdm_wimax.h index 6ec0ab4..7b603f8 100644 --- a/drivers/staging/gdm72xx/gdm_wimax.h +++ b/drivers/staging/gdm72xx/gdm_wimax.h @@ -62,23 +62,7 @@ struct nic { }; - -#if 0 -#define dprintk(fmt, args ...) printk(KERN_DEBUG " [GDM] " fmt, ## args) -#else -#define dprintk(...) -#endif - /*#define DEBUG_SDU */ -#if defined(DEBUG_SDU) -#define DUMP_SDU_ALL (1<<0) -#define DUMP_SDU_ARP (1<<1) -#define DUMP_SDU_IP (1<<2) -#define DUMP_SDU_IP_TCP (1<<8) -#define DUMP_SDU_IP_UDP (1<<9) -#define DUMP_SDU_IP_ICMP (1<<10) -#define DUMP_PACKET (DUMP_SDU_ALL) -#endif /*#define DEBUG_HCI */ -- 2.7.4