From patchwork Mon Dec 13 14:43:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changli Gao X-Patchwork-Id: 75360 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41A1AB6F11 for ; Tue, 14 Dec 2010 01:44:19 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753652Ab0LMOoO (ORCPT ); Mon, 13 Dec 2010 09:44:14 -0500 Received: from mail-yx0-f174.google.com ([209.85.213.174]:53375 "EHLO mail-yx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752918Ab0LMOoN (ORCPT ); Mon, 13 Dec 2010 09:44:13 -0500 Received: by mail-yx0-f174.google.com with SMTP id 3so3282598yxt.19 for ; Mon, 13 Dec 2010 06:44:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=ldaCEhJfejk6QbP573nyEgBZOw+RmwTyRM0XQiH7AQo=; b=EQR7mKk9x/zkwg/c3hbo6+cakv0q6+zgihuOT0273egLuiYURt+yIvdCbNY2PirZZk e91XIRvPtTge9sJ9JJYSNoekFUtOnX7dfGjWfPU/Kye1Oxga9xFz6RhqIa12ty3tfjpr Et+TZN2LQvb7zvDN6Bu9/yUK0jAubpnN0/Xs8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=jskr2CJ2WiLhRkbpVfdI5TUqZUEm9a7KxNGHcTnHG414zbSRz0+DkxAEqQOolP6xSh M0BCSXNigfmxV/C7QGU8gBtFXNJ3sJsM8TSnqWoFH+OUjyRZsTIIWzgrr3DGJrqf9krH wYFYBI0Y5s0qZ2V/stRUevgi67JTsY4Qsy7Cs= Received: by 10.150.11.16 with SMTP id 16mr6164148ybk.272.1292251453320; Mon, 13 Dec 2010 06:44:13 -0800 (PST) Received: from localhost.localdomain ([221.239.34.230]) by mx.google.com with ESMTPS id l4sm2520938ybj.21.2010.12.13.06.44.07 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 13 Dec 2010 06:44:12 -0800 (PST) From: Changli Gao To: Jamal Hadi Salim Cc: "David S. Miller" , netdev@vger.kernel.org, Changli Gao Subject: [PATCH 2/5] ifb: code cleanup Date: Mon, 13 Dec 2010 22:43:31 +0800 Message-Id: <1292251414-5154-2-git-send-email-xiaosuo@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1292251414-5154-1-git-send-email-xiaosuo@gmail.com> References: <1292251414-5154-1-git-send-email-xiaosuo@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Clean up code according to scripts/checkpatch.pl Signed-off-by: Changli Gao Signed-off-by: Jamal Hadi Salim --- drivers/net/ifb.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index 0667a61..1628d01 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c @@ -15,14 +15,14 @@ by Patrick McHardy and then maintained by Andre Correa. You need the tc action mirror or redirect to feed this device - packets. + packets. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - Authors: Jamal Hadi Salim (2005) + Authors: Jamal Hadi Salim (2005) */ @@ -56,7 +56,8 @@ static void ri_tasklet(unsigned long dev) struct sk_buff *skb; txq = netdev_get_tx_queue(_dev, 0); - if ((skb = skb_peek(&dp->tq)) == NULL) { + skb = skb_peek(&dp->tq); + if (skb == NULL) { if (__netif_tx_trylock(txq)) { skb_queue_splice_tail_init(&dp->rq, &dp->tq); __netif_tx_unlock(txq); @@ -72,7 +73,7 @@ static void ri_tasklet(unsigned long dev) skb->tc_verd = 0; skb->tc_verd = SET_TC_NCLS(skb->tc_verd); stats->tx_packets++; - stats->tx_bytes +=skb->len; + stats->tx_bytes += skb->len; rcu_read_lock(); skb->dev = dev_get_by_index_rcu(&init_net, skb->skb_iif); @@ -97,7 +98,8 @@ static void ri_tasklet(unsigned long dev) } if (__netif_tx_trylock(txq)) { - if ((skb = skb_peek(&dp->rq)) == NULL) { + skb = skb_peek(&dp->rq); + if (skb == NULL) { dp->tasklet_pending = 0; if (netif_queue_stopped(_dev)) netif_wake_queue(_dev); @@ -121,7 +123,7 @@ static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev) u32 from = G_TC_FROM(skb->tc_verd); stats->rx_packets++; - stats->rx_bytes+=skb->len; + stats->rx_bytes += skb->len; if (!(from & (AT_INGRESS|AT_EGRESS)) || !skb->skb_iif) { dev_kfree_skb(skb); @@ -129,9 +131,8 @@ static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev) return NETDEV_TX_OK; } - if (skb_queue_len(&dp->rq) >= dev->tx_queue_len) { + if (skb_queue_len(&dp->rq) >= dev->tx_queue_len) netif_stop_queue(dev); - } __skb_queue_tail(&dp->rq, skb); if (!dp->tasklet_pending) { @@ -150,6 +151,7 @@ static int ifb_close(struct net_device *dev) netif_stop_queue(dev); __skb_queue_purge(&dp->rq); __skb_queue_purge(&dp->tq); + return 0; } @@ -196,6 +198,7 @@ static int ifb_validate(struct nlattr *tb[], struct nlattr *data[]) if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS]))) return -EADDRNOTAVAIL; } + return 0; } @@ -215,8 +218,7 @@ static int __init ifb_init_one(int index) struct net_device *dev_ifb; int err; - dev_ifb = alloc_netdev(sizeof(struct ifb_private), - "ifb%d", ifb_setup); + dev_ifb = alloc_netdev(sizeof(struct ifb_private), "ifb%d", ifb_setup); if (!dev_ifb) return -ENOMEM;