All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Crispin <john-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
To: Sean Wang <sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	nbd-p3rKhJxN3npAfugRpC6u6w@public.gmane.org,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	keyhaede-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Subject: Re: [RESEND PATCH net 07/10] net: ethernet: mediatek: fix issue of driver removal with interface is up
Date: Thu, 25 Aug 2016 15:35:34 +0200	[thread overview]
Message-ID: <2203871f-d73d-3a39-928d-39862ba5e367@phrozen.org> (raw)
In-Reply-To: <1472121901-15629-8-git-send-email-sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>



On 25/08/2016 12:44, Sean Wang wrote:
> 1) mtk_stop() must be called to stop for freeing DMA resources
> acquired and restoring state changed by mtk_open() when module
> removal.
> 
> 2) group clock disabled related function into mtk_hw_deinit which
> could be reused with others functionality such as the whole ethernet
> reset that would be posted in the later series of patches.
> 

Hi Sean,

these are 2 unrelated changes so they really need to go into two
separate patches. i also think that change 1) would better fit into the
future series making use of that functionality.

	John

> Signed-off-by: Sean Wang <sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
> ---
>  drivers/net/ethernet/mediatek/mtk_eth_soc.c | 22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> index 0a4c782..c573475 100644
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> @@ -1478,6 +1478,16 @@ static int __init mtk_hw_init(struct mtk_eth *eth)
>  	return 0;
>  }
>  
> +static int mtk_hw_deinit(struct mtk_eth *eth)
> +{
> +	clk_disable_unprepare(eth->clk_esw);
> +	clk_disable_unprepare(eth->clk_gp1);
> +	clk_disable_unprepare(eth->clk_gp2);
> +	clk_disable_unprepare(eth->clk_ethif);
> +
> +	return 0;
> +}
> +
>  static int __init mtk_init(struct net_device *dev)
>  {
>  	struct mtk_mac *mac = netdev_priv(dev);
> @@ -1919,11 +1929,15 @@ err_free_dev:
>  static int mtk_remove(struct platform_device *pdev)
>  {
>  	struct mtk_eth *eth = platform_get_drvdata(pdev);
> +	int i;
>  
> -	clk_disable_unprepare(eth->clk_ethif);
> -	clk_disable_unprepare(eth->clk_esw);
> -	clk_disable_unprepare(eth->clk_gp1);
> -	clk_disable_unprepare(eth->clk_gp2);
> +	/* stop all devices to make sure that dma is properly shut down */
> +	for (i = 0; i < MTK_MAC_COUNT; i++) {
> +		if (!eth->netdev[i])
> +			continue;
> +		mtk_stop(eth->netdev[i]);
> +	}
> +	mtk_hw_deinit(eth);
>  
>  	netif_napi_del(&eth->tx_napi);
>  	netif_napi_del(&eth->rx_napi);
> 

  parent reply	other threads:[~2016-08-25 13:35 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-25 10:44 [RESEND PATCH net 00/10] net: ethernet: mediatek: a couple of fixes Sean Wang
2016-08-25 10:44 ` Sean Wang
2016-08-25 10:44 ` [RESEND PATCH net 01/10] net: ethernet: mediatek: fix fails from TX housekeeping due to incorrect port setup Sean Wang
2016-08-25 10:44   ` Sean Wang
2016-08-25 12:19   ` John Crispin
     [not found] ` <1472121901-15629-1-git-send-email-sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2016-08-25 10:44   ` [RESEND PATCH net 02/10] net: ethernet: mediatek: fix incorrect return value of devm_clk_get with EPROBE_DEFER Sean Wang
2016-08-25 10:44     ` Sean Wang
2016-08-25 13:49     ` John Crispin
     [not found]       ` <e1e9ca7a-c33b-3a9e-fd47-48f80bb10a32-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
2016-08-26  5:22         ` [RESEND PATCH net 02/10] net: ethernet: mediatek: fix incorrect Sean Wang
2016-08-26  5:22           ` Sean Wang
2016-08-25 10:44   ` [RESEND PATCH net 03/10] net: ethernet: mediatek: fix API usage with skb_free_frag Sean Wang
2016-08-25 10:44     ` Sean Wang
2016-08-25 12:20     ` John Crispin
2016-08-25 10:44 ` [RESEND PATCH net 04/10] net: ethernet: mediatek: remove redundant free_irq for devm_request_irq allocated irq Sean Wang
2016-08-25 10:44   ` Sean Wang
2016-08-25 12:20   ` John Crispin
2016-08-25 10:44 ` [RESEND PATCH net 05/10] net: ethernet: mediatek: fix logic unbalance between probe and remove Sean Wang
2016-08-25 10:44   ` Sean Wang
2016-08-25 12:22   ` John Crispin
2016-08-25 10:44 ` [RESEND PATCH net 06/10] net: ethernet: mediatek: fix the loss of pin-mux setting for GMAC2 Sean Wang
2016-08-25 10:44   ` Sean Wang
2016-08-25 13:30   ` Andrew Lunn
     [not found]     ` <20160825133034.GA25046-g2DYL2Zd6BY@public.gmane.org>
2016-08-26  3:33       ` [RESEND PATCH net 06/10] net: ethernet: mediatek: fix the loss Sean Wang
2016-08-26  3:33         ` Sean Wang
2016-08-26 14:17         ` Andrew Lunn
2016-08-29  4:27           ` Sean Wang
2016-08-29  4:27             ` Sean Wang
2016-08-25 10:44 ` [RESEND PATCH net 07/10] net: ethernet: mediatek: fix issue of driver removal with interface is up Sean Wang
2016-08-25 10:44   ` Sean Wang
     [not found]   ` <1472121901-15629-8-git-send-email-sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2016-08-25 13:35     ` John Crispin [this message]
     [not found]       ` <2203871f-d73d-3a39-928d-39862ba5e367-Pj+rj9U5foFAfugRpC6u6w@public.gmane.org>
2016-08-26  5:50         ` Sean Wang
2016-08-26  5:50           ` Sean Wang
2016-08-25 10:44 ` [RESEND PATCH net 08/10] net: ethernet: mediatek: fix the missing of_node_put() after node is used done inside mtk_mdio_init Sean Wang
2016-08-25 10:44   ` Sean Wang
     [not found]   ` <1472121901-15629-9-git-send-email-sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2016-08-25 13:36     ` John Crispin
2016-08-25 10:45 ` [RESEND PATCH net 09/10] net: ethernet: mediatek: use devm_mdiobus_alloc instead of mdiobus_alloc " Sean Wang
2016-08-25 10:45   ` Sean Wang
     [not found]   ` <1472121901-15629-10-git-send-email-sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2016-08-25 13:39     ` John Crispin
2016-08-26  6:33       ` sean.wang
2016-08-26  6:33         ` sean.wang
2016-08-25 10:45 ` [RESEND PATCH net 10/10] net: ethernet: mediatek: fix error handling " Sean Wang
2016-08-25 10:45   ` Sean Wang
     [not found]   ` <1472121901-15629-11-git-send-email-sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2016-08-25 13:39     ` John Crispin

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=2203871f-d73d-3a39-928d-39862ba5e367@phrozen.org \
    --to=john-pj+rj9u5fofafugrpc6u6w@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=keyhaede-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=nbd-p3rKhJxN3npAfugRpC6u6w@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.