Re: [net-next v3 8/9] net: mvpp2: Convert to devm_clk_get_enabled() and devm_clk_get_optional_enabled()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 27, 2024 at 03:57:11AM -0600, Yangtao Li wrote:
> Use devm_clk_get_enabled() and devm_clk_get_optional_enabled()
> to simplify code.
> 
> Signed-off-by: Yangtao Li <frank.li@xxxxxxxx>
> Reviewed-by: Maxime Chevallier <maxime.chevallier@xxxxxxxxxxx>
> Tested-by: Maxime Chevallier <maxime.chevallier@xxxxxxxxxxx>
> Suggested-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
> Reviewed-by: Marcin Wojtas <marcin.s.wojtas@xxxxxxxxx>

...

> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> index 2fe8bae4eb3c..0ca2daeb0f90 100644
> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> @@ -7561,56 +7561,32 @@ static int mvpp2_probe(struct platform_device *pdev)

...

> -		priv->axi_clk = devm_clk_get_optional(&pdev->dev, "axi_clk");
> -		if (IS_ERR(priv->axi_clk)) {
> -			err = PTR_ERR(priv->axi_clk);
> -			goto err_mg_core_clk;
> +			clk = devm_clk_get_optional_enabled(&pdev->dev, "mg_core_clk");

As it looks like there will be a v3 anyway, a minor nit from my side:
IMHO, the line above could be trivially wrapped to keep it <= 80 columns wide,
which is still preferred by Networking code.

> +			if (IS_ERR(clk))
> +				return PTR_ERR(clk);
>  		}
>  
> -		err = clk_prepare_enable(priv->axi_clk);
> -		if (err < 0)
> -			goto err_mg_core_clk;
> -
> -		/* Get system's tclk rate */
> -		priv->tclk = clk_get_rate(priv->pp_clk);
> +		clk = devm_clk_get_optional_enabled(&pdev->dev, "axi_clk");
> +		if (IS_ERR(clk))
> +			return PTR_ERR(clk);

...




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux