mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [net-next PATCH v4] net: ksz884x: optimize netdev_open flow and remove static variable
@ 2022-03-15 12:28 wujunwen
  2022-03-17  2:30 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: wujunwen @ 2022-03-15 12:28 UTC (permalink / raw)
  To: davem, kuba, m.grzeschik, chenhao288, arnd, pabeni
  Cc: wudaemon, shenyang39, netdev, linux-kernel

remove the static next_jiffies variable, and reinitialize next_jiffies 
to simplify netdev_open

Signed-off-by: wujunwen <wudaemon@163.com>
---
 drivers/net/ethernet/micrel/ksz884x.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c
index d024983815da..2b3eb5ed8233 100644
--- a/drivers/net/ethernet/micrel/ksz884x.c
+++ b/drivers/net/ethernet/micrel/ksz884x.c
@@ -5225,7 +5225,6 @@ static irqreturn_t netdev_intr(int irq, void *dev_id)
  * Linux network device functions
  */
 
-static unsigned long next_jiffies;
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
 static void netdev_netpoll(struct net_device *dev)
@@ -5411,10 +5410,12 @@ static int netdev_open(struct net_device *dev)
 	struct dev_info *hw_priv = priv->adapter;
 	struct ksz_hw *hw = &hw_priv->hw;
 	struct ksz_port *port = &priv->port;
+	unsigned long next_jiffies;
 	int i;
 	int p;
 	int rc = 0;
 
+	next_jiffies = jiffies + HZ * 2;
 	priv->multicast = 0;
 	priv->promiscuous = 0;
 
@@ -5428,10 +5429,7 @@ static int netdev_open(struct net_device *dev)
 		if (rc)
 			return rc;
 		for (i = 0; i < hw->mib_port_cnt; i++) {
-			if (next_jiffies < jiffies)
-				next_jiffies = jiffies + HZ * 2;
-			else
-				next_jiffies += HZ * 1;
+			next_jiffies += HZ * 1;
 			hw_priv->counter[i].time = next_jiffies;
 			hw->port_mib[i].state = media_disconnected;
 			port_init_cnt(hw, i);
@@ -6563,6 +6561,7 @@ static void mib_read_work(struct work_struct *work)
 	struct dev_info *hw_priv =
 		container_of(work, struct dev_info, mib_read);
 	struct ksz_hw *hw = &hw_priv->hw;
+	unsigned long next_jiffies;
 	struct ksz_port_mib *mib;
 	int i;
 
-- 
2.25.1


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

* Re: [net-next PATCH v4] net: ksz884x: optimize netdev_open flow and remove static variable
  2022-03-15 12:28 [net-next PATCH v4] net: ksz884x: optimize netdev_open flow and remove static variable wujunwen
@ 2022-03-17  2:30 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-17  2:30 UTC (permalink / raw)
  To: wujunwen
  Cc: davem, kuba, m.grzeschik, chenhao288, arnd, pabeni, shenyang39,
	netdev, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 15 Mar 2022 12:28:57 +0000 you wrote:
> remove the static next_jiffies variable, and reinitialize next_jiffies
> to simplify netdev_open
> 
> Signed-off-by: wujunwen <wudaemon@163.com>
> ---
>  drivers/net/ethernet/micrel/ksz884x.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)

Here is the summary with links:
  - [net-next,v4] net: ksz884x: optimize netdev_open flow and remove static variable
    https://git.kernel.org/netdev/net-next/c/af1147b236da

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-03-17  2:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-15 12:28 [net-next PATCH v4] net: ksz884x: optimize netdev_open flow and remove static variable wujunwen
2022-03-17  2:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®