Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: gdm72xx: use print_hex_dump_debug and remove debug macros

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 <kristina.martsenko@gmail.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>

authored by

Kristina Martšenko and committed by
Peter P Waskiewicz Jr
4db02435 35db0350

+13 -101
+8 -26
drivers/staging/gdm72xx/gdm_sdio.c
··· 43 43 static int init_sdio(struct sdiowm_dev *sdev); 44 44 static void release_sdio(struct sdiowm_dev *sdev); 45 45 46 - #ifdef DEBUG 47 - static void hexdump(char *title, u8 *data, int len) 48 - { 49 - int i; 50 - 51 - printk(KERN_DEBUG "%s: length = %d\n", title, len); 52 - for (i = 0; i < len; i++) { 53 - printk(KERN_DEBUG "%02x ", data[i]); 54 - if ((i & 0xf) == 0xf) 55 - printk(KERN_DEBUG "\n"); 56 - } 57 - printk(KERN_DEBUG "\n"); 58 - } 59 - #endif 60 - 61 46 static struct sdio_tx *alloc_tx_struct(struct tx_cxt *tx) 62 47 { 63 48 struct sdio_tx *t = kzalloc(sizeof(*t), GFP_ATOMIC); ··· 282 297 283 298 spin_unlock_irqrestore(&tx->lock, flags); 284 299 285 - #ifdef DEBUG 286 - hexdump("sdio_send", tx->sdu_buf + TYPE_A_HEADER_SIZE, 287 - aggr_len - TYPE_A_HEADER_SIZE); 288 - #endif 300 + print_hex_dump_debug("sdio_send: ", DUMP_PREFIX_NONE, 16, 1, 301 + tx->sdu_buf + TYPE_A_HEADER_SIZE, 302 + aggr_len - TYPE_A_HEADER_SIZE, false); 289 303 290 304 for (pos = TYPE_A_HEADER_SIZE; pos < aggr_len; pos += TX_CHUNK_SIZE) { 291 305 len = aggr_len - pos; ··· 319 335 { 320 336 unsigned long flags; 321 337 322 - #ifdef DEBUG 323 - hexdump("sdio_send", t->buf + TYPE_A_HEADER_SIZE, 324 - t->len - TYPE_A_HEADER_SIZE); 325 - #endif 338 + print_hex_dump_debug("sdio_send: ", DUMP_PREFIX_NONE, 16, 1, 339 + t->buf + TYPE_A_HEADER_SIZE, 340 + t->len - TYPE_A_HEADER_SIZE, false); 326 341 send_sdio_pkt(func, t->buf, t->len); 327 342 328 343 spin_lock_irqsave(&tx->lock, flags); ··· 562 579 } 563 580 564 581 end_io: 565 - #ifdef DEBUG 566 - hexdump("sdio_receive", rx->rx_buf, len); 567 - #endif 582 + print_hex_dump_debug("sdio_receive: ", DUMP_PREFIX_NONE, 16, 1, 583 + rx->rx_buf, len, false); 568 584 len = control_sdu_tx_flow(sdev, rx->rx_buf, len); 569 585 570 586 spin_lock_irqsave(&rx->lock, flags);
+4 -20
drivers/staging/gdm72xx/gdm_usb.c
··· 56 56 static void release_usb(struct usbwm_dev *udev); 57 57 58 58 /*#define DEBUG */ 59 - #ifdef DEBUG 60 - static void hexdump(char *title, u8 *data, int len) 61 - { 62 - int i; 63 - 64 - printk(KERN_DEBUG "%s: length = %d\n", title, len); 65 - for (i = 0; i < len; i++) { 66 - printk(KERN_DEBUG "%02x ", data[i]); 67 - if ((i & 0xf) == 0xf) 68 - printk(KERN_DEBUG "\n"); 69 - } 70 - printk(KERN_DEBUG "\n"); 71 - } 72 - #endif 73 59 74 60 static struct usb_tx *alloc_tx_struct(struct tx_cxt *tx) 75 61 { ··· 354 368 gdm_usb_send_complete, 355 369 t); 356 370 357 - #ifdef DEBUG 358 - hexdump("usb_send", t->buf, len + padding); 359 - #endif 371 + print_hex_dump_debug("usb_send: ", DUMP_PREFIX_NONE, 16, 1, 372 + t->buf, len + padding, false); 360 373 #ifdef CONFIG_WIMAX_GDM72XX_USB_PM 361 374 if (usbdev->state & USB_STATE_SUSPENDED) { 362 375 list_add_tail(&t->p_list, &tx->pending_list); ··· 436 451 437 452 if (!urb->status) { 438 453 cmd_evt = (r->buf[0] << 8) | (r->buf[1]); 439 - #ifdef DEBUG 440 - hexdump("usb_receive", r->buf, urb->actual_length); 441 - #endif 454 + print_hex_dump_debug("usb_receive: ", DUMP_PREFIX_NONE, 16, 1, 455 + r->buf, urb->actual_length, false); 442 456 if (cmd_evt == WIMAX_SDU_TX_FLOW) { 443 457 if (r->buf[4] == 0) { 444 458 #ifdef DEBUG
+1 -39
drivers/staging/gdm72xx/gdm_wimax.c
··· 63 63 static void gdm_wimax_ind_if_updown(struct net_device *dev, int if_up); 64 64 65 65 #if defined(DEBUG_SDU) 66 - static void printk_hex(u8 *buf, u32 size) 67 - { 68 - int i; 69 - 70 - for (i = 0; i < size; i++) { 71 - if (i && i % 16 == 0) 72 - printk(KERN_DEBUG "\n%02x ", *buf++); 73 - else 74 - printk(KERN_DEBUG "%02x ", *buf++); 75 - } 76 - 77 - printk(KERN_DEBUG "\n"); 78 - } 79 - 80 66 static const char *get_protocol_name(u16 protocol) 81 67 { 82 68 static char buf[32]; ··· 161 175 printk(KERN_DEBUG " src=%pI6\n", &ih->saddr); 162 176 } 163 177 164 - #if (DUMP_PACKET & DUMP_SDU_ALL) 165 - printk_hex(data, len); 166 - #else 167 - #if (DUMP_PACKET & DUMP_SDU_ARP) 168 - if (protocol == ETH_P_ARP) 169 - printk_hex(data, len); 170 - #endif 171 - #if (DUMP_PACKET & DUMP_SDU_IP) 172 - if (protocol == ETH_P_IP || protocol == ETH_P_IPV6) 173 - printk_hex(data, len); 174 - #else 175 - #if (DUMP_PACKET & DUMP_SDU_IP_TCP) 176 - if (ip_protocol == IPPROTO_TCP) 177 - printk_hex(data, len); 178 - #endif 179 - #if (DUMP_PACKET & DUMP_SDU_IP_UDP) 180 - if (ip_protocol == IPPROTO_UDP) 181 - printk_hex(data, len); 182 - #endif 183 - #if (DUMP_PACKET & DUMP_SDU_IP_ICMP) 184 - if (ip_protocol == IPPROTO_ICMP) 185 - printk_hex(data, len); 186 - #endif 187 - #endif 188 - #endif 178 + print_hex_dump_debug("", DUMP_PREFIX_NONE, 16, 1, data, len, false); 189 179 } 190 180 #endif 191 181
-16
drivers/staging/gdm72xx/gdm_wimax.h
··· 62 62 63 63 }; 64 64 65 - 66 - #if 0 67 - #define dprintk(fmt, args ...) printk(KERN_DEBUG " [GDM] " fmt, ## args) 68 - #else 69 - #define dprintk(...) 70 - #endif 71 - 72 65 /*#define DEBUG_SDU */ 73 - #if defined(DEBUG_SDU) 74 - #define DUMP_SDU_ALL (1<<0) 75 - #define DUMP_SDU_ARP (1<<1) 76 - #define DUMP_SDU_IP (1<<2) 77 - #define DUMP_SDU_IP_TCP (1<<8) 78 - #define DUMP_SDU_IP_UDP (1<<9) 79 - #define DUMP_SDU_IP_ICMP (1<<10) 80 - #define DUMP_PACKET (DUMP_SDU_ALL) 81 - #endif 82 66 83 67 /*#define DEBUG_HCI */ 84 68