netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] forcedeth: remove unnecessary carrier status check
@ 2017-05-03  4:43 Zhu Yanjun
  2017-05-04 14:58 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Zhu Yanjun @ 2017-05-03  4:43 UTC (permalink / raw)
  To: davem, netdev

Since netif_carrier_on() will do nothing if device's
carrier is already on, so it's unnecessary to do
carrier status check.

It's the same for netif_carrier_off().

Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
---
 drivers/net/ethernet/nvidia/forcedeth.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
index 978d329..aa912f4 100644
--- a/drivers/net/ethernet/nvidia/forcedeth.c
+++ b/drivers/net/ethernet/nvidia/forcedeth.c
@@ -4248,11 +4248,9 @@ static int nv_get_link_ksettings(struct net_device *dev,
 		/* We do not track link speed / duplex setting if the
 		 * interface is disabled. Force a link check */
 		if (nv_update_linkspeed(dev)) {
-			if (!netif_carrier_ok(dev))
-				netif_carrier_on(dev);
+			netif_carrier_on(dev);
 		} else {
-			if (netif_carrier_ok(dev))
-				netif_carrier_off(dev);
+			netif_carrier_off(dev);
 		}
 	}
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] forcedeth: remove unnecessary carrier status check
  2017-05-03  4:43 [PATCH 1/1] forcedeth: remove unnecessary carrier status check Zhu Yanjun
@ 2017-05-04 14:58 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-05-04 14:58 UTC (permalink / raw)
  To: yanjun.zhu; +Cc: netdev

From: Zhu Yanjun <yanjun.zhu@oracle.com>
Date: Wed,  3 May 2017 00:43:42 -0400

> Since netif_carrier_on() will do nothing if device's
> carrier is already on, so it's unnecessary to do
> carrier status check.
> 
> It's the same for netif_carrier_off().
> 
> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-04 14:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-03  4:43 [PATCH 1/1] forcedeth: remove unnecessary carrier status check Zhu Yanjun
2017-05-04 14:58 ` David Miller

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).