netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: David Miller <davem@davemloft.net>, Neil Horman <nhorman@tuxdriver.com>
Cc: Jiri Pirko <jiri@resnulli.us>, Jay Vosburgh <fubar@us.ibm.com>,
	Andy Gospodarek <andy@greyhouse.net>,
	netdev@vger.kernel.org
Subject: [PATCH 1/3 net-next] bridge: cleanup netpoll code
Date: Wed, 24 Jul 2013 11:51:41 -0700	[thread overview]
Message-ID: <20130724115141.63bba894@nehalam.linuxnetplumber.net> (raw)

This started out with fixing a sparse warning, then I realized that
the wrapper function br_netpoll_info could just be collapsed away
by rolling it into the enable code.

Also, eliminate unnecessary goto's

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

--- a/net/bridge/br_private.h	2013-07-24 08:34:05.289987225 -0700
+++ b/net/bridge/br_private.h	2013-07-24 08:34:09.581940104 -0700
@@ -333,11 +333,6 @@ extern void br_dev_delete(struct net_dev
 extern netdev_tx_t br_dev_xmit(struct sk_buff *skb,
 			       struct net_device *dev);
 #ifdef CONFIG_NET_POLL_CONTROLLER
-static inline struct netpoll_info *br_netpoll_info(struct net_bridge *br)
-{
-	return br->dev->npinfo;
-}
-
 static inline void br_netpoll_send_skb(const struct net_bridge_port *p,
 				       struct sk_buff *skb)
 {
@@ -350,11 +345,6 @@ static inline void br_netpoll_send_skb(c
 extern int br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp);
 extern void br_netpoll_disable(struct net_bridge_port *p);
 #else
-static inline struct netpoll_info *br_netpoll_info(struct net_bridge *br)
-{
-	return NULL;
-}
-
 static inline void br_netpoll_send_skb(const struct net_bridge_port *p,
 				       struct sk_buff *skb)
 {
--- a/net/bridge/br_device.c	2013-07-24 08:34:05.289987225 -0700
+++ b/net/bridge/br_device.c	2013-07-24 08:34:09.581940104 -0700
@@ -244,22 +244,22 @@ fail:
 int br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp)
 {
 	struct netpoll *np;
-	int err = 0;
+	int err;
+
+	if (!p->br->dev->npinfo)
+		return 0;
 
 	np = kzalloc(sizeof(*p->np), gfp);
-	err = -ENOMEM;
 	if (!np)
-		goto out;
+		return -ENOMEM;
 
 	err = __netpoll_setup(np, p->dev, gfp);
 	if (err) {
 		kfree(np);
-		goto out;
+		return err;
 	}
 
 	p->np = np;
-
-out:
 	return err;
 }
 
--- a/net/bridge/br_if.c	2013-07-24 08:34:05.289987225 -0700
+++ b/net/bridge/br_if.c	2013-07-24 08:34:09.581940104 -0700
@@ -363,7 +363,8 @@ int br_add_if(struct net_bridge *br, str
 	if (err)
 		goto err2;
 
-	if (br_netpoll_info(br) && ((err = br_netpoll_enable(p, GFP_KERNEL))))
+	err = br_netpoll_enable(p, GFP_KERNEL);
+	if (err)
 		goto err3;
 
 	err = netdev_master_upper_dev_link(dev, br->dev);

             reply	other threads:[~2013-07-24 18:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-24 18:51 Stephen Hemminger [this message]
2013-07-24 18:52 ` [PATCH 2/3 net-next] team: cleanup netpoll clode Stephen Hemminger
2013-07-24 19:08   ` Jiri Pirko
2013-07-26 22:25   ` David Miller
2013-07-24 18:53 ` [PATCH 3/3 net-next] bond: cleanup netpoll code Stephen Hemminger
2013-07-24 19:08   ` Jiri Pirko
2013-07-25 13:06   ` Neil Horman
2013-07-26 22:25   ` David Miller
2013-07-24 19:07 ` [PATCH 1/3 net-next] bridge: " Jiri Pirko
2013-07-25 13:05 ` Neil Horman
2013-07-26 22:25 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130724115141.63bba894@nehalam.linuxnetplumber.net \
    --to=stephen@networkplumber.org \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=fubar@us.ibm.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --subject='Re: [PATCH 1/3 net-next] bridge: cleanup netpoll code' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).