diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2013-09-16 22:44:47 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-10-04 01:01:16 +0200 |
commit | 22f96a0eb6c62b570621d77dacbf2589a6de2997 (patch) | |
tree | c81ff5bc3b2899721514fdbccc7d5c9bc22b504b /drivers/misc/mei/amthif.c | |
parent | mei: simplify mei_open error handling (diff) | |
download | linux-22f96a0eb6c62b570621d77dacbf2589a6de2997.tar.xz linux-22f96a0eb6c62b570621d77dacbf2589a6de2997.zip |
mei: revamp open handler counts
Make open counter to be incremented and decremented
from mei_cl_link and mei_cl_unlik function respectively
Nfc was assuming symmetric linking API and thus open handler
count was never decreased. This patch fixes that.
We need to add separate open hander count for amthif which
is handled out of link/unlink functions and doesn't break
the symmetric API.
Last we do not waste clients slots if amthif or wd are not present
in the device. we don't need to allocates slots ahead
it is all covered by link/unlink before the devices is responding
to user space connection and thus not racing on allocation
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/amthif.c')
-rw-r--r-- | drivers/misc/mei/amthif.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c index 226c3f3cd3e8..4f259d411a2c 100644 --- a/drivers/misc/mei/amthif.c +++ b/drivers/misc/mei/amthif.c @@ -58,6 +58,7 @@ void mei_amthif_reset_params(struct mei_device *dev) dev->iamthif_state = MEI_IAMTHIF_IDLE; dev->iamthif_timer = 0; dev->iamthif_stall_timer = 0; + dev->iamthif_open_count = 0; } /** @@ -731,8 +732,8 @@ static bool mei_clear_lists(struct mei_device *dev, struct file *file) */ int mei_amthif_release(struct mei_device *dev, struct file *file) { - if (dev->open_handle_count > 0) - dev->open_handle_count--; + if (dev->iamthif_open_count > 0) + dev->iamthif_open_count--; if (dev->iamthif_file_object == file && dev->iamthif_state != MEI_IAMTHIF_IDLE) { |