* [PATCH net 0/2] net: delete duplicate dev_set_rx_mode() call
@ 2014-06-15 10:05 Weiping Pan
2014-06-15 10:05 ` [PATCH net 1/2] " Weiping Pan
2014-06-15 10:05 ` [PATCH net 2/2] net: make some functions return void Weiping Pan
0 siblings, 2 replies; 4+ messages in thread
From: Weiping Pan @ 2014-06-15 10:05 UTC (permalink / raw)
To: netdev; +Cc: davem, edumazet, Weiping Pan
This patchset delete duplicate dev_set_rx_mode() call, and it also make some
functions return void instead of int.
Weiping Pan (2):
net: delete duplicate dev_set_rx_mode() call
net: make some functions return void
net/core/dev.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
--
1.9.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net 1/2] net: delete duplicate dev_set_rx_mode() call
2014-06-15 10:05 [PATCH net 0/2] net: delete duplicate dev_set_rx_mode() call Weiping Pan
@ 2014-06-15 10:05 ` Weiping Pan
2014-06-16 3:05 ` David Miller
2014-06-15 10:05 ` [PATCH net 2/2] net: make some functions return void Weiping Pan
1 sibling, 1 reply; 4+ messages in thread
From: Weiping Pan @ 2014-06-15 10:05 UTC (permalink / raw)
To: netdev; +Cc: davem, edumazet, Weiping Pan
In __dev_open(), it already calls dev_set_rx_mode().
and dev_set_rx_mode() has no effect for a net device which does not have
IFF_UP flag set.
So the call of dev_set_rx_mode() is duplicate in __dev_change_flags().
Signed-off-by: Weiping Pan <panweiping3@gmail.com>
---
net/core/dev.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 30eedf6..002678f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5434,9 +5434,6 @@ int __dev_change_flags(struct net_device *dev, unsigned int flags)
ret = 0;
if ((old_flags ^ flags) & IFF_UP) { /* Bit is different ? */
ret = ((old_flags & IFF_UP) ? __dev_close : __dev_open)(dev);
-
- if (!ret)
- dev_set_rx_mode(dev);
}
if ((flags ^ dev->gflags) & IFF_PROMISC) {
--
1.9.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net 2/2] net: make some functions return void
2014-06-15 10:05 [PATCH net 0/2] net: delete duplicate dev_set_rx_mode() call Weiping Pan
2014-06-15 10:05 ` [PATCH net 1/2] " Weiping Pan
@ 2014-06-15 10:05 ` Weiping Pan
1 sibling, 0 replies; 4+ messages in thread
From: Weiping Pan @ 2014-06-15 10:05 UTC (permalink / raw)
To: netdev; +Cc: davem, edumazet, Weiping Pan
dev_close_many(), __dev_close_many() and __dev_close() do not need to return a
int, so make them return void, and modify __dev_change_flags() accordingly.
Signed-off-by: Weiping Pan <panweiping3@gmail.com>
---
net/core/dev.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 002678f..9279d68 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1305,7 +1305,7 @@ int dev_open(struct net_device *dev)
}
EXPORT_SYMBOL(dev_open);
-static int __dev_close_many(struct list_head *head)
+static void __dev_close_many(struct list_head *head)
{
struct net_device *dev;
@@ -1348,23 +1348,18 @@ static int __dev_close_many(struct list_head *head)
net_dmaengine_put();
netpoll_poll_enable(dev);
}
-
- return 0;
}
-static int __dev_close(struct net_device *dev)
+static void __dev_close(struct net_device *dev)
{
- int retval;
LIST_HEAD(single);
list_add(&dev->close_list, &single);
- retval = __dev_close_many(&single);
+ __dev_close_many(&single);
list_del(&single);
-
- return retval;
}
-static int dev_close_many(struct list_head *head)
+static void dev_close_many(struct list_head *head)
{
struct net_device *dev, *tmp;
@@ -1380,8 +1375,6 @@ static int dev_close_many(struct list_head *head)
call_netdevice_notifiers(NETDEV_DOWN, dev);
list_del_init(&dev->close_list);
}
-
- return 0;
}
/**
@@ -5433,7 +5426,10 @@ int __dev_change_flags(struct net_device *dev, unsigned int flags)
ret = 0;
if ((old_flags ^ flags) & IFF_UP) { /* Bit is different ? */
- ret = ((old_flags & IFF_UP) ? __dev_close : __dev_open)(dev);
+ if (old_flags & IFF_UP)
+ __dev_close(dev);
+ else
+ ret = __dev_open(dev);
}
if ((flags ^ dev->gflags) & IFF_PROMISC) {
--
1.9.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net 1/2] net: delete duplicate dev_set_rx_mode() call
2014-06-15 10:05 ` [PATCH net 1/2] " Weiping Pan
@ 2014-06-16 3:05 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-06-16 3:05 UTC (permalink / raw)
To: panweiping3; +Cc: netdev, edumazet
From: Weiping Pan <panweiping3@gmail.com>
Date: Sun, 15 Jun 2014 18:05:09 +0800
> In __dev_open(), it already calls dev_set_rx_mode().
> and dev_set_rx_mode() has no effect for a net device which does not have
> IFF_UP flag set.
>
> So the call of dev_set_rx_mode() is duplicate in __dev_change_flags().
>
> Signed-off-by: Weiping Pan <panweiping3@gmail.com>
> ---
> net/core/dev.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 30eedf6..002678f 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5434,9 +5434,6 @@ int __dev_change_flags(struct net_device *dev, unsigned int flags)
> ret = 0;
> if ((old_flags ^ flags) & IFF_UP) { /* Bit is different ? */
> ret = ((old_flags & IFF_UP) ? __dev_close : __dev_open)(dev);
> -
> - if (!ret)
> - dev_set_rx_mode(dev);
> }
A single line statement is what we end up with, so kill the curly braces
as they are no longer necessary.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-06-16 3:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-15 10:05 [PATCH net 0/2] net: delete duplicate dev_set_rx_mode() call Weiping Pan
2014-06-15 10:05 ` [PATCH net 1/2] " Weiping Pan
2014-06-16 3:05 ` David Miller
2014-06-15 10:05 ` [PATCH net 2/2] net: make some functions return void Weiping Pan
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.