From 40e4f830ae07a129e800052c6b2abc5ed148653d Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 3 Apr 2019 13:01:47 -0700 Subject: [PATCH] v4l: xilinx: scd: Merge the main and DMA IRQ handlers Both the main SCD driver and the DMA support code register an IRQ handler, for the same IRQ. This is unnecessary, we can just call the DMA IRQ handling function from the main IRQ handler. Signed-off-by: Laurent Pinchart Reviewed-by: Hyun Kwon --- .../platform/xilinx/xilinx-scenechange-dma.c | 22 ++++--------------- .../platform/xilinx/xilinx-scenechange.c | 2 ++ .../platform/xilinx/xilinx-scenechange.h | 1 + 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/drivers/media/platform/xilinx/xilinx-scenechange-dma.c b/drivers/media/platform/xilinx/xilinx-scenechange-dma.c index 4d632ad86421..3156eaa10150 100644 --- a/drivers/media/platform/xilinx/xilinx-scenechange-dma.c +++ b/drivers/media/platform/xilinx/xilinx-scenechange-dma.c @@ -28,14 +28,10 @@ /** * xscd_dma_irq_handler - scdma Interrupt handler - * @irq: IRQ number - * @data: Pointer to the Xilinx scdma channel structure - * - * Return: IRQ_HANDLED/IRQ_NONE + * @xscd: Pointer to the SCD device structure */ -static irqreturn_t xscd_dma_irq_handler(int irq, void *data) +void xscd_dma_irq_handler(struct xscd_device *xscd) { - struct xscd_device *xscd = data; struct xscd_dma_chan *chan; if (xscd->shared_data.memory_based) { @@ -68,8 +64,6 @@ static irqreturn_t xscd_dma_irq_handler(int irq, void *data) tasklet_schedule(&chan->tasklet); } } - - return IRQ_HANDLED; } /* ----------------------------------------------------------------------------- @@ -485,7 +479,8 @@ int xscd_dma_init(struct xscd_device *xscd) struct device_node *node = xscd->dev->of_node; struct dma_device *ddev = &xscd->dma_device; struct xscd_dma_chan *chan; - int ret, irq_num, chan_id = 0; + unsigned int chan_id; + int ret; /* Initialize the DMA engine */ ddev->dev = xscd->dev; @@ -494,15 +489,6 @@ int xscd_dma_init(struct xscd_device *xscd) ret = of_property_read_u32(node, "xlnx,numstreams", &xscd->numchannels); - irq_num = irq_of_parse_and_map(node, 0); - if (!irq_num) { - dev_err(xscd->dev, "No valid irq found\n"); - return -EINVAL; - } - - /* TODO: Clean up multiple interrupt handlers as there is one device */ - ret = devm_request_irq(xscd->dev, irq_num, xscd_dma_irq_handler, - IRQF_SHARED, "xilinx_scenechange DMA", xscd); INIT_LIST_HEAD(&ddev->channels); dma_cap_set(DMA_SLAVE, ddev->cap_mask); dma_cap_set(DMA_PRIVATE, ddev->cap_mask); diff --git a/drivers/media/platform/xilinx/xilinx-scenechange.c b/drivers/media/platform/xilinx/xilinx-scenechange.c index 1b463c6e5443..eb4564bf4385 100644 --- a/drivers/media/platform/xilinx/xilinx-scenechange.c +++ b/drivers/media/platform/xilinx/xilinx-scenechange.c @@ -28,6 +28,8 @@ static irqreturn_t xscd_irq_handler(int irq, void *data) for (i = 0; i < xscd->numstreams; ++i) xscd_chan_irq_handler(xscd->chans[i]); + xscd_dma_irq_handler(xscd); + return IRQ_HANDLED; } diff --git a/drivers/media/platform/xilinx/xilinx-scenechange.h b/drivers/media/platform/xilinx/xilinx-scenechange.h index b76220e54e86..0c7e7cd0e9cd 100644 --- a/drivers/media/platform/xilinx/xilinx-scenechange.h +++ b/drivers/media/platform/xilinx/xilinx-scenechange.h @@ -243,6 +243,7 @@ void xscd_dma_start(struct xscd_dma_chan *chan); void xscd_dma_chan_enable(struct xscd_dma_chan *chan, int chan_en); void xscd_dma_reset(struct xscd_dma_chan *chan); void xscd_dma_halt(struct xscd_dma_chan *chan); +void xscd_dma_irq_handler(struct xscd_device *xscd); int xscd_dma_init(struct xscd_device *xscd); void xscd_dma_cleanup(struct xscd_device *xscd); -- 2.39.2