From 8943a92fc257c439ffe55fb0f9896be57c58c56b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristina=20Mart=C5=A1enko?= Date: Sat, 15 Mar 2014 01:10:05 +0200 Subject: [PATCH] staging: gdm72xx: replace printk() and debug macros with dynamic debugging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Peter P Waskiewicz Jr --- drivers/staging/gdm72xx/gdm_sdio.c | 16 +++------------- drivers/staging/gdm72xx/gdm_usb.c | 13 ++----------- drivers/staging/gdm72xx/gdm_wimax.c | 28 +++++++++------------------- drivers/staging/gdm72xx/gdm_wimax.h | 4 ---- 4 files changed, 14 insertions(+), 47 deletions(-) diff --git a/drivers/staging/gdm72xx/gdm_sdio.c b/drivers/staging/gdm72xx/gdm_sdio.c index e469881cde83..c24653739e13 100644 --- a/drivers/staging/gdm72xx/gdm_sdio.c +++ b/drivers/staging/gdm72xx/gdm_sdio.c @@ -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; } diff --git a/drivers/staging/gdm72xx/gdm_usb.c b/drivers/staging/gdm72xx/gdm_usb.c index ff0e5737b6d0..20539d809397 100644 --- a/drivers/staging/gdm72xx/gdm_usb.c +++ b/drivers/staging/gdm72xx/gdm_usb.c @@ -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); } diff --git a/drivers/staging/gdm72xx/gdm_wimax.c b/drivers/staging/gdm72xx/gdm_wimax.c index dd2d807ada83..05ce2a22c220 100644 --- a/drivers/staging/gdm72xx/gdm_wimax.c +++ b/drivers/staging/gdm72xx/gdm_wimax.c @@ -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) { diff --git a/drivers/staging/gdm72xx/gdm_wimax.h b/drivers/staging/gdm72xx/gdm_wimax.h index 7b603f83a75f..1fcfc8555417 100644 --- a/drivers/staging/gdm72xx/gdm_wimax.h +++ b/drivers/staging/gdm72xx/gdm_wimax.h @@ -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); -- GitLab