All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] staging: comedi dt2814: Removed unused variables
@ 2021-02-21 20:28 ` Fatih Yildirim
  0 siblings, 0 replies; 4+ messages in thread
From: Fatih Yildirim @ 2021-02-21 20:28 UTC (permalink / raw)
  To: abbotti, hsweeten, gregkh, grandmaster
  Cc: Fatih Yildirim, devel, linux-kernel

Removed unused variables.

Signed-off-by: Fatih Yildirim <yildirim.fatih@gmail.com>
---
 drivers/staging/comedi/drivers/dt2814.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c
index bcf4d5444faf..bd329d7b4893 100644
--- a/drivers/staging/comedi/drivers/dt2814.c
+++ b/drivers/staging/comedi/drivers/dt2814.c
@@ -186,21 +186,17 @@ static int dt2814_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 
 static irqreturn_t dt2814_interrupt(int irq, void *d)
 {
-	int lo, hi;
 	struct comedi_device *dev = d;
 	struct dt2814_private *devpriv = dev->private;
 	struct comedi_subdevice *s = dev->read_subdev;
-	int data;
 
 	if (!dev->attached) {
 		dev_err(dev->class_dev, "spurious interrupt\n");
 		return IRQ_HANDLED;
 	}
 
-	hi = inb(dev->iobase + DT2814_DATA);
-	lo = inb(dev->iobase + DT2814_DATA);
-
-	data = (hi << 4) | (lo >> 4);
+	inb(dev->iobase + DT2814_DATA);
+	inb(dev->iobase + DT2814_DATA);
 
 	if (!(--devpriv->ntrig)) {
 		int i;
@@ -229,7 +225,6 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	struct dt2814_private *devpriv;
 	struct comedi_subdevice *s;
 	int ret;
-	int i;
 
 	ret = comedi_request_region(dev, it->options[0], 0x2);
 	if (ret)
@@ -241,8 +236,8 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 		dev_err(dev->class_dev, "reset error (fatal)\n");
 		return -EIO;
 	}
-	i = inb(dev->iobase + DT2814_DATA);
-	i = inb(dev->iobase + DT2814_DATA);
+	inb(dev->iobase + DT2814_DATA);
+	inb(dev->iobase + DT2814_DATA);
 
 	if (it->options[1]) {
 		ret = request_irq(it->options[1], dt2814_interrupt, 0,
-- 
2.20.1


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

* [PATCH -next] staging: comedi dt2814: Removed unused variables
@ 2021-02-21 20:28 ` Fatih Yildirim
  0 siblings, 0 replies; 4+ messages in thread
From: Fatih Yildirim @ 2021-02-21 20:28 UTC (permalink / raw)
  To: abbotti, hsweeten, gregkh, grandmaster
  Cc: devel, linux-kernel, Fatih Yildirim

Removed unused variables.

Signed-off-by: Fatih Yildirim <yildirim.fatih@gmail.com>
---
 drivers/staging/comedi/drivers/dt2814.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c
index bcf4d5444faf..bd329d7b4893 100644
--- a/drivers/staging/comedi/drivers/dt2814.c
+++ b/drivers/staging/comedi/drivers/dt2814.c
@@ -186,21 +186,17 @@ static int dt2814_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 
 static irqreturn_t dt2814_interrupt(int irq, void *d)
 {
-	int lo, hi;
 	struct comedi_device *dev = d;
 	struct dt2814_private *devpriv = dev->private;
 	struct comedi_subdevice *s = dev->read_subdev;
-	int data;
 
 	if (!dev->attached) {
 		dev_err(dev->class_dev, "spurious interrupt\n");
 		return IRQ_HANDLED;
 	}
 
-	hi = inb(dev->iobase + DT2814_DATA);
-	lo = inb(dev->iobase + DT2814_DATA);
-
-	data = (hi << 4) | (lo >> 4);
+	inb(dev->iobase + DT2814_DATA);
+	inb(dev->iobase + DT2814_DATA);
 
 	if (!(--devpriv->ntrig)) {
 		int i;
@@ -229,7 +225,6 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	struct dt2814_private *devpriv;
 	struct comedi_subdevice *s;
 	int ret;
-	int i;
 
 	ret = comedi_request_region(dev, it->options[0], 0x2);
 	if (ret)
@@ -241,8 +236,8 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 		dev_err(dev->class_dev, "reset error (fatal)\n");
 		return -EIO;
 	}
-	i = inb(dev->iobase + DT2814_DATA);
-	i = inb(dev->iobase + DT2814_DATA);
+	inb(dev->iobase + DT2814_DATA);
+	inb(dev->iobase + DT2814_DATA);
 
 	if (it->options[1]) {
 		ret = request_irq(it->options[1], dt2814_interrupt, 0,
-- 
2.20.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH -next] staging: comedi dt2814: Removed unused variables
  2021-02-21 20:28 ` Fatih Yildirim
@ 2021-02-22 10:45   ` Ian Abbott
  -1 siblings, 0 replies; 4+ messages in thread
From: Ian Abbott @ 2021-02-22 10:45 UTC (permalink / raw)
  To: Fatih Yildirim, hsweeten, gregkh, grandmaster; +Cc: devel, linux-kernel

On 21/02/2021 20:28, Fatih Yildirim wrote:
> Removed unused variables.
> 
> Signed-off-by: Fatih Yildirim <yildirim.fatih@gmail.com>
> ---
>  drivers/staging/comedi/drivers/dt2814.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c
> index bcf4d5444faf..bd329d7b4893 100644
> --- a/drivers/staging/comedi/drivers/dt2814.c
> +++ b/drivers/staging/comedi/drivers/dt2814.c
> @@ -186,21 +186,17 @@ static int dt2814_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
>  
>  static irqreturn_t dt2814_interrupt(int irq, void *d)
>  {
> -	int lo, hi;
>  	struct comedi_device *dev = d;
>  	struct dt2814_private *devpriv = dev->private;
>  	struct comedi_subdevice *s = dev->read_subdev;
> -	int data;
>  
>  	if (!dev->attached) {
>  		dev_err(dev->class_dev, "spurious interrupt\n");
>  		return IRQ_HANDLED;
>  	}
>  
> -	hi = inb(dev->iobase + DT2814_DATA);
> -	lo = inb(dev->iobase + DT2814_DATA);
> -
> -	data = (hi << 4) | (lo >> 4);
> +	inb(dev->iobase + DT2814_DATA);
> +	inb(dev->iobase + DT2814_DATA);
>  
>  	if (!(--devpriv->ntrig)) {
>  		int i;
> @@ -229,7 +225,6 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
>  	struct dt2814_private *devpriv;
>  	struct comedi_subdevice *s;
>  	int ret;
> -	int i;
>  
>  	ret = comedi_request_region(dev, it->options[0], 0x2);
>  	if (ret)
> @@ -241,8 +236,8 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
>  		dev_err(dev->class_dev, "reset error (fatal)\n");
>  		return -EIO;
>  	}
> -	i = inb(dev->iobase + DT2814_DATA);
> -	i = inb(dev->iobase + DT2814_DATA);
> +	inb(dev->iobase + DT2814_DATA);
> +	inb(dev->iobase + DT2814_DATA);
>  
>  	if (it->options[1]) {
>  		ret = request_irq(it->options[1], dt2814_interrupt, 0,
> 

I've no objection to this patch.  The interrupt handling to support
Comedi asynchronous commands in this driver has always been broken.  I'm
tempted to remove the code for handling asynchronous commands in this
driver altogether for that reason.  (The naive fix of writing the data
to the Comedi buffer is insufficient without an additional check that
the command is running.  The end-of-conversion interrupt occurs
regardless of any command being active.)

Acked-by: Ian Abbott <abbotti@mev.co.uk>

-- 
-=( Ian Abbott <abbotti@mev.co.uk> || MEV Ltd. is a company  )=-
-=( registered in England & Wales.  Regd. number: 02862268.  )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-

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

* Re: [PATCH -next] staging: comedi dt2814: Removed unused variables
@ 2021-02-22 10:45   ` Ian Abbott
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Abbott @ 2021-02-22 10:45 UTC (permalink / raw)
  To: Fatih Yildirim, hsweeten, gregkh, grandmaster; +Cc: devel, linux-kernel

On 21/02/2021 20:28, Fatih Yildirim wrote:
> Removed unused variables.
> 
> Signed-off-by: Fatih Yildirim <yildirim.fatih@gmail.com>
> ---
>  drivers/staging/comedi/drivers/dt2814.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c
> index bcf4d5444faf..bd329d7b4893 100644
> --- a/drivers/staging/comedi/drivers/dt2814.c
> +++ b/drivers/staging/comedi/drivers/dt2814.c
> @@ -186,21 +186,17 @@ static int dt2814_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
>  
>  static irqreturn_t dt2814_interrupt(int irq, void *d)
>  {
> -	int lo, hi;
>  	struct comedi_device *dev = d;
>  	struct dt2814_private *devpriv = dev->private;
>  	struct comedi_subdevice *s = dev->read_subdev;
> -	int data;
>  
>  	if (!dev->attached) {
>  		dev_err(dev->class_dev, "spurious interrupt\n");
>  		return IRQ_HANDLED;
>  	}
>  
> -	hi = inb(dev->iobase + DT2814_DATA);
> -	lo = inb(dev->iobase + DT2814_DATA);
> -
> -	data = (hi << 4) | (lo >> 4);
> +	inb(dev->iobase + DT2814_DATA);
> +	inb(dev->iobase + DT2814_DATA);
>  
>  	if (!(--devpriv->ntrig)) {
>  		int i;
> @@ -229,7 +225,6 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
>  	struct dt2814_private *devpriv;
>  	struct comedi_subdevice *s;
>  	int ret;
> -	int i;
>  
>  	ret = comedi_request_region(dev, it->options[0], 0x2);
>  	if (ret)
> @@ -241,8 +236,8 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
>  		dev_err(dev->class_dev, "reset error (fatal)\n");
>  		return -EIO;
>  	}
> -	i = inb(dev->iobase + DT2814_DATA);
> -	i = inb(dev->iobase + DT2814_DATA);
> +	inb(dev->iobase + DT2814_DATA);
> +	inb(dev->iobase + DT2814_DATA);
>  
>  	if (it->options[1]) {
>  		ret = request_irq(it->options[1], dt2814_interrupt, 0,
> 

I've no objection to this patch.  The interrupt handling to support
Comedi asynchronous commands in this driver has always been broken.  I'm
tempted to remove the code for handling asynchronous commands in this
driver altogether for that reason.  (The naive fix of writing the data
to the Comedi buffer is insufficient without an additional check that
the command is running.  The end-of-conversion interrupt occurs
regardless of any command being active.)

Acked-by: Ian Abbott <abbotti@mev.co.uk>

-- 
-=( Ian Abbott <abbotti@mev.co.uk> || MEV Ltd. is a company  )=-
-=( registered in England & Wales.  Regd. number: 02862268.  )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

end of thread, other threads:[~2021-02-22 10:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-21 20:28 [PATCH -next] staging: comedi dt2814: Removed unused variables Fatih Yildirim
2021-02-21 20:28 ` Fatih Yildirim
2021-02-22 10:45 ` Ian Abbott
2021-02-22 10:45   ` Ian Abbott

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.