2014-04-25 08:17:47

by Chase Southwood

[permalink] [raw]
Subject: [PATCH 1/2] staging: comedi: addi_apci_1564: board does not have analog inputs

This board does not have analog inputs. Remove the subdevice init for
them.

Signed-off-by: Chase Southwood <[email protected]>
Cc: Ian Abbott <[email protected]>
Cc: H Hartley Sweeten <[email protected]>
---
Compile tested only. To be applied on top of
[PATCH] staging: comedi: addi_apci_1564: separate from addi_common.c

drivers/staging/comedi/drivers/addi_apci_1564.c | 31 +------------------------
1 file changed, 1 insertion(+), 30 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 792916d..eee10cc 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -144,36 +144,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,

/* Allocate and Initialise AI Subdevice Structures */
s = &dev->subdevices[0];
- if ((devpriv->s_EeParameters.i_NbrAiChannel)
- || (this_board->i_NbrAiChannelDiff)) {
- dev->read_subdev = s;
- s->type = COMEDI_SUBD_AI;
- s->subdev_flags =
- SDF_READABLE | SDF_COMMON | SDF_GROUND
- | SDF_DIFF;
- if (devpriv->s_EeParameters.i_NbrAiChannel) {
- s->n_chan =
- devpriv->s_EeParameters.i_NbrAiChannel;
- devpriv->b_SingelDiff = 0;
- } else {
- s->n_chan = this_board->i_NbrAiChannelDiff;
- devpriv->b_SingelDiff = 1;
- }
- s->maxdata = devpriv->s_EeParameters.i_AiMaxdata;
- s->len_chanlist = this_board->i_AiChannelList;
- s->range_table = this_board->pr_AiRangelist;
-
- s->insn_config = this_board->ai_config;
- s->insn_read = this_board->ai_read;
- s->insn_write = this_board->ai_write;
- s->insn_bits = this_board->ai_bits;
- s->do_cmdtest = this_board->ai_cmdtest;
- s->do_cmd = this_board->ai_cmd;
- s->cancel = this_board->ai_cancel;
-
- } else {
- s->type = COMEDI_SUBD_UNUSED;
- }
+ s->type = COMEDI_SUBD_UNUSED;

/* Allocate and Initialise AO Subdevice Structures */
s = &dev->subdevices[1];
--
1.9.0


2014-04-25 08:18:32

by Chase Southwood

[permalink] [raw]
Subject: [PATCH 2/2] staging: comedi: addi_apci_1564: board does not have analog outputs

The board supported by this driver does not have analog outputs. Remove
the subdevice init for it.

Signed-off-by: Chase Southwood <[email protected]>
Cc: Ian Abbott <[email protected]>
Cc: H Hartley Sweeten <[email protected]>
---
Compile tested only.

drivers/staging/comedi/drivers/addi_apci_1564.c | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c
index eee10cc..5f6d3b5 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -148,17 +148,8 @@ static int apci1564_auto_attach(struct comedi_device *dev,

/* Allocate and Initialise AO Subdevice Structures */
s = &dev->subdevices[1];
- if (devpriv->s_EeParameters.i_NbrAoChannel) {
- s->type = COMEDI_SUBD_AO;
- s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON;
- s->n_chan = devpriv->s_EeParameters.i_NbrAoChannel;
- s->maxdata = devpriv->s_EeParameters.i_AoMaxdata;
- s->len_chanlist =
- devpriv->s_EeParameters.i_NbrAoChannel;
- s->insn_write = this_board->ao_write;
- } else {
- s->type = COMEDI_SUBD_UNUSED;
- }
+ s->type = COMEDI_SUBD_UNUSED;
+
/* Allocate and Initialise DI Subdevice Structures */
s = &dev->subdevices[2];
if (devpriv->s_EeParameters.i_NbrDiChannel) {
--
1.9.0

2014-04-25 10:18:58

by Ian Abbott

[permalink] [raw]
Subject: Re: [PATCH 1/2] staging: comedi: addi_apci_1564: board does not have analog inputs

On 2014-04-25 09:17, Chase Southwood wrote:
> This board does not have analog inputs. Remove the subdevice init for
> them.
>
> Signed-off-by: Chase Southwood <[email protected]>
> Cc: Ian Abbott <[email protected]>
> Cc: H Hartley Sweeten <[email protected]>
> ---
> Compile tested only. To be applied on top of
> [PATCH] staging: comedi: addi_apci_1564: separate from addi_common.c

Looks good. May want to get rid of the unused subdevices at some point
during the cleanup.

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 )=-

2014-04-25 10:20:43

by Ian Abbott

[permalink] [raw]
Subject: Re: [PATCH 2/2] staging: comedi: addi_apci_1564: board does not have analog outputs

On 2014-04-25 09:18, Chase Southwood wrote:
> The board supported by this driver does not have analog outputs. Remove
> the subdevice init for it.
>
> Signed-off-by: Chase Southwood <[email protected]>
> Cc: Ian Abbott <[email protected]>
> Cc: H Hartley Sweeten <[email protected]>
> ---
> Compile tested only.

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 )=-

2014-04-25 16:07:42

by Hartley Sweeten

[permalink] [raw]
Subject: RE: [PATCH 1/2] staging: comedi: addi_apci_1564: board does not have analog inputs

On Friday, April 25, 2014 1:17 AM, Chase Southwood wrote:
> This board does not have analog inputs. Remove the subdevice init for
> them.
>
> Signed-off-by: Chase Southwood <[email protected]>
> Cc: Ian Abbott <[email protected]>
> Cc: H Hartley Sweeten <[email protected]>

Looks good.

Reviewed-by: H Hartley Sweeten <[email protected]>

As Ian mentioned, after you have removed the init for all the non-existent
subdevices you should just get rid of them and only allocate the used ones.

Thanks,
Hartley

2014-04-25 16:08:19

by Hartley Sweeten

[permalink] [raw]
Subject: RE: [PATCH 2/2] staging: comedi: addi_apci_1564: board does not have analog outputs

On Friday, April 25, 2014 1:18 AM, Chase Southwood wrote:
> The board supported by this driver does not have analog outputs. Remove
> the subdevice init for it.
>
> Signed-off-by: Chase Southwood <[email protected]>
> Cc: Ian Abbott <[email protected]>
> Cc: H Hartley Sweeten <[email protected]>

Looks good.

Reviewed-by: H Hartley Sweeten <[email protected]>