On Tue, May 15, 2012 at 03:03:55PM +0100, Russell King - ARM Linux wrote: > 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'. Thanks for your comment. All taken. Richard -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html