}
/* Instantiate a software object representing a DMA controller. */
-static struct dma_controller *
-cppi_controller_new(struct musb *musb, void __iomem *pCoreBase)
+struct dma_controller *__init
+dma_controller_create(struct musb *musb, void __iomem *pCoreBase)
{
struct cppi *pController;
/*
* Destroy a previously-instantiated DMA controller.
*/
-static void cppi_controller_destroy(struct dma_controller *c)
+void dma_controller_destroy(struct dma_controller *c)
{
struct cppi *cppi;
kfree(cppi);
}
-const struct dma_controller_factory dma_controller_factory = {
- .create = cppi_controller_new,
- .destroy = cppi_controller_destroy,
-};
-
/*
* Context: controller irqlocked, endpoint selected
*/
extern void musb_dma_completion(struct musb *musb, u8 bLocalEnd, u8 bTransmit);
-/**
- * struct dma_controller_factory - DMA controller factory
- * @create: create a DMA controller
- * @destroy: destroy a DMA controller
- *
- * To allow for multi-core implementations and different
- * types of cores and DMA controllers to co-exist,
- * (only at the source level; no runtime coexistence supported)
- * it is necessary to create them from factories.
- */
-struct dma_controller_factory {
- struct dma_controller *(*create)(struct musb *, void __iomem *);
- void (*destroy)(struct dma_controller *);
-};
+extern struct dma_controller *__init
+dma_controller_create(struct musb *, void __iomem *);
-extern const struct dma_controller_factory dma_controller_factory;
+extern void dma_controller_destroy(struct dma_controller *);
#endif /* __MUSB_DMA_H__ */
return IRQ_HANDLED;
}
-static void hsdma_controller_destroy(struct dma_controller *pController)
+void dma_controller_destroy(struct dma_controller *pController)
{
struct hsdma *pHsController = pController->pPrivateData;
- if (pHsController) {
- pHsController->Controller.pPrivateData = NULL;
- kfree(pHsController);
- }
+ pHsController->Controller.pPrivateData = NULL;
+ kfree(pHsController);
}
-static struct dma_controller *
-hsdma_controller_new(struct musb *pThis, void __iomem *pCoreBase)
+struct dma_controller *__init
+dma_controller_create(struct musb *pThis, void __iomem *pCoreBase)
{
struct hsdma *pController;
struct device *dev = pThis->controller;
if (request_irq(irq, hsdma_irq, SA_INTERRUPT,
pThis->controller->bus_id, &pController->Controller)) {
dev_err(dev, "request_irq %d failed!\n", irq);
- hsdma_controller_destroy(&pController->Controller);
+ kfree(pController);
return NULL;
}
return &pController->Controller;
}
-
-const struct dma_controller_factory dma_controller_factory = {
- .create = hsdma_controller_new,
- .destroy = hsdma_controller_destroy,
-};
struct dma_controller *c = musb->pDmaController;
(void) c->stop(c->pPrivateData);
- dma_controller_factory.destroy(c);
+ dma_controller_destroy(c);
}
musb_writeb(musb->pRegs, MGC_O_HDRC_DEVCTL, 0);
if (use_dma && dev->dma_mask) {
struct dma_controller *c;
-// FIXME get rid of dma_controller_factory and just call the methods
-// directly ... then create() can be in the init section, etc
-
- c = dma_controller_factory.create(pThis, pThis->pRegs);
+ c = dma_controller_create(pThis, pThis->pRegs);
pThis->pDmaController = c;
if (c)
(void) c->start(c->pPrivateData);
channel = NULL;
}
-static void tusb_omap_dma_cleanup(struct dma_controller *c)
+void dma_controller_destroy(struct dma_controller *c)
{
struct tusb_omap_dma *tusb_dma;
int i;
kfree(tusb_dma);
}
-static struct dma_controller *
-tusb_omap_dma_init(struct musb *musb, void __iomem *base)
+struct dma_controller *__init
+dma_controller_create(struct musb *musb, void __iomem *base)
{
void __iomem *tusb_base = musb->ctrl_base;
struct tusb_omap_dma *tusb_dma;
return &tusb_dma->controller;
cleanup:
- tusb_omap_dma_cleanup(&tusb_dma->controller);
+ dma_controller_destroy(&tusb_dma->controller);
return NULL;
}
-
-const struct dma_controller_factory dma_controller_factory = {
- .create = tusb_omap_dma_init,
- .destroy = tusb_omap_dma_cleanup,
-};