Skip to contentSkip to conversation

Staging: comedi: drivers: Delete double assignment

PATCH In review Bhumika Goyal 3 participants 7 messages Feb 17, 2016 – Feb 21, 2016 1 message not in the archive Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: comedi: drivers: Delete double assignment

The two assignments here are identical so one can be removed. Found using coccinelle:
@@
expression i;
@@

*i = ...;
i = ...;

---
 drivers/staging/comedi/drivers/dt2814.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/comedi/drivers/dt2814.c +0 -1
index 66705f9..e40ad56 100644
@@ -249,7 +249,6 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 		return -EIO;
 	}
 	i = inb(dev->iobase + DT2814_DATA);
-	i = inb(dev->iobase + DT2814_DATA);
 
 	if (it->options[1]) {
 		ret = request_irq(it->options[1], dt2814_interrupt, 0,
Signature · 1 line
1.9.1
#1 lore raw
Quoted 19 lines · Bhumika Goyal

The two assignments here are identical so one can be removed. Found using coccinelle:
@@
expression i;
@@

*i = ...;
i = ...;

---
 drivers/staging/comedi/drivers/dt2814.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/comedi/drivers/dt2814.c +0 -0
index 66705f9..e40ad56 100644

drivers/staging/comedi/drivers/dt2814.c static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 252

Quoted 4 lines
drivers/staging/comedi/drivers/dt2814.c +0 -1
@@ -249,7 +249,6 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 		return -EIO;
 	}
 	i = inb(dev->iobase + DT2814_DATA);
-	i = inb(dev->iobase + DT2814_DATA);

Inb reads from the device. The first call may have a side effect.

julia

Quoted 13 lines
drivers/staging/comedi/drivers/dt2814.c +0 -1
 	if (it->options[1]) {
 		ret = request_irq(it->options[1], dt2814_interrupt, 0,
--

1.9.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1455732899-17222-1-git-send-email-bhumirks%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

A message that is not in the archive (sent off-list or not yet received): CAOH+1jE2Fc=0wGkj=PjTPtY6MK41YP6LxxRKP5DfEEKMXPENtQ@mail.gmail.com

#3 lore raw

PATCH 1/1 Staging: comedi: drivers: Delete double assignment

Quoted 30 lines · Julia Lawall
Quoted 19 lines · Bhumika Goyal

The two assignments here are identical so one can be removed. Found using coccinelle:
@@
expression i;
@@

*i = ...;
i = ...;

---
 drivers/staging/comedi/drivers/dt2814.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/comedi/drivers/dt2814.c +0 -0
index 66705f9..e40ad56 100644

drivers/staging/comedi/drivers/dt2814.c static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 252

Quoted 4 lines
drivers/staging/comedi/drivers/dt2814.c +0 -1
@@ -249,7 +249,6 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
              return -EIO;
      }
      i = inb(dev->iobase + DT2814_DATA);
-     i = inb(dev->iobase + DT2814_DATA);

Inb reads from the device. The first call may have a side effect.

Quoted 2 lines

julia

Ok and here the reason might be that both calls are important because suppose the value is not read in first call it can be read in the second call? Please correct me if I am wrong.

Thanks,
Bhumika

Quoted 12 lines
Quoted 12 lines
drivers/staging/comedi/drivers/dt2814.c +0 -1
      if (it->options[1]) {
              ret = request_irq(it->options[1], dt2814_interrupt, 0,
--

1.9.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1455732899-17222-1-git-send-email-bhumirks%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#4 lore raw
Quoted 31 lines · Bhumika Goyal
Quoted 30 lines · Julia Lawall
Quoted 19 lines · Bhumika Goyal

The two assignments here are identical so one can be removed. Found using coccinelle:
@@
expression i;
@@

*i = ...;
i = ...;

---
 drivers/staging/comedi/drivers/dt2814.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/comedi/drivers/dt2814.c +0 -0
index 66705f9..e40ad56 100644

drivers/staging/comedi/drivers/dt2814.c static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 252

Quoted 4 lines
drivers/staging/comedi/drivers/dt2814.c +0 -1
@@ -249,7 +249,6 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
              return -EIO;
      }
      i = inb(dev->iobase + DT2814_DATA);
-     i = inb(dev->iobase + DT2814_DATA);

Inb reads from the device. The first call may have a side effect.

Quoted 6 lines
Quoted 2 lines

julia

Ok and here the reason might be that both calls are important because suppose the value is not read in first call it can be read in the second call? Please correct me if I am wrong.

I think that it is possible that reading a value from the device can cause the device to perform some activity.

julia

Quoted 23 lines

Thanks,
Bhumika

Quoted 5 lines
Quoted 5 lines
drivers/staging/comedi/drivers/dt2814.c +0 -1
      if (it->options[1]) {
              ret = request_irq(it->options[1], dt2814_interrupt, 0,
--

1.9.1

Quoted 7 lines
Quoted 7 lines

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1455732899-17222-1-git-send-email-bhumirks%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAOH%2B1jGB%3DEFPMTLiMYfem4dQ2QMR5p5PvsWz3%3DUJYW%3D8hQbYdw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

#5 lore raw
Quoted 38 lines · Julia Lawall
Quoted 34 lines · Bhumika Goyal
Quoted 32 lines · Julia Lawall
Quoted 19 lines · Bhumika Goyal

The two assignments here are identical so one can be removed. Found using coccinelle:
@@
expression i;
@@

*i = ...;
i = ...;

---
 drivers/staging/comedi/drivers/dt2814.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/comedi/drivers/dt2814.c +0 -0
index 66705f9..e40ad56 100644

drivers/staging/comedi/drivers/dt2814.c static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 252

Quoted 4 lines
drivers/staging/comedi/drivers/dt2814.c +0 -1
@@ -249,7 +249,6 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
              return -EIO;
      }
      i = inb(dev->iobase + DT2814_DATA);
-     i = inb(dev->iobase + DT2814_DATA);

Inb reads from the device. The first call may have a side effect.

julia

Quoted 9 lines
Quoted 3 lines

Ok and here the reason might be that both calls are important because suppose the value is not read in first call it can be read in the second call? Please correct me if I am wrong.

I think that it is possible that reading a value from the device can cause the device to perform some activity.

julia

Ok got it.

Thanks,
Bhumika

Quoted 23 lines
Quoted 23 lines

Thanks,
Bhumika

Quoted 5 lines
Quoted 5 lines
drivers/staging/comedi/drivers/dt2814.c +0 -1
      if (it->options[1]) {
              ret = request_irq(it->options[1], dt2814_interrupt, 0,
--

1.9.1

Quoted 7 lines
Quoted 7 lines

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1455732899-17222-1-git-send-email-bhumirks%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAOH%2B1jGB%3DEFPMTLiMYfem4dQ2QMR5p5PvsWz3%3DUJYW%3D8hQbYdw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

maintainer
#6 lore raw
Quoted 43 lines · Bhumika Goyal
Quoted 42 lines · Julia Lawall
Quoted 37 lines · Bhumika Goyal
Quoted 30 lines · Julia Lawall
Quoted 19 lines · Bhumika Goyal

The two assignments here are identical so one can be removed. Found using coccinelle:
@@
expression i;
@@

*i = ...;
i = ...;

---
 drivers/staging/comedi/drivers/dt2814.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/comedi/drivers/dt2814.c +0 -0
index 66705f9..e40ad56 100644

drivers/staging/comedi/drivers/dt2814.c static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 252

Quoted 4 lines
drivers/staging/comedi/drivers/dt2814.c +0 -1
@@ -249,7 +249,6 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
              return -EIO;
      }
      i = inb(dev->iobase + DT2814_DATA);
-     i = inb(dev->iobase + DT2814_DATA);

Inb reads from the device. The first call may have a side effect.

Quoted 2 lines

julia

Ok and here the reason might be that both calls are important because suppose the value is not read in first call it can be read in the second call? Please correct me if I am wrong.

Quoted 7 lines
Quoted 5 lines

I think that it is possible that reading a value from the device can cause the device to perform some activity.

julia

Ok got it.

Also, sometimes hardware needs to be read multiple times in order for it to work. There's lots of code in the kernel to work around hardware issues like this, as that's the job of the kernel.

thanks,

greg k-h

#7 lore raw
Quoted 52 lines · Greg KH
Quoted 43 lines · Bhumika Goyal
Quoted 42 lines · Julia Lawall
Quoted 37 lines · Bhumika Goyal
Quoted 30 lines · Julia Lawall
Quoted 19 lines · Bhumika Goyal

The two assignments here are identical so one can be removed. Found using coccinelle:
@@
expression i;
@@

*i = ...;
i = ...;

---
 drivers/staging/comedi/drivers/dt2814.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/comedi/drivers/dt2814.c +0 -0
index 66705f9..e40ad56 100644

drivers/staging/comedi/drivers/dt2814.c static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 252

Quoted 4 lines
drivers/staging/comedi/drivers/dt2814.c +0 -1
@@ -249,7 +249,6 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
              return -EIO;
      }
      i = inb(dev->iobase + DT2814_DATA);
-     i = inb(dev->iobase + DT2814_DATA);

Inb reads from the device. The first call may have a side effect.

Quoted 2 lines

julia

Ok and here the reason might be that both calls are important because suppose the value is not read in first call it can be read in the second call? Please correct me if I am wrong.

Quoted 7 lines
Quoted 5 lines

I think that it is possible that reading a value from the device can cause the device to perform some activity.

julia

Ok got it.

Quoted 7 lines

Also, sometimes hardware needs to be read multiple times in order for it to work. There's lots of code in the kernel to work around hardware issues like this, as that's the job of the kernel.

thanks,

greg k-h

Thanks for explaining. Things are getting clear day by day :D.

Thanks,
Bhumika