net: make dev_close void
Subsystems (5)
cover net: make dev_close void
Noticed while working on other changes. Why is dev_close() returning int, it should be void. Should also change ndo_close to be void, but that requires more work and someone with more coccinelle foo (smpl) than me.
Stephen Hemminger (3):
bluetooth: 6lowpan dev_close never returns error
hns: remove useless void cast
net: make dev_close and related functions void
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 2 +- include/linux/netdevice.h | 4 ++-- net/bluetooth/6lowpan.c | 4 +--- net/core/dev.c | 26 ++++++++++-------------- 4 files changed, 15 insertions(+), 21 deletions(-)
Signature · 1 line
2.11.0
PATCH 1/3 bluetooth: 6lowpan dev_close never returns error
The function dev_close in current kernel will never return an error. Later changes will make it void.
--- net/bluetooth/6lowpan.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/bluetooth/6lowpan.c +1 -3
@@ -621,9 +621,7 @@ static void ifdown(struct net_device *netdev)int err;rtnl_lock (); - err =dev_close (netdev); -if (err <0 ) -BT_INFO ("iface %s cannot be closed (%d)" , netdev->name, err); +dev_close (netdev);rtnl_unlock (); }
Signature · 1 line
2.11.0
PATCH 2/3 hns: remove useless void cast
In reply to Stephen HemmingerThere is no need to cast away return value of dev_close.
--- drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c +1 -1
@@ -595,7 +595,7 @@ static void hns_nic_self_test(struct net_device *ndev,set_bit (NIC_STATE_TESTING , &priv->state);if (if_running) - (void )dev_close (ndev); +dev_close (ndev);for (i =0 ; i <SELF_TEST_TPYE_NUM ; i++) {if (!st_param[i][1 ])
Signature · 1 line
2.11.0
PATCH 3/3 net: make dev_close and related functions void
In reply to a message not in the archiveThere is no useful return value from dev_close. All paths return 0. Change dev_close and helper functions to void.
--- include/linux/netdevice.h | 4 ++-- net/core/dev.c | 26 +++++++++++--------------- 2 files changed, 13 insertions(+), 17 deletions(-)
include/linux/netdevice.h +2 -2
@@ -2432,8 +2432,8 @@ struct net_device *dev_get_by_name_rcu(struct net *net, const char *name);struct net_device *__dev_get_by_name (struct net *net,const char *name);int dev_alloc_name (struct net_device *dev,const char *name);int dev_open (struct net_device *dev); -int dev_close (struct net_device *dev); -int dev_close_many (struct list_head *head,bool unlink); +void dev_close (struct net_device *dev); +void dev_close_many (struct list_head *head,bool unlink);void dev_disable_lro (struct net_device *dev);int dev_loopback_xmit (struct net *net,struct sock *sk,struct sk_buff *newskb);int dev_queue_xmit (struct sk_buff *skb);
net/core/dev.c +11 -15
@@ -1413,7 +1413,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;
@@ -1455,23 +1455,18 @@ static int __dev_close_many(struct list_head *head) dev->flags &= ~IFF_UP ;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; } -int dev_close_many (struct list_head *head,bool unlink) +void dev_close_many (struct list_head *head,bool unlink) {struct net_device *dev, *tmp;
@@ -1488,8 +1483,6 @@ int dev_close_many(struct list_head *head, bool unlink)if (unlink)list_del_init (&dev->close_list); } - -return 0 ; }EXPORT_SYMBOL (dev_close_many);
@@ -1502,7 +1495,7 @@ EXPORT_SYMBOL(dev_close_many);* is then deactivated and finally a %NETDEV_DOWN is sent to the notifier * chain. */ -int dev_close (struct net_device *dev) +void dev_close (struct net_device *dev) {if (dev->flags &IFF_UP ) {LIST_HEAD (single);
@@ -1511,7 +1504,6 @@ int dev_close(struct net_device *dev)dev_close_many (&single, true);list_del (&single); } -return 0 ; }EXPORT_SYMBOL (dev_close);
@@ -6725,8 +6717,12 @@ 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 ^ flags) &IFF_UP ) { +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 ;
Signature · 1 line
2.11.0
David Miller
maintainerFrom: Stephen Hemminger <[email protected]>
Date: Tue, 18 Jul 2017 15:59:24 -0700
Quoted 4 lines
Noticed while working on other changes. Why is
dev_close()returning int, it should be void. Should also changendo_closeto be void, but that requires more work and someone with more coccinelle foo (smpl) than me.
Series applied, thanks.
kbuild test robot
build botRe: [PATCH net-next 1/3] bluetooth: 6lowpan dev_close never returns error
In reply to Stephen Hemmingerurl: https://github.com/0day-ci/linux/commits/Stephen-Hemminger/net-make-dev_close-void/20170720-090123 config: x86_64-randconfig-a0-07211734 (attached as .config) compiler: gcc-4.4 (Debian 4.4.7-8)…
Hi Stephen,
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Stephen-Hemminger/net-make-dev_close-void/20170720-090123
config: x86_64-randconfig-a0-07211734 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7 reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 All warnings (new ones prefixed by >>):
net/bluetooth/6lowpan.c: In function 'ifdown':
>> net/bluetooth/6lowpan.c:621: warning: unused variable 'err'
vim +/err +621 net/bluetooth/6lowpan.c
18722c24 Jukka Rissanen 2013-12-11 618
7f118253 Jukka Rissanen 2014-06-18 619 static void ifdown(struct net_device *netdev)
7f118253 Jukka Rissanen 2014-06-18 620 {
7f118253 Jukka Rissanen 2014-06-18 @621 int err;
7f118253 Jukka Rissanen 2014-06-18 622
7f118253 Jukka Rissanen 2014-06-18 623 rtnl_lock();
ca74f73e Stephen Hemminger 2017-07-18 624 dev_close(netdev);
7f118253 Jukka Rissanen 2014-06-18 625 rtnl_unlock();
7f118253 Jukka Rissanen 2014-06-18 626 }
7f118253 Jukka Rissanen 2014-06-18 627 :::::: The code at line 621 was first introduced by commit
:::::: 7f118253820fc3ad38659485adb3ebdfe64820e1 Bluetooth: 6LoWPAN: Remove network devices when unloading
:::::: TO: Jukka Rissanen <[email protected]> :::::: CC: Marcel Holtmann <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Marcel Holtmann
maintainerRe: [PATCH net-next 1/3] bluetooth: 6lowpan dev_close never returns error
Hi Stephen,
Quoted 27 lines
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Stephen-Hemminger/net-make-dev_close-void/20170720-090123
config: x86_64-randconfig-a0-07211734 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7 reproduce:# save the attached .config to linux build tree make ARCH=x86_64All warnings (new ones prefixed by >>):
net/bluetooth/6lowpan.c: In function 'ifdown':Quoted 1 line
Quoted 1 line
net/bluetooth/6lowpan.c:621: warning: unused variable 'err'vim +/err +621
net/bluetooth/6lowpan.c18722c24 Jukka Rissanen 2013-12-11 618 7f118253 Jukka Rissanen 2014-06-18 619 static void ifdown(struct net_device *netdev) 7f118253 Jukka Rissanen 2014-06-18 620 { 7f118253 Jukka Rissanen 2014-06-18 @621 int err; 7f118253 Jukka Rissanen 2014-06-18 622 7f118253 Jukka Rissanen 2014-06-18 623 rtnl_lock(); ca74f73e Stephen Hemminger 2017-07-18 624 dev_close(netdev); 7f118253 Jukka Rissanen 2014-06-18 625 rtnl_unlock(); 7f118253 Jukka Rissanen 2014-06-18 626 } 7f118253 Jukka Rissanen 2014-06-18 627
Quoted 5 lines
:::::: The code at line 621 was first introduced by commit
::::::7f118253820fc3ad38659485adb3ebdfe64820e1Bluetooth: 6LoWPAN: Remove network devices when unloading:::::: TO: Jukka Rissanen <[email protected]> :::::: CC: Marcel Holtmann <[email protected]>
are you going to send a fix for this?
Regards
Marcel