diff options
author | Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> | 2018-09-12 02:44:19 +0300 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2018-09-24 12:20:06 +0300 |
commit | 18c0b5467498ccbedd1646cbeecbd199e5f3f860 (patch) | |
tree | e8117e57c881eccb2b8d86095b4146f2635d66c7 /drivers/hid/intel-ish-hid/ishtp/client-buffers.c | |
parent | f26de33faff19bc937311df66278a2d3a1535fff (diff) | |
download | linux-18c0b5467498ccbedd1646cbeecbd199e5f3f860.tar.xz |
HID: intel_ish-hid: Enhance API to get ring buffer sizes
Added two APIs:
- ishtp_cl_get_tx_free_buffer_size:
This returns total size available for a client to queue TX data.
- ishtp_cl_get_tx_free_rings:
This returns total number of TX rings available for a client.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/intel-ish-hid/ishtp/client-buffers.c')
-rw-r--r-- | drivers/hid/intel-ish-hid/ishtp/client-buffers.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/hid/intel-ish-hid/ishtp/client-buffers.c b/drivers/hid/intel-ish-hid/ishtp/client-buffers.c index 12d61305e83d..248651c35497 100644 --- a/drivers/hid/intel-ish-hid/ishtp/client-buffers.c +++ b/drivers/hid/intel-ish-hid/ishtp/client-buffers.c @@ -69,6 +69,8 @@ int ishtp_cl_alloc_tx_ring(struct ishtp_cl *cl) int j; unsigned long flags; + cl->tx_ring_free_size = 0; + /* Allocate pool to free Tx bufs */ for (j = 0; j < cl->tx_ring_size; ++j) { struct ishtp_cl_tx_ring *tx_buf; @@ -85,6 +87,7 @@ int ishtp_cl_alloc_tx_ring(struct ishtp_cl *cl) spin_lock_irqsave(&cl->tx_free_list_spinlock, flags); list_add_tail(&tx_buf->list, &cl->tx_free_list.list); + ++cl->tx_ring_free_size; spin_unlock_irqrestore(&cl->tx_free_list_spinlock, flags); } return 0; @@ -144,6 +147,7 @@ void ishtp_cl_free_tx_ring(struct ishtp_cl *cl) tx_buf = list_entry(cl->tx_free_list.list.next, struct ishtp_cl_tx_ring, list); list_del(&tx_buf->list); + --cl->tx_ring_free_size; kfree(tx_buf->send_buf.data); kfree(tx_buf); } |