Re: [PATCH 12/14] ARM: omap2: use clkdev_add_alias()

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

 



* Russell King <rmk+kernel@xxxxxxxxxxxxxxxx> [150403 10:14]:
> When creating aliases of existing clkdev clocks, use clkdev_add_alias()
> isntead of open coding the lookup and clk_lookup creation.
> 
> Signed-off-by: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx>

Acked-by: Tony Lindgren <tony@xxxxxxxxxxx>

> ---
>  arch/arm/mach-omap2/omap_device.c | 24 +++++++++---------------
>  1 file changed, 9 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
> index be9541e18650..521c32e7778e 100644
> --- a/arch/arm/mach-omap2/omap_device.c
> +++ b/arch/arm/mach-omap2/omap_device.c
> @@ -47,7 +47,7 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias,
>  		       const char *clk_name)
>  {
>  	struct clk *r;
> -	struct clk_lookup *l;
> +	int rc;
>  
>  	if (!clk_alias || !clk_name)
>  		return;
> @@ -62,21 +62,15 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias,
>  		return;
>  	}
>  
> -	r = clk_get(NULL, clk_name);
> -	if (IS_ERR(r)) {
> -		dev_err(&od->pdev->dev,
> -			"clk_get for %s failed\n", clk_name);
> -		return;
> +	rc = clk_add_alias(clk_alias, dev_name(&od->pdev->dev), clk_name, NULL);
> +	if (rc) {
> +		if (rc == -ENODEV || rc == -ENOMEM)
> +			dev_err(&od->pdev->dev,
> +				"clkdev_alloc for %s failed\n", clk_alias);
> +		else
> +			dev_err(&od->pdev->dev,
> +				"clk_get for %s failed\n", clk_name);
>  	}
> -
> -	l = clkdev_alloc(r, clk_alias, dev_name(&od->pdev->dev));
> -	if (!l) {
> -		dev_err(&od->pdev->dev,
> -			"clkdev_alloc for %s failed\n", clk_alias);
> -		return;
> -	}
> -
> -	clkdev_add(l);
>  }
>  
>  /**
> -- 
> 1.8.3.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux