From: Ian Abbott <abbotti@mev.co.uk> To: <driverdev-devel@linuxdriverproject.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Ian Abbott <abbotti@mev.co.uk>, H Hartley Sweeten <hartleys@visionengravers.com>, <linux-kernel@vger.kernel.org> Subject: [PATCH 1/3] staging: comedi: adl_pci9118: simplify interrupt_pci9118_ai_dma() a bit Date: Thu, 27 Nov 2014 11:37:17 +0000 [thread overview] Message-ID: <1417088239-20460-2-git-send-email-abbotti@mev.co.uk> (raw) In-Reply-To: <1417088239-20460-1-git-send-email-abbotti@mev.co.uk> Eliminate the `next_dma_buf` variable in `interrupt_pci9118_ai_dma()`. It holds the next value of `devpriv->dma_actbuf` when double buffering is used, but we can just set that to the next value directly at the point where the buffers are switched as the old value is not used anywhere else. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> --- drivers/staging/comedi/drivers/adl_pci9118.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 5e0ff9d..aecfae8 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -608,16 +608,15 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev, struct comedi_cmd *cmd = &s->async->cmd; struct pci9118_dmabuf *dmabuf = &devpriv->dmabuf[devpriv->dma_actbuf]; unsigned int nsamples = comedi_bytes_to_samples(s, dmabuf->use_size); - unsigned int next_dma_buf; - if (devpriv->dma_doublebuf) { /* - * switch DMA buffers if is used - * double buffering - */ - next_dma_buf = 1 - devpriv->dma_actbuf; - pci9118_amcc_setup_dma(dev, next_dma_buf); - if (devpriv->ai_do == 4) - interrupt_pci9118_ai_mode4_switch(dev, next_dma_buf); + /* switch DMA buffers and restart DMA if double buffering */ + if (devpriv->dma_doublebuf) { + devpriv->dma_actbuf = 1 - devpriv->dma_actbuf; + pci9118_amcc_setup_dma(dev, devpriv->dma_actbuf); + if (devpriv->ai_do == 4) { + interrupt_pci9118_ai_mode4_switch(dev, + devpriv->dma_actbuf); + } } if (nsamples) { @@ -631,11 +630,8 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev, s->async->events |= COMEDI_CB_EOA; } - if (devpriv->dma_doublebuf) { - /* switch dma buffers */ - devpriv->dma_actbuf = 1 - devpriv->dma_actbuf; - } else { - /* restart DMA if is not used double buffering */ + /* restart DMA if not double buffering */ + if (!devpriv->dma_doublebuf) { pci9118_amcc_setup_dma(dev, 0); if (devpriv->ai_do == 4) interrupt_pci9118_ai_mode4_switch(dev, 0); -- 2.1.3
WARNING: multiple messages have this Message-ID (diff)
From: Ian Abbott <abbotti@mev.co.uk> To: driverdev-devel@linuxdriverproject.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Ian Abbott <abbotti@mev.co.uk>, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] staging: comedi: adl_pci9118: simplify interrupt_pci9118_ai_dma() a bit Date: Thu, 27 Nov 2014 11:37:17 +0000 [thread overview] Message-ID: <1417088239-20460-2-git-send-email-abbotti@mev.co.uk> (raw) In-Reply-To: <1417088239-20460-1-git-send-email-abbotti@mev.co.uk> Eliminate the `next_dma_buf` variable in `interrupt_pci9118_ai_dma()`. It holds the next value of `devpriv->dma_actbuf` when double buffering is used, but we can just set that to the next value directly at the point where the buffers are switched as the old value is not used anywhere else. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> --- drivers/staging/comedi/drivers/adl_pci9118.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 5e0ff9d..aecfae8 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -608,16 +608,15 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev, struct comedi_cmd *cmd = &s->async->cmd; struct pci9118_dmabuf *dmabuf = &devpriv->dmabuf[devpriv->dma_actbuf]; unsigned int nsamples = comedi_bytes_to_samples(s, dmabuf->use_size); - unsigned int next_dma_buf; - if (devpriv->dma_doublebuf) { /* - * switch DMA buffers if is used - * double buffering - */ - next_dma_buf = 1 - devpriv->dma_actbuf; - pci9118_amcc_setup_dma(dev, next_dma_buf); - if (devpriv->ai_do == 4) - interrupt_pci9118_ai_mode4_switch(dev, next_dma_buf); + /* switch DMA buffers and restart DMA if double buffering */ + if (devpriv->dma_doublebuf) { + devpriv->dma_actbuf = 1 - devpriv->dma_actbuf; + pci9118_amcc_setup_dma(dev, devpriv->dma_actbuf); + if (devpriv->ai_do == 4) { + interrupt_pci9118_ai_mode4_switch(dev, + devpriv->dma_actbuf); + } } if (nsamples) { @@ -631,11 +630,8 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev, s->async->events |= COMEDI_CB_EOA; } - if (devpriv->dma_doublebuf) { - /* switch dma buffers */ - devpriv->dma_actbuf = 1 - devpriv->dma_actbuf; - } else { - /* restart DMA if is not used double buffering */ + /* restart DMA if not double buffering */ + if (!devpriv->dma_doublebuf) { pci9118_amcc_setup_dma(dev, 0); if (devpriv->ai_do == 4) interrupt_pci9118_ai_mode4_switch(dev, 0); -- 2.1.3 _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
next prev parent reply other threads:[~2014-11-27 11:37 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-11-27 11:37 [PATCH 0/3] staging: comedi: adl_pci9118: some dma transfer changes Ian Abbott 2014-11-27 11:37 ` Ian Abbott 2014-11-27 11:37 ` Ian Abbott [this message] 2014-11-27 11:37 ` [PATCH 1/3] staging: comedi: adl_pci9118: simplify interrupt_pci9118_ai_dma() a bit Ian Abbott 2014-11-27 11:37 ` [PATCH 2/3] staging: comedi: adl_pci9118: try and avoid unnecessary DMA restart Ian Abbott 2014-11-27 11:37 ` Ian Abbott 2014-11-27 11:37 ` [PATCH 3/3] staging: comedi: adl_pci9118: eliminate DMA buffer defragmentation step Ian Abbott 2014-11-27 11:37 ` Ian Abbott
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1417088239-20460-2-git-send-email-abbotti@mev.co.uk \ --to=abbotti@mev.co.uk \ --cc=driverdev-devel@linuxdriverproject.org \ --cc=gregkh@linuxfoundation.org \ --cc=hartleys@visionengravers.com \ --cc=linux-kernel@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.