mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 3/3] staging: comedi: dt3000: remove unneeded variable
@ 2014-08-17  4:26 Chase Southwood
  2014-08-17 10:20 ` Ian Abbott
  0 siblings, 1 reply; 2+ messages in thread
From: Chase Southwood @ 2014-08-17  4:26 UTC (permalink / raw)
  To: gregkh; +Cc: abbotti, hsweeten, devel, linux-kernel, Chase Southwood

Coccinelle (using scripts/coccinelle/tests/doublebitand.cocci) found this
assignment because 0 is or'd twice.  Upon inspection, I found that the
variable "mode" is only assigned once and used once, and thus can be
cleanly removed.  This patch plugs its value straight into writew() and
then removes the variable.

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
---
It occurred to me while doing this that zero might be or'd twice to
indicate "no information" in order to maintain some three-part structure
used elsewhere.  If this is the case, I think that the variable could
still be removed and the "| 0 | 0" could be added to the writew().

 drivers/staging/comedi/drivers/dt3000.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c
index 56e21cc..176a7ee 100644
--- a/drivers/staging/comedi/drivers/dt3000.c
+++ b/drivers/staging/comedi/drivers/dt3000.c
@@ -488,7 +488,6 @@ static int dt3k_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 	unsigned int chan, range, aref;
 	unsigned int divider;
 	unsigned int tscandiv;
-	unsigned int mode;
 
 	for (i = 0; i < cmd->chanlist_len; i++) {
 		chan = CR_CHAN(cmd->chanlist[i]);
@@ -513,8 +512,7 @@ static int dt3k_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 		writew((tscandiv & 0xffff), dev->mmio + DPR_Params(4));
 	}
 
-	mode = DT3000_AD_RETRIG_INTERNAL | 0 | 0;
-	writew(mode, dev->mmio + DPR_Params(5));
+	writew(DT3000_AD_RETRIG_INTERNAL, dev->mmio + DPR_Params(5));
 	writew(aref == AREF_DIFF, dev->mmio + DPR_Params(6));
 
 	writew(AI_FIFO_DEPTH / 2, dev->mmio + DPR_Params(7));
-- 
2.0.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-17 10:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-17  4:26 [PATCH 3/3] staging: comedi: dt3000: remove unneeded variable Chase Southwood
2014-08-17 10:20 ` Ian Abbott

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®