Re: [net-next v3 9/9] net: marvell: pxa168_eth: Convert to devm_clk_get_enabled()

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

 



On Tue, 27 Aug 2024 03:57:12 -0600
Yangtao Li <frank.li@xxxxxxxx> wrote:

> Convert devm_clk_get(), clk_prepare_enable() to a single
> call to devm_clk_get_enabled(), as this is exactly
> what this function does.
> 
> Signed-off-by: Yangtao Li <frank.li@xxxxxxxx>
Ordering in here is already 'interesting' but I'd still look
at more devm_ calls for the mdio and netdev parts.

> ---
>  drivers/net/ethernet/marvell/pxa168_eth.c | 17 ++++-------------
>  1 file changed, 4 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
> index 1a59c952aa01..bad91cc705e8 100644
> --- a/drivers/net/ethernet/marvell/pxa168_eth.c
> +++ b/drivers/net/ethernet/marvell/pxa168_eth.c
> @@ -237,8 +237,6 @@ struct pxa168_eth_private {
>  	struct timer_list timeout;
>  	struct mii_bus *smi_bus;
>  
> -	/* clock */
> -	struct clk *clk;
>  	struct pxa168_eth_platform_data *pd;
>  	/*
>  	 * Ethernet controller base address.
> @@ -1394,23 +1392,19 @@ static int pxa168_eth_probe(struct platform_device *pdev)
>  
>  	printk(KERN_NOTICE "PXA168 10/100 Ethernet Driver\n");
>  
> -	clk = devm_clk_get(&pdev->dev, NULL);
> +	clk = devm_clk_get_enabled(&pdev->dev, NULL);
>  	if (IS_ERR(clk)) {
>  		dev_err(&pdev->dev, "Fast Ethernet failed to get clock\n");
> -		return -ENODEV;
> +		return PTR_ERR(clk);
>  	}
> -	clk_prepare_enable(clk);
>  
>  	dev = alloc_etherdev(sizeof(struct pxa168_eth_private));
> -	if (!dev) {
> -		err = -ENOMEM;
> -		goto err_clk;
> -	}
> +	if (!dev)
> +		return -ENOMEM;
>  
>  	platform_set_drvdata(pdev, dev);
>  	pep = netdev_priv(dev);
>  	pep->dev = dev;
> -	pep->clk = clk;
>  
>  	pep->base = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(pep->base)) {
> @@ -1523,8 +1517,6 @@ static int pxa168_eth_probe(struct platform_device *pdev)
>  	mdiobus_free(pep->smi_bus);
>  err_netdev:
>  	free_netdev(dev);
> -err_clk:
> -	clk_disable_unprepare(clk);
>  	return err;
>  }
>  
> @@ -1542,7 +1534,6 @@ static void pxa168_eth_remove(struct platform_device *pdev)
>  	if (dev->phydev)
>  		phy_disconnect(dev->phydev);
>  
> -	clk_disable_unprepare(pep->clk);
>  	mdiobus_unregister(pep->smi_bus);
>  	mdiobus_free(pep->smi_bus);
>  	unregister_netdev(dev);





[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