2014-07-11 04:01:41

by Chase Southwood

[permalink] [raw]
Subject: [PATCH 0/4] 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(-)

--
2.0.1


2014-07-11 04:02:17

by Chase Southwood

[permalink] [raw]
Subject: [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.

Signed-off-by: Chase Southwood <[email protected]>
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(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 5924421..675054f 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -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;
--
2.0.1

2014-07-11 04:02:47

by Chase Southwood

[permalink] [raw]
Subject: [PATCH 2/4] staging: comedi: addi_apci_1564: remove unnecessary dev->board_name initialization

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.

Signed-off-by: Chase Southwood <[email protected]>
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(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 675054f..e3dcab7 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -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;
--
2.0.1

2014-07-11 04:03:06

by Chase Southwood

[permalink] [raw]
Subject: [PATCH 3/4] staging: comedi: addi_apci_1564: remove null check of devpriv in apci1564_detach()

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

Signed-off-by: Chase Southwood <[email protected]>
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(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c
index e3dcab7..f91aedd 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -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);
}

--
2.0.1

2014-07-11 04:03:35

by Chase Southwood

[permalink] [raw]
Subject: [PATCH 4/4] staging: comedi: addi_apci_1564: fix s->maxdata assignment in do subdevice init.

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

Signed-off-by: Chase Southwood <[email protected]>
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(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c
index f91aedd..1e25342 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -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;
--
2.0.1

2014-07-11 10:24:46

by Ian Abbott

[permalink] [raw]
Subject: Re: [PATCH 0/4] staging: comedi: addi_apci_1564: small fixes in apci1564_auto_attach() and apci1564_detach()

On 2014-07-11 05:00, Chase Southwood wrote:
> 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(-)
>

Reviewed-by: Ian Abbott <[email protected]>

--
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-