Commit f60a8b3d authored by Fabian Frederick's avatar Fabian Frederick Committed by David S. Miller

vxge: use swap() in vxge_hw_channel_dtr_alloc()

Use kernel.h macro definition.

Thanks to Julia Lawall for Coccinelle scripting support.
Signed-off-by: default avatarFabian Frederick <fabf@skynet.be>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d0cc1147
...@@ -1004,8 +1004,6 @@ void vxge_hw_device_clear_tx_rx(struct __vxge_hw_device *hldev) ...@@ -1004,8 +1004,6 @@ void vxge_hw_device_clear_tx_rx(struct __vxge_hw_device *hldev)
static enum vxge_hw_status static enum vxge_hw_status
vxge_hw_channel_dtr_alloc(struct __vxge_hw_channel *channel, void **dtrh) vxge_hw_channel_dtr_alloc(struct __vxge_hw_channel *channel, void **dtrh)
{ {
void **tmp_arr;
if (channel->reserve_ptr - channel->reserve_top > 0) { if (channel->reserve_ptr - channel->reserve_top > 0) {
_alloc_after_swap: _alloc_after_swap:
*dtrh = channel->reserve_arr[--channel->reserve_ptr]; *dtrh = channel->reserve_arr[--channel->reserve_ptr];
...@@ -1020,10 +1018,7 @@ vxge_hw_channel_dtr_alloc(struct __vxge_hw_channel *channel, void **dtrh) ...@@ -1020,10 +1018,7 @@ vxge_hw_channel_dtr_alloc(struct __vxge_hw_channel *channel, void **dtrh)
* i.e. no additional lock need to be done when we free a resource */ * i.e. no additional lock need to be done when we free a resource */
if (channel->length - channel->free_ptr > 0) { if (channel->length - channel->free_ptr > 0) {
swap(channel->reserve_arr, channel->free_arr);
tmp_arr = channel->reserve_arr;
channel->reserve_arr = channel->free_arr;
channel->free_arr = tmp_arr;
channel->reserve_ptr = channel->length; channel->reserve_ptr = channel->length;
channel->reserve_top = channel->free_ptr; channel->reserve_top = channel->free_ptr;
channel->free_ptr = channel->length; channel->free_ptr = channel->length;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment