Message ID | 1272187206-18534-5-git-send-email-xiaohui.xin@intel.com |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
On Sun, Apr 25, 2010 at 5:19 PM, <xiaohui.xin@intel.com> wrote: > +static int dev_is_mpassthru(struct net_device *dev) > +{ > + if (dev && dev->mp_port) > + return 1; > + return 0; > +} > + Please make it a inline function. And you would write it with less lines of code. return dev && dev->mp_port;
On Sun, Apr 25, 2010 at 5:19 PM, <xiaohui.xin@intel.com> wrote:
> +static int dev_is_mpassthru(struct net_device *dev)
bool return value should be better here.
From: Changli Gao <xiaosuo@gmail.com> Date: Sun, 25 Apr 2010 17:33:02 +0800 > On Sun, Apr 25, 2010 at 5:19 PM, <xiaohui.xin@intel.com> wrote: >> +static int dev_is_mpassthru(struct net_device *dev) >> +{ >> + if (dev && dev->mp_port) >> + return 1; >> + return 0; >> +} >> + > > Please make it a inline function. And you would write it with less > lines of code. > > return dev && dev->mp_port; And use "bool" :-) -- 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
From: Changli Gao <xiaosuo@gmail.com> Date: Sun, 25 Apr 2010 17:35:01 +0800 > On Sun, Apr 25, 2010 at 5:19 PM, <xiaohui.xin@intel.com> wrote: >> +static int dev_is_mpassthru(struct net_device *dev) > > bool return value should be better here. Right. -- 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
> +static int dev_is_mpassthru(struct net_device *dev) > >bool return value should be better here. > >-- >Regards, >Changli Gao(xiaosuo@gmail.com) Thanks, would fix that. Thanks Xiaohui -- 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/include/linux/netdevice.h b/include/linux/netdevice.h index 2f9a4f2..a1a2aaf 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1602,6 +1602,13 @@ extern void netdev_mp_port_detach(struct net_device *dev); int netdev_mp_port_prep(struct net_device *dev, struct mpassthru_port *port); +static int dev_is_mpassthru(struct net_device *dev) +{ + if (dev && dev->mp_port) + return 1; + return 0; +} + static inline void napi_free_frags(struct napi_struct *napi) { kfree_skb(napi->skb);