[PATCH 4/8] clk: qcom: add support for power domains uclass
    Dan Carpenter 
    dan.carpenter at linaro.org
       
    Thu Feb 29 15:49:28 CET 2024
    
    
  
On Thu, Feb 29, 2024 at 02:21:08PM +0000, Volodymyr Babchuk wrote:
> @@ -223,7 +229,7 @@ U_BOOT_DRIVER(qcom_clk) = {
>  int qcom_cc_bind(struct udevice *parent)
>  {
>  	struct msm_clk_data *data = (struct msm_clk_data *)dev_get_driver_data(parent);
> -	struct udevice *clkdev, *rstdev;
> +	struct udevice *clkdev, *rstdev, *pwrdev;
>  	struct driver *drv;
>  	int ret;
>  
> @@ -253,6 +259,20 @@ int qcom_cc_bind(struct udevice *parent)
>  	if (ret)
>  		device_unbind(clkdev);
Change this to:
	if (ret)
		goto unbind_clkdev;
>  
> +	if (!data->power_domains)
> +		return ret;
Then this becomes:
	if (!data->power_domains)
		return 0;
> +
> +	/* Get a handle to the common power domain handler */
> +	drv = lists_driver_lookup_name("qcom_power");
> +	if (!drv)
> +		return -ENOENT;
	if (!drv) {
		ret = -ENOENT;
		goto unbind_rstdev;
	}
> +
> +	/* Register the power domain controller */
> +	ret = device_bind_with_driver_data(parent, drv, "qcom_power", (ulong)data,
> +					   dev_ofnode(parent), &pwrdev);
> +	if (ret)
> +		device_unbind(pwrdev);
pwrdev wasn't bound.  Free the last *successful* allocation which was
still rstdev.
	if (ret)
		goto unbind_rstdev;
	return 0;
unbind_rstdev:
	device_unbind(rstdev);
unbind_clkdev:
	device_unbind(clkdev);
	return ret;
> +
>  	return ret;
>  }
>  
regards,
dan carpenter
    
    
More information about the U-Boot
mailing list