Skip to content
  • Ian Abbott's avatar
    staging: comedi: amplc_pci230: rewrite shared resource handling · beafb603
    Ian Abbott authored
    
    
    Some counter channels may be required for AI commands and AO commands.
    Depending on how the commands are set up, it may not be possible to run
    both at the same time, so we keep some state and code to find out if the
    required resources are busy or not.
    
    The existing code is a bit unwieldy - the code for claiming resources
    involves two `for` loops for example.  Rewrite it to make it simpler.
    
    The new code just has a bit-mask value for each shared resource (counter
    channels), and an array indexed by resource "owners" (AI and AO
    commands), so the code for claiming resources now just has a single loop
    that checks that none of the other owners have claimed the wanted
    resources.
    
    Rename the functions involved, because the old names involving 'put' and
    'get' suggested some sort of usage counting.
    
    Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
    Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    beafb603