Patchwork [08/18] atm: 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-9-git-send-email-wangkefeng.wang@huawei.com>
Download mbox | patch
Permalink /patch/283605/
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/atm/solos-pci.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

Patch

diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 32784d1..a4d20e9 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -807,8 +807,8 @@  void solos_bh(unsigned long card_arg)
 
 				skb = alloc_skb(size + 1, GFP_ATOMIC);
 				if (!skb) {
-					if (net_ratelimit())
-						dev_warn(&card->dev->dev, "Failed to allocate sk_buff for RX\n");
+					net_ratelimited_function(dev_warn, &card->dev->dev,
+						"Failed to allocate sk_buff for RX\n");
 					continue;
 				}
 
@@ -829,8 +829,8 @@  void solos_bh(unsigned long card_arg)
 				vcc = find_vcc(card->atmdev[port], le16_to_cpu(header->vpi),
 					       le16_to_cpu(header->vci));
 				if (!vcc) {
-					if (net_ratelimit())
-						dev_warn(&card->dev->dev, "Received packet for unknown VPI.VCI %d.%d on port %d\n",
+					net_ratelimited_function(dev_warn, &card->dev->dev,
+						"Received packet for unknown VPI.VCI %d.%d on port %d\n",
 							 le16_to_cpu(header->vpi), le16_to_cpu(header->vci),
 							 port);
 					dev_kfree_skb_any(skb);
@@ -856,9 +856,8 @@  void solos_bh(unsigned long card_arg)
 					break;
 				spin_lock(&card->cli_queue_lock);
 				if (skb_queue_len(&card->cli_queue[port]) > 10) {
-					if (net_ratelimit())
-						dev_warn(&card->dev->dev, "Dropping console response on port %d\n",
-							 port);
+					net_ratelimited_function(dev_warn, &card->dev->dev,
+						"Dropping console response on port %d\n", port);
 					dev_kfree_skb_any(skb);
 				} else
 					skb_queue_tail(&card->cli_queue[port], skb);
@@ -878,8 +877,7 @@  void solos_bh(unsigned long card_arg)
 					  card->config_regs + RX_DMA_ADDR(port));
 				card->rx_skb[port] = skb;
 			} else {
-				if (net_ratelimit())
-					dev_warn(&card->dev->dev, "Failed to allocate RX skb");
+				net_ratelimited_function(dev_warn, &card->dev->dev, "Failed to allocate RX skb");
 
 				/* We'll have to try again later */
 				tasklet_schedule(&card->tlet);
@@ -927,8 +925,8 @@  static int popen(struct atm_vcc *vcc)
 
 	skb = alloc_skb(sizeof(*header), GFP_KERNEL);
 	if (!skb) {
-		if (net_ratelimit())
-			dev_warn(&card->dev->dev, "Failed to allocate sk_buff in popen()\n");
+		net_ratelimited_function(dev_warn, &card->dev->dev,
+			"Failed to allocate sk_buff in popen()\n");
 		return -ENOMEM;
 	}
 	header = (void *)skb_put(skb, sizeof(*header));