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

staging: gdm72xx: replace printk() and debug macros with dynamic debugging

Replace printk(KERN_DEBUG ...) with netdev_dbg and dev_dbg. Remove
debug macros which become unnecessary.

This removes the following types of checkpatch warnings from the driver:
drivers/staging/gdm72xx/gdm_sdio.c:461: WARNING: Prefer netdev_dbg(netdev, ... then dev_dbg(dev, ... then pr_debug(... to printk(KERN_DEBUG ...

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
8943a92f 4db02435

+14 -47
+3 -13
drivers/staging/gdm72xx/gdm_sdio.c
··· 38 38 #define TX_HZ 2000 39 39 #define TX_INTERVAL (1000000/TX_HZ) 40 40 41 - /*#define DEBUG*/ 42 - 43 41 static int init_sdio(struct sdiowm_dev *sdev); 44 42 static void release_sdio(struct sdiowm_dev *sdev); 45 43 ··· 455 457 goto out; 456 458 457 459 if (hci_data[4] == 0) { 458 - #ifdef DEBUG 459 - printk(KERN_DEBUG "WIMAX ==> STOP SDU TX\n"); 460 - #endif 460 + dev_dbg(&sdev->func->dev, "WIMAX ==> STOP SDU TX\n"); 461 461 tx->stop_sdu_tx = 1; 462 462 } else if (hci_data[4] == 1) { 463 - #ifdef DEBUG 464 - printk(KERN_DEBUG "WIMAX ==> START SDU TX\n"); 465 - #endif 463 + dev_dbg(&sdev->func->dev, "WIMAX ==> START SDU TX\n"); 466 464 tx->stop_sdu_tx = 0; 467 465 if (tx->can_send) 468 466 schedule_work(&sdev->ws); ··· 509 515 } 510 516 511 517 if (hdr[3] == 1) { /* Ack */ 512 - #ifdef DEBUG 513 518 u32 *ack_seq = (u32 *)&hdr[4]; 514 - #endif 515 519 spin_lock_irqsave(&tx->lock, flags); 516 520 tx->can_send = 1; 517 521 518 522 if (!list_empty(&tx->sdu_list) || !list_empty(&tx->hci_list)) 519 523 schedule_work(&sdev->ws); 520 524 spin_unlock_irqrestore(&tx->lock, flags); 521 - #ifdef DEBUG 522 - printk(KERN_DEBUG "Ack... %0x\n", ntohl(*ack_seq)); 523 - #endif 525 + dev_dbg(&func->dev, "Ack... %0x\n", ntohl(*ack_seq)); 524 526 goto done; 525 527 } 526 528
+2 -11
drivers/staging/gdm72xx/gdm_usb.c
··· 55 55 static int init_usb(struct usbwm_dev *udev); 56 56 static void release_usb(struct usbwm_dev *udev); 57 57 58 - /*#define DEBUG */ 59 - 60 58 static struct usb_tx *alloc_tx_struct(struct tx_cxt *tx) 61 59 { 62 60 struct usb_tx *t = kzalloc(sizeof(*t), GFP_ATOMIC); ··· 421 423 struct usb_tx *t; 422 424 u16 cmd_evt; 423 425 unsigned long flags, flags2; 424 - 425 - #ifdef CONFIG_WIMAX_GDM72XX_USB_PM 426 426 struct usb_device *dev = urb->dev; 427 - #endif 428 427 429 428 /* Completion by usb_unlink_urb */ 430 429 if (urb->status == -ECONNRESET) ··· 435 440 r->buf, urb->actual_length, false); 436 441 if (cmd_evt == WIMAX_SDU_TX_FLOW) { 437 442 if (r->buf[4] == 0) { 438 - #ifdef DEBUG 439 - printk(KERN_DEBUG "WIMAX ==> STOP SDU TX\n"); 440 - #endif 443 + dev_dbg(&dev->dev, "WIMAX ==> STOP SDU TX\n"); 441 444 list_for_each_entry(t, &tx->sdu_list, list) 442 445 usb_unlink_urb(t->urb); 443 446 } else if (r->buf[4] == 1) { 444 - #ifdef DEBUG 445 - printk(KERN_DEBUG "WIMAX ==> START SDU TX\n"); 446 - #endif 447 + dev_dbg(&dev->dev, "WIMAX ==> START SDU TX\n"); 447 448 list_for_each_entry(t, &tx->sdu_list, list) { 448 449 usb_submit_urb(t->urb, GFP_ATOMIC); 449 450 }
+9 -19
drivers/staging/gdm72xx/gdm_wimax.c
··· 62 62 static void gdm_wimax_ind_fsm_update(struct net_device *dev, struct fsm_s *fsm); 63 63 static void gdm_wimax_ind_if_updown(struct net_device *dev, int if_up); 64 64 65 - #if defined(DEBUG_SDU) 66 65 static const char *get_protocol_name(u16 protocol) 67 66 { 68 67 static char buf[32]; ··· 125 126 return buf; 126 127 } 127 128 128 - static void dump_eth_packet(const char *title, u8 *data, int len) 129 + static void dump_eth_packet(struct net_device *dev, const char *title, 130 + u8 *data, int len) 129 131 { 130 132 struct iphdr *ih = NULL; 131 133 struct udphdr *uh = NULL; ··· 148 148 port = ntohs(uh->dest); 149 149 } 150 150 151 - printk(KERN_DEBUG "[%s] len=%d, %s, %s, %s\n", 151 + netdev_dbg(dev, "[%s] len=%d, %s, %s, %s\n", 152 152 title, len, 153 153 get_protocol_name(protocol), 154 154 get_ip_protocol_name(ip_protocol), ··· 156 156 157 157 if (!(data[0] == 0xff && data[1] == 0xff)) { 158 158 if (protocol == ETH_P_IP) 159 - printk(KERN_DEBUG " src=%pI4\n", &ih->saddr); 159 + netdev_dbg(dev, " src=%pI4\n", &ih->saddr); 160 160 else if (protocol == ETH_P_IPV6) 161 - printk(KERN_DEBUG " src=%pI6\n", &ih->saddr); 161 + netdev_dbg(dev, " src=%pI6\n", &ih->saddr); 162 162 } 163 163 164 164 print_hex_dump_debug("", DUMP_PREFIX_NONE, 16, 1, data, len, false); 165 165 } 166 - #endif 167 - 168 166 169 167 static inline int gdm_wimax_header(struct sk_buff **pskb) 170 168 { ··· 196 198 { 197 199 struct nic *nic = netdev_priv(dev); 198 200 199 - #if defined(DEBUG_HCI) 200 201 u8 *buf = (u8 *) msg; 201 202 u16 hci_cmd = (buf[0]<<8) | buf[1]; 202 203 u16 hci_len = (buf[2]<<8) | buf[3]; 203 - printk(KERN_DEBUG "H=>D: 0x%04x(%d)\n", hci_cmd, hci_len); 204 - #endif 204 + netdev_dbg(dev, "H=>D: 0x%04x(%d)\n", hci_cmd, hci_len); 205 205 206 206 gdm_wimax_send(nic, msg, len); 207 207 } ··· 308 312 struct evt_entry *e; 309 313 unsigned long flags; 310 314 311 - #if defined(DEBUG_HCI) 312 315 u16 hci_cmd = ((u8)buf[0]<<8) | (u8)buf[1]; 313 316 u16 hci_len = ((u8)buf[2]<<8) | (u8)buf[3]; 314 - printk(KERN_DEBUG "D=>H: 0x%04x(%d)\n", hci_cmd, hci_len); 315 - #endif 317 + netdev_dbg(dev, "D=>H: 0x%04x(%d)\n", hci_cmd, hci_len); 316 318 317 319 spin_lock_irqsave(&wm_event.evt_lock, flags); 318 320 ··· 370 376 struct nic *nic = netdev_priv(dev); 371 377 struct fsm_s *fsm = (struct fsm_s *) nic->sdk_data[SIOC_DATA_FSM].buf; 372 378 373 - #if defined(DEBUG_SDU) 374 - dump_eth_packet("TX", skb->data, skb->len); 375 - #endif 379 + dump_eth_packet(dev, "TX", skb->data, skb->len); 376 380 377 381 ret = gdm_wimax_header(&skb); 378 382 if (ret < 0) { ··· 709 717 struct sk_buff *skb; 710 718 int ret; 711 719 712 - #if defined(DEBUG_SDU) 713 - dump_eth_packet("RX", buf, len); 714 - #endif 720 + dump_eth_packet(dev, "RX", buf, len); 715 721 716 722 skb = dev_alloc_skb(len + 2); 717 723 if (!skb) {
-4
drivers/staging/gdm72xx/gdm_wimax.h
··· 62 62 63 63 }; 64 64 65 - /*#define DEBUG_SDU */ 66 - 67 - /*#define DEBUG_HCI */ 68 - 69 65 /*#define LOOPBACK_TEST */ 70 66 71 67 extern int register_wimax_device(struct phy_dev *phy_dev, struct device *pdev);