lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <daf856a8-32ad-47ac-91b2-0aa2253636f8@wanadoo.fr>
Date: Sat, 7 Sep 2024 07:34:35 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Li Zetao <lizetao1@...wei.com>, mchehab@...nel.org,
 florian.fainelli@...adcom.com, andrew@...n.ch, olteanv@...il.com,
 davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
 pabeni@...hat.com, wens@...e.org, jernej.skrabec@...il.com,
 samuel@...lland.org, heiko@...ech.de, yisen.zhuang@...wei.com,
 salil.mehta@...wei.com, hauke@...ke-m.de, alexandre.torgue@...s.st.com,
 joabreu@...opsys.com, mcoquelin.stm32@...il.com, wellslutw@...il.com,
 radhey.shyam.pandey@....com, michal.simek@....com, hdegoede@...hat.com,
 ilpo.jarvinen@...ux.intel.com, ruanjinjie@...wei.com,
 hverkuil-cisco@...all.nl, u.kleine-koenig@...gutronix.de,
 jacky_chou@...eedtech.com, jacob.e.keller@...el.com
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
 netdev@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
 linux-sunxi@...ts.linux.dev, linux-rockchip@...ts.infradead.org,
 linux-stm32@...md-mailman.stormreply.com, platform-driver-x86@...r.kernel.org
Subject: Re: [PATCH net-next v2 02/10] net: ethernet: Convert using
 devm_clk_get_enabled() in emac_probe()

Le 07/09/2024 à 05:19, Li Zetao a écrit :
> Use devm_clk_get_enabled() instead of devm_clk_get() +
> clk_prepare_enable(), which can make the clk consistent with the device
> life cycle and reduce the risk of unreleased clk resources. Since the
> device framework has automatically released the clk resource, there is
> no need to execute clk_disable_unprepare(clk) on the error path, drop
> the out_clk_disable_unprepare label, and the original error process can
> changed to the out_dispose_mapping error path.
> 
> Signed-off-by: Li Zetao <lizetao1@...wei.com>

Hi,

I think that the subject should be "net: ethernet: allwinner:", or maybe 
even "net: allwinner:"


clk can now be removed from struct emac_board_info I think.
You should check for all patches, as asked in [1].

I've not looked all patches, but lantiq_xrx200() looks also a good 
candidate for removing clk from a structure.

CJ

[1]: https://lore.kernel.org/all/20240903151649.1b466145@kernel.org/

CJ

> ---
>   drivers/net/ethernet/allwinner/sun4i-emac.c | 13 ++-----------
>   1 file changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
> index d761c08fe5c1..8f42501729b7 100644
> --- a/drivers/net/ethernet/allwinner/sun4i-emac.c
> +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
> @@ -1005,22 +1005,16 @@ static int emac_probe(struct platform_device *pdev)
>   	if (emac_configure_dma(db))
>   		netdev_info(ndev, "configure dma failed. disable dma.\n");
>   
> -	db->clk = devm_clk_get(&pdev->dev, NULL);
> +	db->clk = devm_clk_get_enabled(&pdev->dev, NULL);
>   	if (IS_ERR(db->clk)) {
>   		ret = PTR_ERR(db->clk);
>   		goto out_dispose_mapping;
>   	}
>   
> -	ret = clk_prepare_enable(db->clk);
> -	if (ret) {
> -		dev_err(&pdev->dev, "Error couldn't enable clock (%d)\n", ret);
> -		goto out_dispose_mapping;
> -	}
> -
>   	ret = sunxi_sram_claim(&pdev->dev);
>   	if (ret) {
>   		dev_err(&pdev->dev, "Error couldn't map SRAM to device\n");
> -		goto out_clk_disable_unprepare;
> +		goto out_dispose_mapping;
>   	}
>   
>   	db->phy_node = of_parse_phandle(np, "phy-handle", 0);
> @@ -1068,8 +1062,6 @@ static int emac_probe(struct platform_device *pdev)
>   
>   out_release_sram:
>   	sunxi_sram_release(&pdev->dev);
> -out_clk_disable_unprepare:
> -	clk_disable_unprepare(db->clk);
>   out_dispose_mapping:
>   	irq_dispose_mapping(ndev->irq);
>   	dma_release_channel(db->rx_chan);
> @@ -1095,7 +1087,6 @@ static void emac_remove(struct platform_device *pdev)
>   
>   	unregister_netdev(ndev);
>   	sunxi_sram_release(&pdev->dev);
> -	clk_disable_unprepare(db->clk);
>   	irq_dispose_mapping(ndev->irq);
>   	iounmap(db->membase);
>   	free_netdev(ndev);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ