Patchwork [10/18] net: peak_usb: use wrapper functions of net_ratelimit() to simplify code

login
register
mail settings
Submitter Kefeng Wang
Date Oct. 15, 2013, 11:45 a.m.
Message ID <1381837514-50660-11-git-send-email-wangkefeng.wang@huawei.com>
Download mbox | patch
Permalink /patch/283598/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Kefeng Wang - Oct. 15, 2013, 11:45 a.m.
net_ratelimited_function() is called to simplify code.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/net/can/usb/peak_usb/pcan_usb_core.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Patch

diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
index 0b7a4c3..5166a1f 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
@@ -191,8 +191,7 @@  static void peak_usb_read_bulk_callback(struct urb *urb)
 		return;
 
 	default:
-		if (net_ratelimit())
-			netdev_err(netdev,
+		net_ratelimited_function(netdev_err, netdev,
 				   "Rx urb aborted (%d)\n", urb->status);
 		goto resubmit_urb;
 	}
@@ -260,9 +259,8 @@  static void peak_usb_write_bulk_callback(struct urb *urb)
 		break;
 
 	default:
-		if (net_ratelimit())
-			netdev_err(netdev, "Tx urb aborted (%d)\n",
-				   urb->status);
+		net_ratelimited_function(netdev_err, netdev,
+			"Tx urb aborted (%d)\n", urb->status);
 	case -EPROTO:
 	case -ENOENT:
 	case -ECONNRESET:
@@ -314,8 +312,7 @@  static netdev_tx_t peak_usb_ndo_start_xmit(struct sk_buff *skb,
 
 	err = dev->adapter->dev_encode_msg(dev, skb, obuf, &size);
 	if (err) {
-		if (net_ratelimit())
-			netdev_err(netdev, "packet dropped\n");
+		net_ratelimited_function(netdev_err, netdev, "packet dropped\n");
 		dev_kfree_skb(skb);
 		stats->tx_dropped++;
 		return NETDEV_TX_OK;