All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Jiri Pirko <jpirko@redhat.com>
Cc: netdev@vger.kernel.org, kaber@trash.net, fubar@us.ibm.com,
	bonding-devel@lists.sourceforge.net, davem@davemloft.net
Subject: Re: [Bonding-devel] [net-next-2.6 PATCH 2/3] bonding: check return value of nofitier when changing type
Date: Wed, 10 Mar 2010 14:47:10 -0800	[thread overview]
Message-ID: <20100310144710.605ef033@nehalam> (raw)
In-Reply-To: <20100310202935.GE2834@psychotron.redhat.com>

On Wed, 10 Mar 2010 21:29:35 +0100
Jiri Pirko <jpirko@redhat.com> wrote:

> diff --git a/net/core/dev.c b/net/core/dev.c
> index bcc490c..5de4a15 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1084,9 +1084,9 @@ void netdev_state_change(struct net_device *dev)
>  }
>  EXPORT_SYMBOL(netdev_state_change);
>  
> -void netdev_bonding_change(struct net_device *dev, unsigned long event)
> +int netdev_bonding_change(struct net_device *dev, unsigned long event)
>  {
> -	call_netdevice_notifiers(event, dev);
> +	return call_netdevice_notifiers(event, dev);
>  }
>  EXPORT_SYMBOL(netdev_bonding_change);
>  

I don't think all this pre-post stuff needed.
Since this is general (not just bonding) how about

int netdev_change_type(struct net_device *dev, int newtype)
{
	int ret, oldtype;

	if (dev->flags & IFF_UP)
		return -EBUSY;

	oldtype = dev->type;
	dev->type = newtype;
	ret = call_netdevice_notifier(NETDEV_CHANGETYPE, dev);
	ret = notifier_to_errno(ret);
	if (ret)
	     dev->type = oldtype;

	return ret;
}
	     

  reply	other threads:[~2010-03-10 22:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-10 20:28 [net-next-2.6 PATCH 0/3] bonding: refuse to change bond type if it's used V3 Jiri Pirko
2010-03-10 20:28 ` [net-next-2.6 PATCH 1/3] net: rename notifier defines for netdev type change Jiri Pirko
2010-03-10 20:29 ` [net-next-2.6 PATCH 2/3] bonding: check return value of nofitier when changing type Jiri Pirko
2010-03-10 22:47   ` Stephen Hemminger [this message]
2010-03-11  7:59     ` [Bonding-devel] " Jiri Pirko
2010-03-11  9:53       ` Jiri Pirko
2010-03-10 20:30 ` [net-next-2.6 PATCH 3/3] net: forbid underlaying devices to change its type Jiri Pirko
2010-03-10 21:04   ` Jay Vosburgh
2010-03-10 21:17     ` Jiri Pirko
2010-03-19  3:05 ` [net-next-2.6 PATCH 0/3] bonding: refuse to change bond type if it's used V3 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=20100310144710.605ef033@nehalam \
    --to=shemminger@linux-foundation.org \
    --cc=bonding-devel@lists.sourceforge.net \
    --cc=davem@davemloft.net \
    --cc=fubar@us.ibm.com \
    --cc=jpirko@redhat.com \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.