LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] staging: comedi: drivers: dt2815: Removed variables that is never used
@ 2015-01-28 22:34 Rickard Strandqvist
  2015-01-29 14:05 ` Ian Abbott
  0 siblings, 1 reply; 2+ messages in thread
From: Rickard Strandqvist @ 2015-01-28 22:34 UTC (permalink / raw)
  To: Ian Abbott, H Hartley Sweeten
  Cc: Rickard Strandqvist, Greg Kroah-Hartman, devel, linux-kernel

Variable ar assigned a value that is never used.
I have also removed all the code that thereby serves no purpose.

This was found using a static code analysis program called cppcheck

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 drivers/staging/comedi/drivers/dt2815.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dt2815.c b/drivers/staging/comedi/drivers/dt2815.c
index a98fb66..c5c0490 100644
--- a/drivers/staging/comedi/drivers/dt2815.c
+++ b/drivers/staging/comedi/drivers/dt2815.c
@@ -98,12 +98,11 @@ static int dt2815_ao_insn(struct comedi_device *dev, struct comedi_subdevice *s,
 	struct dt2815_private *devpriv = dev->private;
 	int i;
 	int chan = CR_CHAN(insn->chanspec);
-	unsigned int lo, hi;
+	unsigned int lo;
 	int ret;
 
 	for (i = 0; i < insn->n; i++) {
 		lo = ((data[i] & 0x0f) << 4) | (chan << 1) | 0x01;
-		hi = (data[i] & 0xff0) >> 4;
 
 		ret = comedi_timeout(dev, s, insn, dt2815_ao_status, 0x00);
 		if (ret)
-- 
1.7.10.4


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

* Re: [PATCH] staging: comedi: drivers: dt2815: Removed variables that is never used
  2015-01-28 22:34 [PATCH] staging: comedi: drivers: dt2815: Removed variables that is never used Rickard Strandqvist
@ 2015-01-29 14:05 ` Ian Abbott
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Abbott @ 2015-01-29 14:05 UTC (permalink / raw)
  To: Rickard Strandqvist, H Hartley Sweeten
  Cc: Greg Kroah-Hartman, devel, linux-kernel

On 28/01/15 22:34, Rickard Strandqvist wrote:
> Variable ar assigned a value that is never used.
> I have also removed all the code that thereby serves no purpose.
>
> This was found using a static code analysis program called cppcheck
>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---
>   drivers/staging/comedi/drivers/dt2815.c |    3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/dt2815.c b/drivers/staging/comedi/drivers/dt2815.c
> index a98fb66..c5c0490 100644
> --- a/drivers/staging/comedi/drivers/dt2815.c
> +++ b/drivers/staging/comedi/drivers/dt2815.c
> @@ -98,12 +98,11 @@ static int dt2815_ao_insn(struct comedi_device *dev, struct comedi_subdevice *s,
>   	struct dt2815_private *devpriv = dev->private;
>   	int i;
>   	int chan = CR_CHAN(insn->chanspec);
> -	unsigned int lo, hi;
> +	unsigned int lo;
>   	int ret;
>
>   	for (i = 0; i < insn->n; i++) {
>   		lo = ((data[i] & 0x0f) << 4) | (chan << 1) | 0x01;
> -		hi = (data[i] & 0xff0) >> 4;
>
>   		ret = comedi_timeout(dev, s, insn, dt2815_ao_status, 0x00);
>   		if (ret)
>

I think this highlights a bug in the driver.  It ought to write the hi 
byte to the DT2815_DATA register, but I can't find any register 
programming manuals for this board (only a Windows driver manual - and 
that's for Windows 3.1 and Windows 95).

My guess (based on kernel log messages that have since been removed from 
the driver) is that the sequence should be:

1. wait for the DT2815_STATUS register to read 0x00
2. write the lo byte to the DT2815_DATA register
3. wait for the DT2815_STATUS register to read 0x10
4. write the hi byte to the DT2815_DATA register

and that step 4 is missing from the driver.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

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

end of thread, other threads:[~2015-01-29 14:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-28 22:34 [PATCH] staging: comedi: drivers: dt2815: Removed variables that is never used Rickard Strandqvist
2015-01-29 14:05 ` Ian Abbott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).