staging: gdm72xx: replace printk() and debug macros with dynamic debugging
authorKristina Martšenko <kristina.martsenko@gmail.com>
Fri, 14 Mar 2014 23:10:05 +0000 (01:10 +0200)
committerPeter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Mon, 17 Mar 2014 02:53:58 +0000 (19:53 -0700)
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>
drivers/staging/gdm72xx/gdm_sdio.c
drivers/staging/gdm72xx/gdm_usb.c
drivers/staging/gdm72xx/gdm_wimax.c
drivers/staging/gdm72xx/gdm_wimax.h

index e469881..c246537 100644 (file)
@@ -38,8 +38,6 @@
 #define TX_HZ  2000
 #define TX_INTERVAL    (1000000/TX_HZ)
 
-/*#define DEBUG*/
-
 static int init_sdio(struct sdiowm_dev *sdev);
 static void release_sdio(struct sdiowm_dev *sdev);
 
@@ -457,14 +455,10 @@ static int control_sdu_tx_flow(struct sdiowm_dev *sdev, u8 *hci_data, int len)
                goto out;
 
        if (hci_data[4] == 0) {
-#ifdef DEBUG
-               printk(KERN_DEBUG "WIMAX ==> STOP SDU TX\n");
-#endif
+               dev_dbg(&sdev->func->dev, "WIMAX ==> STOP SDU TX\n");
                tx->stop_sdu_tx = 1;
        } else if (hci_data[4] == 1) {
-#ifdef DEBUG
-               printk(KERN_DEBUG "WIMAX ==> START SDU TX\n");
-#endif
+               dev_dbg(&sdev->func->dev, "WIMAX ==> START SDU TX\n");
                tx->stop_sdu_tx = 0;
                if (tx->can_send)
                        schedule_work(&sdev->ws);
@@ -515,18 +509,14 @@ static void gdm_sdio_irq(struct sdio_func *func)
        }
 
        if (hdr[3] == 1) {      /* Ack */
-#ifdef DEBUG
                u32 *ack_seq = (u32 *)&hdr[4];
-#endif
                spin_lock_irqsave(&tx->lock, flags);
                tx->can_send = 1;
 
                if (!list_empty(&tx->sdu_list) || !list_empty(&tx->hci_list))
                        schedule_work(&sdev->ws);
                spin_unlock_irqrestore(&tx->lock, flags);
-#ifdef DEBUG
-               printk(KERN_DEBUG "Ack... %0x\n", ntohl(*ack_seq));
-#endif
+               dev_dbg(&func->dev, "Ack... %0x\n", ntohl(*ack_seq));
                goto done;
        }
 
index ff0e573..20539d8 100644 (file)
@@ -55,8 +55,6 @@ static int k_mode_stop;
 static int init_usb(struct usbwm_dev *udev);
 static void release_usb(struct usbwm_dev *udev);
 
-/*#define DEBUG */
-
 static struct usb_tx *alloc_tx_struct(struct tx_cxt *tx)
 {
        struct usb_tx *t = kzalloc(sizeof(*t), GFP_ATOMIC);
@@ -423,10 +421,7 @@ static void gdm_usb_rcv_complete(struct urb *urb)
        struct usb_tx *t;
        u16 cmd_evt;
        unsigned long flags, flags2;
-
-#ifdef CONFIG_WIMAX_GDM72XX_USB_PM
        struct usb_device *dev = urb->dev;
-#endif
 
        /* Completion by usb_unlink_urb */
        if (urb->status == -ECONNRESET)
@@ -440,15 +435,11 @@ static void gdm_usb_rcv_complete(struct urb *urb)
                                     r->buf, urb->actual_length, false);
                if (cmd_evt == WIMAX_SDU_TX_FLOW) {
                        if (r->buf[4] == 0) {
-#ifdef DEBUG
-                               printk(KERN_DEBUG "WIMAX ==> STOP SDU TX\n");
-#endif
+                               dev_dbg(&dev->dev, "WIMAX ==> STOP SDU TX\n");
                                list_for_each_entry(t, &tx->sdu_list, list)
                                        usb_unlink_urb(t->urb);
                        } else if (r->buf[4] == 1) {
-#ifdef DEBUG
-                               printk(KERN_DEBUG "WIMAX ==> START SDU TX\n");
-#endif
+                               dev_dbg(&dev->dev, "WIMAX ==> START SDU TX\n");
                                list_for_each_entry(t, &tx->sdu_list, list) {
                                        usb_submit_urb(t->urb, GFP_ATOMIC);
                                }
index dd2d807..05ce2a2 100644 (file)
@@ -62,7 +62,6 @@ static u8 gdm_wimax_macaddr[6] = {0x00, 0x0a, 0x3b, 0xf0, 0x01, 0x30};
 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 const char *get_protocol_name(u16 protocol)
 {
        static char buf[32];
@@ -126,7 +125,8 @@ static const char *get_port_name(u16 port)
        return buf;
 }
 
-static void dump_eth_packet(const char *title, u8 *data, int len)
+static void dump_eth_packet(struct net_device *dev, const char *title,
+                           u8 *data, int len)
 {
        struct iphdr *ih = NULL;
        struct udphdr *uh = NULL;
@@ -148,7 +148,7 @@ static void dump_eth_packet(const char *title, u8 *data, int len)
                port = ntohs(uh->dest);
        }
 
-       printk(KERN_DEBUG "[%s] len=%d, %s, %s, %s\n",
+       netdev_dbg(dev, "[%s] len=%d, %s, %s, %s\n",
                title, len,
                get_protocol_name(protocol),
                get_ip_protocol_name(ip_protocol),
@@ -156,15 +156,13 @@ static void dump_eth_packet(const char *title, u8 *data, int len)
 
        if (!(data[0] == 0xff && data[1] == 0xff)) {
                if (protocol == ETH_P_IP)
-                       printk(KERN_DEBUG "     src=%pI4\n", &ih->saddr);
+                       netdev_dbg(dev, "     src=%pI4\n", &ih->saddr);
                else if (protocol == ETH_P_IPV6)
-                       printk(KERN_DEBUG "     src=%pI6\n", &ih->saddr);
+                       netdev_dbg(dev, "     src=%pI6\n", &ih->saddr);
        }
 
        print_hex_dump_debug("", DUMP_PREFIX_NONE, 16, 1, data, len, false);
 }
-#endif
-
 
 static inline int gdm_wimax_header(struct sk_buff **pskb)
 {
@@ -198,12 +196,10 @@ static void gdm_wimax_event_rcv(struct net_device *dev, u16 type, void *msg,
 {
        struct nic *nic = netdev_priv(dev);
 
-       #if defined(DEBUG_HCI)
        u8 *buf = (u8 *) msg;
        u16 hci_cmd =  (buf[0]<<8) | buf[1];
        u16 hci_len = (buf[2]<<8) | buf[3];
-       printk(KERN_DEBUG "H=>D: 0x%04x(%d)\n", hci_cmd, hci_len);
-       #endif
+       netdev_dbg(dev, "H=>D: 0x%04x(%d)\n", hci_cmd, hci_len);
 
        gdm_wimax_send(nic, msg, len);
 }
@@ -312,11 +308,9 @@ static int gdm_wimax_event_send(struct net_device *dev, char *buf, int size)
        struct evt_entry *e;
        unsigned long flags;
 
-       #if defined(DEBUG_HCI)
        u16 hci_cmd =  ((u8)buf[0]<<8) | (u8)buf[1];
        u16 hci_len = ((u8)buf[2]<<8) | (u8)buf[3];
-       printk(KERN_DEBUG "D=>H: 0x%04x(%d)\n", hci_cmd, hci_len);
-       #endif
+       netdev_dbg(dev, "D=>H: 0x%04x(%d)\n", hci_cmd, hci_len);
 
        spin_lock_irqsave(&wm_event.evt_lock, flags);
 
@@ -376,9 +370,7 @@ static int gdm_wimax_tx(struct sk_buff *skb, struct net_device *dev)
        struct nic *nic = netdev_priv(dev);
        struct fsm_s *fsm = (struct fsm_s *) nic->sdk_data[SIOC_DATA_FSM].buf;
 
-       #if defined(DEBUG_SDU)
-       dump_eth_packet("TX", skb->data, skb->len);
-       #endif
+       dump_eth_packet(dev, "TX", skb->data, skb->len);
 
        ret = gdm_wimax_header(&skb);
        if (ret < 0) {
@@ -717,9 +709,7 @@ static void gdm_wimax_netif_rx(struct net_device *dev, char *buf, int len)
        struct sk_buff *skb;
        int ret;
 
-       #if defined(DEBUG_SDU)
-       dump_eth_packet("RX", buf, len);
-       #endif
+       dump_eth_packet(dev, "RX", buf, len);
 
        skb = dev_alloc_skb(len + 2);
        if (!skb) {
index 7b603f8..1fcfc85 100644 (file)
@@ -62,10 +62,6 @@ struct nic {
 
 };
 
-/*#define DEBUG_SDU */
-
-/*#define DEBUG_HCI */
-
 /*#define LOOPBACK_TEST */
 
 extern int register_wimax_device(struct phy_dev *phy_dev, struct device *pdev);