From: Nicholas Mc Guire <der.herr@hofr.at>
To: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
Nicholas Mc Guire <der.herr@hofr.at>
Subject: [PATCH RFC] comedi: rtd520: if condition with no effect - if identical to else
Date: Sun, 18 Jan 2015 12:53:24 +0100 [thread overview]
Message-ID: <1421582004-2398-1-git-send-email-der.herr@hofr.at> (raw)
The if and the else branch code are identical - so the condition has no
effect on the effective code - this patch removes the condition and the
duplicated code.
Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---
Patch is against 3.19.0-rc4 -next-20150116
This patch was only compile tested with x86_64_defconfig + CONFIG_STAGING=y
CONFIG_COMEDI=m, CONFIG_COMEDI_PCI_DRIVERS=m, CONFIG_COMEDI_RTD520=m
commit c5930d66 (staging: comedi: rtd520: use the comedi_device 'mmio'
member) introduced the current code, the probably bug was though
present before this commit:
if (devpriv->xfer_count > 0) /* transfer every N samples */
writew(IRQM_ADC_ABOUT_CNT, dev->mmio + LAS0_IT);
else /* 1/2 FIFO transfers */
writew(IRQM_ADC_ABOUT_CNT, dev->mmio + LAS0_IT);
as the if and else branch are identical but the comments indicate that
they are serving different purposes this looks like a bug. The code has
though been in use in this form for more than 2 years - so maybe the
condition is simply unnecessary. In any case this needs a review
by someone who knows the details of the driver - the below patch
is only cleaning up the current situation and may thus be wrong.
...and how did this pass multiple modifications and reviews ?...
drivers/staging/comedi/drivers/rtd520.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c
index 06ae436..3ccdade 100644
--- a/drivers/staging/comedi/drivers/rtd520.c
+++ b/drivers/staging/comedi/drivers/rtd520.c
@@ -1012,10 +1012,8 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
readw(dev->mmio + LAS0_CLEAR);
/* TODO: allow multiple interrupt sources */
- if (devpriv->xfer_count > 0) /* transfer every N samples */
- writew(IRQM_ADC_ABOUT_CNT, dev->mmio + LAS0_IT);
- else /* 1/2 FIFO transfers */
- writew(IRQM_ADC_ABOUT_CNT, dev->mmio + LAS0_IT);
+ /* transfer every N samples */
+ writew(IRQM_ADC_ABOUT_CNT, dev->mmio + LAS0_IT);
/* BUG: start_src is ASSUMED to be TRIG_NOW */
/* BUG? it seems like things are running before the "start" */
--
1.7.10.4
next reply other threads:[~2015-01-18 12:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-18 11:53 Nicholas Mc Guire [this message]
2015-01-19 10:51 ` 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=1421582004-2398-1-git-send-email-der.herr@hofr.at \
--to=der.herr@hofr.at \
--cc=abbotti@mev.co.uk \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=hsweeten@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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®