Skip to contentSkip to conversation

staging: comedi: addi_apci_1564: small fixes in apci1564_auto_attach() and apci1564_detach()

PATCH In review Chase Southwood 2 participants 6 messages Jul 11, 2014 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: comedi: addi_apci_1564: small fixes in apci1564_auto_attach() and apci1564_detach()

This is a small patchset containing a handful of fixes to the ADDI-DATA APCI1564 driver that I would like to get out of the way before I forget to take care of them. From here, I will move to start fixing the digital input/timer/counters/watchdog functionality of the board.

Chase Southwood (4):
staging: comedi: addi_apci_1564: remove len_chanlist from di and do
subdevices
staging: comedi: addi_apci_1564: remove unnecessary dev->board_name
initialization
staging: comedi: addi_apci_1564: remove null check of devpriv in

    apci1564_detach()

staging: comedi: addi_apci_1564: fix s->maxdata assignment in do
subdevice init.

 drivers/staging/comedi/drivers/addi_apci_1564.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)
Signature · 1 line
2.0.1
#1 lore raw

PATCH 1/4 staging: comedi: addi_apci_1564: remove len_chanlist from di and do subdevices

This value is only needed for subdevices that support async commands. The comedi core will default the value to 1 when it is not initialized.

Cc Ian Abbott <[email protected]>
Cc H Hartley Sweeten <[email protected]>
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/comedi/drivers/addi_apci_1564.c +0 -2
index 5924421..675054f 100644
@@ -385,7 +385,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 	s->subdev_flags = SDF_READABLE;
 	s->n_chan = 32;
 	s->maxdata = 1;
-	s->len_chanlist = 32;
 	s->range_table = &range_digital;
 	s->insn_bits = apci1564_di_insn_bits;
 
@@ -395,7 +394,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 	s->subdev_flags = SDF_WRITEABLE;
 	s->n_chan = 32;
 	s->maxdata = 0xffffffff;
-	s->len_chanlist = 32;
 	s->range_table = &range_digital;
 	s->insn_config = apci1564_do_config;
 	s->insn_bits = apci1564_do_insn_bits;
Signature · 1 line
2.0.1
#2 lore raw

PATCH 2/4 staging: comedi: addi_apci_1564: remove unnecessary dev->board_name initialization

In reply to Chase Southwood

The dev->board_name is now initialized by the comedi core before calling the(*attach) or (*auto_attach) function in a driver. As long as the driver does no additional probing, it's no longer necessary initialize the board_name.

Cc Ian Abbott <[email protected]>
Cc H Hartley Sweeten <[email protected]>
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/comedi/drivers/addi_apci_1564.c +0 -2
index 675054f..e3dcab7 100644
@@ -353,8 +353,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 	struct comedi_subdevice *s;
 	int ret;
 
-	dev->board_name = dev->driver->driver_name;
-
 	devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
 	if (!devpriv)
 		return -ENOMEM;
Signature · 1 line
2.0.1
#3 lore raw

PATCH 3/4 staging: comedi: addi_apci_1564: remove null check of devpriv in apci1564_detach()

In reply to Chase Southwood

There is no need to test whether devpriv is null in this function. The check looks left over and we can just remove it.

Cc Ian Abbott <[email protected]>
Cc H Hartley Sweeten <[email protected]>
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/staging/comedi/drivers/addi_apci_1564.c +4 -8
index e3dcab7..f91aedd 100644
@@ -433,14 +433,10 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 
 static void apci1564_detach(struct comedi_device *dev)
 {
-	struct apci1564_private *devpriv = dev->private;
-
-	if (devpriv) {
-		if (dev->iobase)
-			apci1564_reset(dev);
-		if (dev->irq)
-			free_irq(dev->irq, dev);
-	}
+	if (dev->iobase)
+		apci1564_reset(dev);
+	if (dev->irq)
+		free_irq(dev->irq, dev);
 	comedi_pci_disable(dev);
 }
 
Signature · 1 line
2.0.1
#4 lore raw

PATCH 4/4 staging: comedi: addi_apci_1564: fix s->maxdata assignment in do subdevice init.

In reply to Chase Southwood

s->maxdata for the do subdevice should be 1, however currently it is being set to 0xffffffff. Fix this.

Cc Ian Abbott <[email protected]>
Cc H Hartley Sweeten <[email protected]>

---
This patch is at the end because I'm somewhat uncertain of its correctness. Every other addi_apci_* driver with a digital output subdevice sets s->maxdata to 1 so I'd be surprised if just this board differed, but I'm not familiar enough with the hardware to verify that myself. I'd appreciate a verification that this is a correct change. Thanks!

 drivers/staging/comedi/drivers/addi_apci_1564.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/addi_apci_1564.c +1 -1
index f91aedd..1e25342 100644
@@ -391,7 +391,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 	s->type = COMEDI_SUBD_DO;
 	s->subdev_flags = SDF_WRITEABLE;
 	s->n_chan = 32;
-	s->maxdata = 0xffffffff;
+	s->maxdata = 1;
 	s->range_table = &range_digital;
 	s->insn_config = apci1564_do_config;
 	s->insn_bits = apci1564_do_insn_bits;
Signature · 1 line
2.0.1
Reviewed-by on the v1 series
#5 lore raw
In reply to Chase Southwood
Quoted 11 lines · Chase Southwood

This is a small patchset containing a handful of fixes to the ADDI-DATA APCI1564 driver that I would like to get out of the way before I forget to take care of them. From here, I will move to start fixing the digital input/timer/counters/watchdog functionality of the board.

Chase Southwood (4):
staging: comedi: addi_apci_1564: remove len_chanlist from di and do
subdevices
staging: comedi: addi_apci_1564: remove unnecessary dev->board_name
initialization
staging: comedi: addi_apci_1564: remove null check of devpriv in

Quoted 7 lines
     apci1564_detach()

staging: comedi: addi_apci_1564: fix s->maxdata assignment in do
subdevice init.

  drivers/staging/comedi/drivers/addi_apci_1564.c | 18 +++++-------------
  1 file changed, 5 insertions(+), 13 deletions(-)
Signature · 2 lines
-=( Ian Abbott @ MEV Ltd.    E-mail: <[email protected]>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-