linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Shtylyov <s.shtylyov@omp.ru>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>,
	<netdev@vger.kernel.org>
Cc: <linux-renesas-soc@vger.kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next] sh_eth: remove open coded netif_running()
Date: Wed, 22 Mar 2023 23:54:42 +0300	[thread overview]
Message-ID: <79d945a4-e105-4bc4-3e73-64971731660e@omp.ru> (raw)
In-Reply-To: <20230321065826.2044-1-wsa+renesas@sang-engineering.com>

On 3/21/23 9:58 AM, Wolfram Sang wrote:

> It had a purpose back in the days, but today we have a handy helper.

   Well, the is_opened flag doesn't get set/cleared at the same time as
__LINK_STATE_START. I'm not sure they are interchangeable...
 
> Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> 
> Based on 6.3-rc3 and tested on a Renesas Lager board (R-Car H2).
> 
>  drivers/net/ethernet/renesas/sh_eth.c | 6 +-----
>  drivers/net/ethernet/renesas/sh_eth.h | 1 -
>  2 files changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
> index d8ec729825be..2d9787231099 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -2441,8 +2441,6 @@ static int sh_eth_open(struct net_device *ndev)
>  
>  	netif_start_queue(ndev);
>  
> -	mdp->is_opened = 1;
> -

   __LINK_STATE_START gets set before the ndo_open() method call, so
before the RPM call that enbales the clocks...

>  	return ret;
>  
>  out_free_irq:
> @@ -2565,7 +2563,7 @@ static struct net_device_stats *sh_eth_get_stats(struct net_device *ndev)
>  	if (mdp->cd->no_tx_cntrs)
>  		return &ndev->stats;
>  
> -	if (!mdp->is_opened)
> +	if (!netif_running(ndev))
>  		return &ndev->stats;

   I guess mdp->is_opened is checked here to avoid reading the counter
regs when RPM hasn't been called yet to enable the clocks...

[...]

MBR, Sergey

  parent reply	other threads:[~2023-03-22 20:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21  6:58 [PATCH net-next] sh_eth: remove open coded netif_running() Wolfram Sang
2023-03-21  8:22 ` Leon Romanovsky
2023-03-21 14:33 ` Geert Uytterhoeven
2023-03-21 16:58 ` Florian Fainelli
2023-03-22 12:30 ` patchwork-bot+netdevbpf
2023-03-22 20:57   ` Sergey Shtylyov
2023-03-22 20:54 ` Sergey Shtylyov [this message]
2023-03-23  8:32   ` Geert Uytterhoeven
2023-03-23 16:40     ` Jakub Kicinski
2023-03-25 20:27       ` Sergey Shtylyov
2023-03-27  8:14         ` Wolfram Sang
2023-03-25 20:56     ` Sergey Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=79d945a4-e105-4bc4-3e73-64971731660e@omp.ru \
    --to=s.shtylyov@omp.ru \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=geert+renesas@glider.be \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).