From mboxrd@z Thu Jan 1 00:00:00 1970 From: linux@arm.linux.org.uk (Russell King - ARM Linux) Date: Tue, 15 May 2012 15:03:55 +0100 Subject: [PATCH v1 4/7] usb: chipidea: add imx driver binding In-Reply-To: <1337090303-16046-5-git-send-email-richard.zhao@freescale.com> References: <1337090303-16046-1-git-send-email-richard.zhao@freescale.com> <1337090303-16046-5-git-send-email-richard.zhao@freescale.com> Message-ID: <20120515140355.GA15199@n2100.arm.linux.org.uk> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org 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'.