* [PATCH net V2 0/2] net: delete duplicate dev_set_rx_mode() call
@ 2014-06-16 13:57 Weiping Pan
2014-06-16 13:57 ` [PATCH net 1/2] " Weiping Pan
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Weiping Pan @ 2014-06-16 13:57 UTC (permalink / raw)
To: netdev; +Cc: davem, 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 | 26 +++++++++-----------------
1 file changed, 9 insertions(+), 17 deletions(-)
--
1.9.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net 1/2] net: delete duplicate dev_set_rx_mode() call
2014-06-16 13:57 [PATCH net V2 0/2] net: delete duplicate dev_set_rx_mode() call Weiping Pan
@ 2014-06-16 13:57 ` Weiping Pan
2014-06-17 22:31 ` David Miller
2014-06-16 13:57 ` [PATCH net 2/2] net: make some functions return void Weiping Pan
2014-06-16 17:14 ` [PATCH net V2 0/2] net: delete duplicate dev_set_rx_mode() call Cong Wang
2 siblings, 1 reply; 7+ messages in thread
From: Weiping Pan @ 2014-06-16 13:57 UTC (permalink / raw)
To: netdev; +Cc: davem, 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 | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 30eedf6..a04b12f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5432,13 +5432,9 @@ int __dev_change_flags(struct net_device *dev, unsigned int flags)
*/
ret = 0;
- if ((old_flags ^ flags) & IFF_UP) { /* Bit is different ? */
+ if ((old_flags ^ flags) & IFF_UP)
ret = ((old_flags & IFF_UP) ? __dev_close : __dev_open)(dev);
- if (!ret)
- dev_set_rx_mode(dev);
- }
-
if ((flags ^ dev->gflags) & IFF_PROMISC) {
int inc = (flags & IFF_PROMISC) ? 1 : -1;
unsigned int old_flags = dev->flags;
--
1.9.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net 2/2] net: make some functions return void
2014-06-16 13:57 [PATCH net V2 0/2] net: delete duplicate dev_set_rx_mode() call Weiping Pan
2014-06-16 13:57 ` [PATCH net 1/2] " Weiping Pan
@ 2014-06-16 13:57 ` Weiping Pan
2014-06-16 16:16 ` Bjørn Mork
2014-06-17 22:32 ` David Miller
2014-06-16 17:14 ` [PATCH net V2 0/2] net: delete duplicate dev_set_rx_mode() call Cong Wang
2 siblings, 2 replies; 7+ messages in thread
From: Weiping Pan @ 2014-06-16 13:57 UTC (permalink / raw)
To: netdev; +Cc: davem, 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 a04b12f..44d4748 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)
- 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) {
int inc = (flags & IFF_PROMISC) ? 1 : -1;
--
1.9.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net 2/2] net: make some functions return void
2014-06-16 13:57 ` [PATCH net 2/2] net: make some functions return void Weiping Pan
@ 2014-06-16 16:16 ` Bjørn Mork
2014-06-17 22:32 ` David Miller
1 sibling, 0 replies; 7+ messages in thread
From: Bjørn Mork @ 2014-06-16 16:16 UTC (permalink / raw)
To: Weiping Pan; +Cc: netdev, davem
Weiping Pan <panweiping3@gmail.com> writes:
> 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.
They may not need to return anything, but IMHO it is more logical to
keep the returned type identical to dev_close().
Bjørn
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net V2 0/2] net: delete duplicate dev_set_rx_mode() call
2014-06-16 13:57 [PATCH net V2 0/2] net: delete duplicate dev_set_rx_mode() call Weiping Pan
2014-06-16 13:57 ` [PATCH net 1/2] " Weiping Pan
2014-06-16 13:57 ` [PATCH net 2/2] net: make some functions return void Weiping Pan
@ 2014-06-16 17:14 ` Cong Wang
2 siblings, 0 replies; 7+ messages in thread
From: Cong Wang @ 2014-06-16 17:14 UTC (permalink / raw)
To: Weiping Pan; +Cc: netdev, David Miller
On Mon, Jun 16, 2014 at 6:57 AM, Weiping Pan <panweiping3@gmail.com> wrote:
> This patchset delete duplicate dev_set_rx_mode() call, and it also make some
> functions return void instead of int.
>
Why for -net not -net-next?
This probably doesn't fix any bug, at least the second one.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net 1/2] net: delete duplicate dev_set_rx_mode() call
2014-06-16 13:57 ` [PATCH net 1/2] " Weiping Pan
@ 2014-06-17 22:31 ` David Miller
0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2014-06-17 22:31 UTC (permalink / raw)
To: panweiping3; +Cc: netdev
From: Weiping Pan <panweiping3@gmail.com>
Date: Mon, 16 Jun 2014 21:57:22 +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>
Applied.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net 2/2] net: make some functions return void
2014-06-16 13:57 ` [PATCH net 2/2] net: make some functions return void Weiping Pan
2014-06-16 16:16 ` Bjørn Mork
@ 2014-06-17 22:32 ` David Miller
1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2014-06-17 22:32 UTC (permalink / raw)
To: panweiping3; +Cc: netdev
From: Weiping Pan <panweiping3@gmail.com>
Date: Mon, 16 Jun 2014 21:57:23 +0800
> 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>
I agree with other reviewers that this doesn't make much sense and it's
better to have the close functions have consistent return types.
I'm not applying this, sorry.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-06-17 22:32 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-16 13:57 [PATCH net V2 0/2] net: delete duplicate dev_set_rx_mode() call Weiping Pan
2014-06-16 13:57 ` [PATCH net 1/2] " Weiping Pan
2014-06-17 22:31 ` David Miller
2014-06-16 13:57 ` [PATCH net 2/2] net: make some functions return void Weiping Pan
2014-06-16 16:16 ` Bjørn Mork
2014-06-17 22:32 ` David Miller
2014-06-16 17:14 ` [PATCH net V2 0/2] net: delete duplicate dev_set_rx_mode() call Cong Wang
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).