Hello. On 02-12-2010 12:25, Felipe Balbi wrote:
Just adding its own platform_driver, not really using it yet.
When all HW glue layers are converted, more patches will come to split power management code from musb_core and move it completely to HW glue layer.
Signed-off-by: Felipe Balbi <balbi@xxxxxx>
[...]
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index bfe07d45..ec7677d 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c
[...]
@@ -514,3 +516,88 @@ struct musb_platform_ops musb_ops = { .set_vbus = davinci_set_vbus, }; + +static u64 davinci_dmamask = DMA_BIT_MASK(32); + +static int __init davinci_probe(struct platform_device *pdev) +{ + struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; + struct platform_device *musb; + + int ret = -ENOMEM; + + musb = platform_device_alloc("musb-hdrc", -1); + if (!musb) { + dev_err(&pdev->dev, "failed to allocate musb device\n"); + goto err0;
Why not just: return ret;
+ } + + musb->dev.parent = &pdev->dev; + musb->dev.dma_mask = &davinci_dmamask; + musb->dev.coherent_dma_mask = davinci_dmamask;
Why not just copy pdev->dev->dma_mask and pdev->dev->coherenet_dma_mask?
+ platform_set_drvdata(pdev, musb); + + ret = platform_device_add_resources(musb, pdev->resource, + pdev->num_resources);
But not all DaVinci's resources belong to MUSB per se -- the part of the memory range is occupied by CPPI engine, and the possible second IRQ belongs to CPPI too. MUSB resource itself starts at offset 0x400.
+ if (ret) { + dev_err(&pdev->dev, "failed to add resources\n"); + goto err1; + } + + ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); + if (ret) { + dev_err(&pdev->dev, "failed to add platform_data\n"); + goto err1; + } + + ret = platform_device_add(musb); + if (ret) { + dev_err(&pdev->dev, "failed to register musb device\n"); + goto err2; + } + + return 0; + +err2: + platform_device_put(musb); + +err1: + platform_device_del(musb);
Shouldn't the call to platform_device_del() precede the call to platform_device_put()? At least that's how drivers/base/platform.c does its error cleanup. And I doubt that we need a call to platform_device_del() at all since it's coupled to platform_device_add()...
+err0: + return ret; +} + +static int __exit davinci_remove(struct platform_device *pdev) +{ + struct platform_device *musb = platform_get_drvdata(pdev); + + platform_device_put(musb); + platform_device_del(musb);
Same question here. Here we do need platform_device_del() though (but it should come first)...
+MODULE_DESCRIPTION("OMAP2PLUS MUSB Glue Layer");
You meant to type DaVinci here?
+MODULE_AUTHOR("Felipe Balbi <balbi@xxxxxx>");
Er, are you really the author of this file? WBR, Sergei -- 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