Re: [PATCH 1/3] staging: comedi: addi_apci_1564: add a subdevice for Change-of-State interrupt support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 27, 2014 at 11:34 AM, Ian Abbott <abbotti@xxxxxxxxx> wrote:
> On 2014-05-24 23:24, Chase Southwood wrote:
>>
>> This board supports an interrupt that can be generated by an AND/OR
>> combination of 16 of the input channels.
>>
>> Create a separate subdevice to handle this interrupt.
>>
>> In doing this, this patch moves the apci1564_di_config() operation from
>> the digital input subdevice to this new subdevice, and also renames it to
>> make it more apparent that it is the config operation for the COS
>> interrupt.
>>
>> Signed-off-by: Chase Southwood <chase.southwood@xxxxxxxxx>
>> Cc: Ian Abbott <abbotti@xxxxxxxxx>
>> Cc: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
>> ---
>>   .../staging/comedi/drivers/addi-data/hwdrv_apci1564.c  |  8 ++++----
>>   drivers/staging/comedi/drivers/addi_apci_1564.c        | 18
>> ++++++++++++++++--
>>   2 files changed, 20 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
>> b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
>> index 0ba5385..a38ccf9 100644
>> --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
>> +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
>> @@ -101,10 +101,10 @@ static unsigned int ui_InterruptData, ui_Type;
>>    * data[2] Interrupt mask for the mode 1
>>    * data[3] Interrupt mask for the mode 2
>>    */
>> -static int apci1564_di_config(struct comedi_device *dev,
>> -                             struct comedi_subdevice *s,
>> -                             struct comedi_insn *insn,
>> -                             unsigned int *data)
>> +static int apci1564_cos_insn_config(struct comedi_device *dev,
>> +                                   struct comedi_subdevice *s,
>> +                                   struct comedi_insn *insn,
>> +                                   unsigned int *data)
>
>
> Since the original insn_config routine for the "DI" subdevice was quite
> "bespoke" shall we say, I don't think it's worth adopting it "as is" for the
> "COS" subdevice.  Better just to remove it until it can be implemented
> properly.

Yeah, I had a feeling about that.  I'll just rip it out and respin
this patch series to do that function properly.

>
>
>>   {
>>         struct addi_private *devpriv = dev->private;
>>
>> diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c
>> b/drivers/staging/comedi/drivers/addi_apci_1564.c
>> index 13d9962..6af1e4c 100644
>> --- a/drivers/staging/comedi/drivers/addi_apci_1564.c
>> +++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
>> @@ -105,7 +105,7 @@ static int apci1564_auto_attach(struct comedi_device
>> *dev,
>>                         dev->irq = pcidev->irq;
>>         }
>>
>> -       ret = comedi_alloc_subdevices(dev, 3);
>> +       ret = comedi_alloc_subdevices(dev, 4);
>>         if (ret)
>>                 return ret;
>>
>> @@ -117,7 +117,6 @@ static int apci1564_auto_attach(struct comedi_device
>> *dev,
>>         s->maxdata = 1;
>>         s->len_chanlist = 32;
>>         s->range_table = &range_digital;
>> -       s->insn_config = apci1564_di_config;
>>         s->insn_bits = apci1564_di_insn_bits;
>>
>>         /*  Allocate and Initialise DO Subdevice Structures */
>> @@ -144,6 +143,21 @@ static int apci1564_auto_attach(struct comedi_device
>> *dev,
>>         s->insn_read = apci1564_timer_read;
>>         s->insn_config = apci1564_timer_config;
>>
>> +       /* Change-Of-State (COS) interrupt subdevice */
>> +       s = &dev->subdevices[3];
>> +       if (dev->irq) {
>> +               dev->read_subdev = s;
>> +               s->type = COMEDI_SUBD_DI;
>> +               s->subdev_flags = SDF_READABLE | SDF_CMD_READ;
>> +               s->n_chan = 1;
>> +               s->maxdata = 1;
>> +               s->len_chanlist = 1;
>> +               s->range_table = &range_digital;
>> +               s->insn_config = apci1564_cos_insn_config;
>
>
> It would be nice to have an 'insn_bits' routine, even if the routine just
> gives back a dummy data value for now.
>

I think in the next version of this patch, I will include a dummy
'insn_bits' function (so there will be no gap between introduction of
this subdevice and introduction of the insn_bits routine), and then I
will extend the patchset to include all of the other necessary
functions for the COS functionality in a later patch.

>
>> +       } else {
>> +               s->type = COMEDI_SUBD_UNUSED;
>> +       }
>> +
>>         return 0;
>>   }
>>
>>
>

Thanks as always for the review, I'll get a new patchset out as soon as I can.
Chase.

>
> --
> -=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@xxxxxxxxx>        )=-
> -=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux