[PATCH 14/14] staging: comedi: ii_pci20kc: reorder subdevices

Ian Abbott abbotti at mev.co.uk
Fri Jul 26 11:14:59 UTC 2013


On 2013-07-25 18:00, H Hartley Sweeten wrote:
> On Thursday, July 25, 2013 7:18 AM, Ian Abbott wrote:
>> On 2013-07-24 20:14, H Hartley Sweeten wrote:
>>> Make the built-on dio subdevice 0 and the three add-on modules
>>> subdevices 1-3. This allows the driver to consistently use the
>>> ii20k_module_iobase() helper to get the base address needed to
>>> access a the registers used by a given subdevice.
>>>
>>> Signed-off-by: H Hartley Sweeten <hsweeten at visionengravers.com>
>>> Cc: Ian Abbott <abbotti at mev.co.uk>
>>> Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
>>
>> It's best to avoid reordering the subdevices if you can help it to avoid
>> screwing with userspace unnecessarily.
>
> This one can be dropped. It was added last just to make the 'iobase' use
> consistent.
>
> But...
>
> Shouldn't the userspace be getting the subdevice using
> comedi_find_subdevice_by_type()? Or can userspace directly
> access a subdevice based on the index?
>
> The original order was:
> 0 - AO or AI subdevice (module 1)
> 1 - AO or AI subdevice (module 2)
> 2 - AO or AI subdevice (module 3)
> 3 - DIO subdevice (built-in module)
>
> The new order is:
> 0 - DIO subdevice (built-in module)
> 1 - AO or AI subdevice (module 1)
> 2 - AO or AI subdevice (module 2)
> 3 - AO or AI subdevice (module 3)
>
> So logically the add-on modules are still in the same order. So
> the first call of comedi_find_subdevice_by_type() to find the
> AO or AI subdevice will still return the module 1 subdevice,
> second will return module 2, and third will return module 3.
> I see no functional change in the userspace interaction.

It's best not to second guess how much checking the application does or 
what assumptions it makes.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-


More information about the devel mailing list