From beafb60389773e13152c7f67e05ba05111eef0f4 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Mon, 1 Sep 2014 12:03:54 +0100 Subject: [PATCH] staging: comedi: amplc_pci230: rewrite shared resource handling 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: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- Reading git-format-patch failed