[PATCH 2/3] mfd: twl4030-power: Start transition to DT

Samuel Ortiz sameo at linux.intel.com
Mon Jun 17 20:02:11 EDT 2013


Hi Florian,

On Thu, May 30, 2013 at 03:51:55PM +0200, Florian Vaussard wrote:
>  int twl4030_power_probe(struct platform_device *pdev)
>  {
>  	struct twl4030_power_data *pdata = pdev->dev.platform_data;
> +	struct device_node *node = pdev->dev.of_node;
>  	int err = 0;
> -	int i;
> -	struct twl4030_resconfig *resconfig;
> -	u8 val, address = twl4030_start_script_address;
> +	u8 val;
> +
> +	if (!pdata && !node) {
> +		dev_err(&pdev->dev, "Platform data is missing\n");
> +		return -EINVAL;
> +	}
>  
>  	err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG1,
>  			       TWL4030_PM_MASTER_PROTECT_KEY);
> @@ -525,26 +575,17 @@ int twl4030_power_probe(struct platform_device *pdev)
>  	if (err)
>  		goto unlock;
>  
> -	for (i = 0; i < pdata->num; i++) {
> -		err = load_twl4030_script(pdata->scripts[i], address);
> +	if (pdata) {
> +		err = twl4030_power_configure_scripts(pdata);
>  		if (err)
>  			goto load;
> -		address += pdata->scripts[i]->size;
> -	}
> -
> -	resconfig = pdata->resource_config;
> -	if (resconfig) {
> -		while (resconfig->resource) {
> -			err = twl4030_configure_resource(resconfig);
> -			if (err)
> -				goto resource;
> -			resconfig++;
> -
> -		}
> +		err = twl4030_power_configure_resources(pdata);
> +		if (err)
> +			goto resource;
You're simplifying the probe routine here by defining 2
twl4030_power_configure_* functions. That's good, but it should be a
separate patch as it's not related to the DT porting effort.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/



More information about the linux-arm-kernel mailing list