[PATCH v1 4/7] usb: chipidea: add imx driver binding

Russell King - ARM Linux linux at arm.linux.org.uk
Tue May 15 10:03:55 EDT 2012


On Tue, May 15, 2012 at 09:58:20PM +0800, Richard Zhao wrote:
> +	plat_ci = platform_device_alloc("ci_hdrc", (int)res->start);
> +	if (!plat_ci) {
> +		dev_err(&pdev->dev, "can't allocate ci_hdrc platform device\n");
> +		return -ENOMEM;
> +	}
> +
> +	ret = platform_device_add_resources(plat_ci, pdev->resource,
> +					    pdev->num_resources);
> +	if (ret) {
> +		dev_err(&pdev->dev, "can't add resources to platform device\n");
> +		goto put_platform;
> +	}
> +
> +	ret = platform_device_add_data(plat_ci, &ci13xxx_imx_udc_driver,
> +				       sizeof(ci13xxx_imx_udc_driver));
> +	if (ret)
> +		goto put_platform;
> +
> +	plat_ci->dev.dma_mask =
> +		kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);
> +	if (!plat_ci->dev.dma_mask) {
> +		ret = -ENOMEM;
> +		goto put_platform;
> +	}
> +	*plat_ci->dev.dma_mask = DMA_BIT_MASK(32);
> +	plat_ci->dev.coherent_dma_mask = DMA_BIT_MASK(32);
> +
> +	ret = platform_device_add(plat_ci);

Is there a reason not to use platform_device_register_full() ?

Also, you don't set the parent device - is there a dependency between
'pdev' and this new platform device you're creating?  If so, it should
be a child of 'pdev'.



More information about the linux-arm-kernel mailing list