Remove double dev->flags checking when calling dev_close()
Subsystems (2)
PATCH 1/1 Remove double dev->flags checking when calling dev_close()
The unregister_netdevice() and dev_change_net_namespace() both check for dev->flags to be IFF_UP before calling the dev_close(), but the dev_close() checks for IFF_UP itself, so remove those unneeded checks.
---
net/core/dev.c +2 -4
@@ -3893,8 +3893,7 @@ void unregister_netdevice(struct net_devBUG_ON (dev->reg_state !=NETREG_REGISTERED );/* If device is running, close it first. */ -if (dev->flags &IFF_UP ) -dev_close (dev); +dev_close (dev);/* And unlink it from device chain. */ unlist_netdevice (dev);
@@ -4018,8 +4017,7 @@ int dev_change_net_namespace(struct net_*/ /* If device is running close it first. */ -if (dev->flags &IFF_UP ) -dev_close (dev); +dev_close (dev);/* And unlink it from device chain */ err = -ENODEV ;
Quoted 21 lines · Pavel Emelyanov
The
unregister_netdevice()anddev_change_net_namespace()both check fordev->flagsto beIFF_UPbefore calling thedev_close(), but thedev_close()checks forIFF_UPitself, so remove those unneeded checks.Signed-off-by Pavel Emelyanov <[email protected]>---
net/core/dev.c +1
-2@@ -3893,8 +3893,7 @@ void unregister_netdevice(struct net_devBUG_ON (dev->reg_state !=NETREG_REGISTERED );/* If device is running, close it first. */ -if (dev->flags &IFF_UP ) -dev_close (dev); +dev_close (dev);/* And unlink it from device chain. */ unlist_netdevice (dev);
net/core/dev.c int dev_change_net_namespace(struct net_ · line 4023
Quoted 9 lines
net/core/dev.c +1
-2@@ -4018,8 +4017,7 @@ int dev_change_net_namespace(struct net_*/ /* If device is running close it first. */ -if (dev->flags &IFF_UP ) -dev_close (dev); +dev_close (dev);/* And unlink it from device chain */ err = -ENODEV ;
One side effect of this patch: might_sleep() is now called unconditionally.
If that is irrelevant... ACK.
Quoted 32 lines · Jeff Garzik
Quoted 31 lines · Pavel Emelyanov
The
unregister_netdevice()anddev_change_net_namespace()both check fordev->flagsto beIFF_UPbefore calling thedev_close(), but thedev_close()checks forIFF_UPitself, so remove those unneeded checks.Signed-off-by Pavel Emelyanov <[email protected]>---
net/core/dev.c +2
-4@@ -3893,8 +3893,7 @@ void unregister_netdevice(struct net_devBUG_ON (dev->reg_state !=NETREG_REGISTERED );/* If device is running, close it first. */ -if (dev->flags &IFF_UP ) -dev_close (dev); +dev_close (dev);/* And unlink it from device chain. */ unlist_netdevice (dev);@@ -4018,8 +4017,7 @@ int dev_change_net_namespace(struct net_*/ /* If device is running close it first. */ -if (dev->flags &IFF_UP ) -dev_close (dev); +dev_close (dev);
Quoted 4 lines
net/core/dev.c int dev_change_net_namespace(struct net_ · line 4023
Quoted 2 lines
net/core/dev.c +0
-0/* And unlink it from device chain */ err = -ENODEV ;One side effect of this patch:
might_sleep()is now called unconditionally.
That's not a big deal - see, the synchronize_net() is called further in both places unconditionally (!) and also calls might_sleep(), so this is OK.
Quoted 1 line
If that is irrelevant... ACK.
Thanks :)
Quoted 6 lines
-
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 2 lines · Jeff Garzik
One side effect of this patch:
might_sleep()is now called unconditionally.
That would be seem to be a good thing :)
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtFrom: Pavel Emelyanov <[email protected]>
Date: Tue, 09 Oct 2007 14:50:54 +0400
Quoted 6 lines
The
unregister_netdevice()anddev_change_net_namespace()both check fordev->flagsto beIFF_UPbefore calling thedev_close(), but thedev_close()checks forIFF_UPitself, so remove those unneeded checks.Signed-off-by Pavel Emelyanov <[email protected]>
Applied, thanks Pavel.